summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveDebugValues.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-08-02 00:16:56 +0000
committerAdrian Prantl <aprantl@apple.com>2017-08-02 00:16:56 +0000
commit83ca4fc7bc5b4675704c414e75bf95deb5f41b12 (patch)
tree6c8d7f0de1615996077d10b5e70bfff1affdbc48 /llvm/lib/CodeGen/LiveDebugValues.cpp
parentaf26b22cd2156217bf03ac355cc1751693b00442 (diff)
downloadbcm5719-llvm-83ca4fc7bc5b4675704c414e75bf95deb5f41b12.tar.gz
bcm5719-llvm-83ca4fc7bc5b4675704c414e75bf95deb5f41b12.zip
Update LiveDebugValues to generate DIExpressions for spill offsets
instead of using the deprecated offset field of DBG_VALUE. This has no observable effect on the generated DWARF, but the assembler comments will look different. rdar://problem/33580047 llvm-svn: 309773
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues.cpp
index 22851e110cf..89a66496ddd 100644
--- a/llvm/lib/CodeGen/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues.cpp
@@ -29,6 +29,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineMemOperand.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/Support/Debug.h"
@@ -446,11 +447,15 @@ void LiveDebugValues::transferSpillInst(MachineInstr &MI,
// iterator in our caller.
unsigned SpillBase;
int SpillOffset = extractSpillBaseRegAndOffset(MI, SpillBase);
+ const Module *M = MF->getMMI().getModule();
const MachineInstr *DMI = &VarLocIDs[ID].MI;
+ auto *SpillExpr = DIExpression::prepend(
+ DMI->getDebugExpression(), DIExpression::NoDeref, SpillOffset);
+ // Add the expression to the metadata graph so isn't lost in MIR dumps.
+ M->getNamedMetadata("llvm.dbg.mir")->addOperand(SpillExpr);
MachineInstr *SpDMI =
BuildMI(*MF, DMI->getDebugLoc(), DMI->getDesc(), true, SpillBase,
- DMI->getDebugVariable(), DMI->getDebugExpression());
- SpDMI->getOperand(1).setImm(SpillOffset);
+ DMI->getDebugVariable(), SpillExpr);
DEBUG(dbgs() << "Creating DBG_VALUE inst for spill: ";
SpDMI->print(dbgs(), false, TII));
OpenPOWER on IntegriCloud