summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MIRPrinter.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-08-19 00:13:25 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-08-19 00:13:25 +0000
commitdf9e3c6fb0b94dcff370eb1c840487f6349ac6a5 (patch)
tree6bfa02dc92ba4a0db970e96e43f397c00ee9fd4f /llvm/lib/CodeGen/MIRPrinter.cpp
parent861ad97e6f1bd354ec51865587073bd94bea2d64 (diff)
downloadbcm5719-llvm-df9e3c6fb0b94dcff370eb1c840487f6349ac6a5.tar.gz
bcm5719-llvm-df9e3c6fb0b94dcff370eb1c840487f6349ac6a5.zip
MIR Serialization: Serialize MMI's variable debug information.
llvm-svn: 245396
Diffstat (limited to 'llvm/lib/CodeGen/MIRPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 67fd5c226a5..faeb9055c23 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -84,7 +84,8 @@ public:
void convert(ModuleSlotTracker &MST, yaml::MachineJumpTable &YamlJTI,
const MachineJumpTableInfo &JTI);
void convertStackObjects(yaml::MachineFunction &MF,
- const MachineFrameInfo &MFI, ModuleSlotTracker &MST,
+ const MachineFrameInfo &MFI, MachineModuleInfo &MMI,
+ ModuleSlotTracker &MST,
const TargetRegisterInfo *TRI);
private:
@@ -171,7 +172,7 @@ void MIRPrinter::print(const MachineFunction &MF) {
ModuleSlotTracker MST(MF.getFunction()->getParent());
MST.incorporateFunction(*MF.getFunction());
convert(MST, YamlMF.FrameInfo, *MF.getFrameInfo());
- convertStackObjects(YamlMF, *MF.getFrameInfo(), MST,
+ convertStackObjects(YamlMF, *MF.getFrameInfo(), MF.getMMI(), MST,
MF.getSubtarget().getRegisterInfo());
if (const auto *ConstantPool = MF.getConstantPool())
convert(YamlMF, *ConstantPool);
@@ -265,6 +266,7 @@ void MIRPrinter::convert(ModuleSlotTracker &MST,
void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF,
const MachineFrameInfo &MFI,
+ MachineModuleInfo &MMI,
ModuleSlotTracker &MST,
const TargetRegisterInfo *TRI) {
// Process fixed stack objects.
@@ -342,6 +344,29 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF,
MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)
.printStackObjectReference(MFI.getStackProtectorIndex());
}
+
+ // Print the debug variable information.
+ for (MachineModuleInfo::VariableDbgInfo &DebugVar :
+ MMI.getVariableDbgInfo()) {
+ auto StackObjectInfo = StackObjectOperandMapping.find(DebugVar.Slot);
+ assert(StackObjectInfo != StackObjectOperandMapping.end() &&
+ "Invalid stack object index");
+ const FrameIndexOperand &StackObject = StackObjectInfo->second;
+ assert(!StackObject.IsFixed && "Expected a non-fixed stack object");
+ auto &Object = MF.StackObjects[StackObject.ID];
+ {
+ raw_string_ostream StrOS(Object.DebugVar.Value);
+ DebugVar.Var->printAsOperand(StrOS, MST);
+ }
+ {
+ raw_string_ostream StrOS(Object.DebugExpr.Value);
+ DebugVar.Expr->printAsOperand(StrOS, MST);
+ }
+ {
+ raw_string_ostream StrOS(Object.DebugLoc.Value);
+ DebugVar.Loc->printAsOperand(StrOS, MST);
+ }
+ }
}
void MIRPrinter::convert(yaml::MachineFunction &MF,
OpenPOWER on IntegriCloud