diff options
author | gbtozers <stephen.tozer@sony.com> | 2020-09-11 15:58:01 +0100 |
---|---|---|
committer | Stephen Tozer <Stephen.Tozer@Sony.com> | 2021-03-04 11:45:35 +0000 |
commit | d07f106f4a48b6e941266525b6f7177834d7b74e (patch) | |
tree | c431b88aa92371156c8cd32835f4fd3914f74b37 /llvm/lib/CodeGen/MachineRegisterInfo.cpp | |
parent | 1562e4552cd1b3d2eadd956c966f8a60e928b8ca (diff) | |
download | llvm-d07f106f4a48b6e941266525b6f7177834d7b74e.zip llvm-d07f106f4a48b6e941266525b6f7177834d7b74e.tar.gz llvm-d07f106f4a48b6e941266525b6f7177834d7b74e.tar.bz2 |
[DebugInfo] Add new instruction and DIExpression operator for variadic debug values
This patch adds a new instruction that can represent variadic debug values,
DBG_VALUE_VAR. This patch alone covers the addition of the instruction and a set
of basic code changes in MachineInstr and a few adjacent areas, but does not
correctly handle variadic debug values outside of these areas, nor does it
generate them at any point.
The new instruction is similar to the existing DBG_VALUE instruction, with the
following differences: the operands are in a different order, any number of
values may be used in the instruction following the Variable and Expression
operands (these are referred to in code as “debug operands”) and are indexed
from 0 so that getDebugOperand(X) == getOperand(X+2), and the Expression in a
DBG_VALUE_VAR must use the DW_OP_LLVM_arg operator to pass arguments into the
expression.
The new DW_OP_LLVM_arg operator is only valid in expressions appearing in a
DBG_VALUE_VAR; it takes a single argument and pushes the debug operand at the
index given by the argument onto the Expression stack. For example the
sub-expression `DW_OP_LLVM_arg, 0` has the meaning “Push the debug operand at
index 0 onto the expression stack.”
Differential Revision: https://reviews.llvm.org/D82363
Diffstat (limited to 'llvm/lib/CodeGen/MachineRegisterInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineRegisterInfo.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp index d7444ec..58bb866 100644 --- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp +++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp @@ -530,11 +530,11 @@ bool MachineRegisterInfo::isConstantPhysReg(MCRegister PhysReg) const { /// specified register as undefined which causes the DBG_VALUE to be /// deleted during LiveDebugVariables analysis. void MachineRegisterInfo::markUsesInDebugValueAsUndef(Register Reg) const { - // Mark any DBG_VALUE that uses Reg as undef (but don't delete it.) + // Mark any DBG_VALUE* that uses Reg as undef (but don't delete it.) // We use make_early_inc_range because setReg invalidates the iterator. for (MachineInstr &UseMI : llvm::make_early_inc_range(use_instructions(Reg))) { - if (UseMI.isDebugValue()) - UseMI.getDebugOperandForReg(Reg)->setReg(0U); + if (UseMI.isDebugValue() && UseMI.hasDebugOperandForReg(Reg)) + UseMI.setDebugValueUndef(); } } |