diff options
author | stozer <stephen.tozer@sony.com> | 2020-06-22 16:01:12 +0100 |
---|---|---|
committer | stozer <stephen.tozer@sony.com> | 2020-06-22 16:01:12 +0100 |
commit | 539381da26096df54ccf862088c8242498a7dcae (patch) | |
tree | d900f6b3513c227d8f5fd572b390705bb2f4ea0c /llvm/lib/CodeGen/LiveDebugVariables.cpp | |
parent | 597a9070b52d235fac40ef55b9d16bf77d8f4dd7 (diff) | |
download | llvm-539381da26096df54ccf862088c8242498a7dcae.zip llvm-539381da26096df54ccf862088c8242498a7dcae.tar.gz llvm-539381da26096df54ccf862088c8242498a7dcae.tar.bz2 |
[DebugInfo] Update MachineInstr to help support variadic DBG_VALUE instructions
Following on from this RFC[0] from a while back, this is the first patch towards
implementing variadic debug values.
This patch specifically adds a set of functions to MachineInstr for performing
operations specific to debug values, and replacing uses of the more general
functions where appropriate. The most prevalent of these is replacing
getOperand(0) with getDebugOperand(0) for debug-value-specific code, as the
operands corresponding to values will no longer be at index 0, but index 2 and
upwards: getDebugOperand(x) == getOperand(x+2). Similar replacements have been
added for the other operands, along with some helper functions to replace
oft-repeated code and operate on a variable number of value operands.
[0] http://lists.llvm.org/pipermail/llvm-dev/2020-February/139376.html<Paste>
Differential Revision: https://reviews.llvm.org/D81852
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveDebugVariables.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index a686d12..145421f 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -608,8 +608,8 @@ UserValue *LDVImpl::lookupVirtReg(unsigned VirtReg) { bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) { // DBG_VALUE loc, offset, variable if (MI.getNumOperands() != 4 || - !(MI.getOperand(1).isReg() || MI.getOperand(1).isImm()) || - !MI.getOperand(2).isMetadata()) { + !(MI.getDebugOffset().isReg() || MI.getDebugOffset().isImm()) || + !MI.getDebugVariableOp().isMetadata()) { LLVM_DEBUG(dbgs() << "Can't handle " << MI); return false; } @@ -622,9 +622,9 @@ bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) { // (and if the machine verifier is improved to catch this), then these checks // could be removed or replaced by asserts. bool Discard = false; - if (MI.getOperand(0).isReg() && - Register::isVirtualRegister(MI.getOperand(0).getReg())) { - const Register Reg = MI.getOperand(0).getReg(); + if (MI.getDebugOperand(0).isReg() && + Register::isVirtualRegister(MI.getDebugOperand(0).getReg())) { + const Register Reg = MI.getDebugOperand(0).getReg(); if (!LIS->hasInterval(Reg)) { // The DBG_VALUE is described by a virtual register that does not have a // live interval. Discard the DBG_VALUE. @@ -648,14 +648,15 @@ bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) { } // Get or create the UserValue for (variable,offset) here. - bool IsIndirect = MI.getOperand(1).isImm(); + bool IsIndirect = MI.isDebugOffsetImm(); if (IsIndirect) - assert(MI.getOperand(1).getImm() == 0 && "DBG_VALUE with nonzero offset"); + assert(MI.getDebugOffset().getImm() == 0 && + "DBG_VALUE with nonzero offset"); const DILocalVariable *Var = MI.getDebugVariable(); const DIExpression *Expr = MI.getDebugExpression(); UserValue *UV = getUserValue(Var, Expr->getFragmentInfo(), MI.getDebugLoc()); if (!Discard) - UV->addDef(Idx, MI.getOperand(0), IsIndirect, *Expr); + UV->addDef(Idx, MI.getDebugOperand(0), IsIndirect, *Expr); else { MachineOperand MO = MachineOperand::CreateReg(0U, false); MO.setIsDebug(); |