diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-04-25 18:58:06 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-04-25 18:58:06 +0000 |
commit | 57fcd3454a5c3285fe7959e14601b8c307ed03b6 (patch) | |
tree | 42cdc13363acef9e5fa393a3abcebd555b2af875 /llvm/lib/CodeGen/MIRPrinter.cpp | |
parent | beffdb9daac6ed4545fcf241abad559387c6ea51 (diff) | |
download | bcm5719-llvm-57fcd3454a5c3285fe7959e14601b8c307ed03b6.tar.gz bcm5719-llvm-57fcd3454a5c3285fe7959e14601b8c307ed03b6.zip |
[MIR] Add support for debug metadata for fixed stack objects
Debug var, expr and loc were only supported for non-fixed stack objects.
This patch adds the following fields to the "fixedStack:" entries, and
renames the ones from "stack:" to:
* debug-info-variable
* debug-info-expression
* debug-info-location
Differential Revision: https://reviews.llvm.org/D46032
llvm-svn: 330859
Diffstat (limited to 'llvm/lib/CodeGen/MIRPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MIRPrinter.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index 15a6a578ce7..797affa9431 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -256,6 +256,21 @@ static void printRegClassOrBank(unsigned Reg, yaml::StringValue &Dest, OS << printRegClassOrBank(Reg, RegInfo, TRI); } +template <typename T> +static void +printStackObjectDbgInfo(const MachineFunction::VariableDbgInfo &DebugVar, + T &Object, ModuleSlotTracker &MST) { + std::array<std::string *, 3> Outputs{{&Object.DebugVar.Value, + &Object.DebugExpr.Value, + &Object.DebugLoc.Value}}; + std::array<const Metadata *, 3> Metas{{DebugVar.Var, + DebugVar.Expr, + DebugVar.Loc}}; + for (unsigned i = 0; i < 3; ++i) { + raw_string_ostream StrOS(*Outputs[i]); + Metas[i]->printAsOperand(StrOS, MST); + } +} void MIRPrinter::convert(yaml::MachineFunction &MF, const MachineRegisterInfo &RegInfo, @@ -421,19 +436,12 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &YMF, assert(StackObjectInfo != StackObjectOperandMapping.end() && "Invalid stack object index"); const FrameIndexOperand &StackObject = StackObjectInfo->second; - assert(!StackObject.IsFixed && "Expected a non-fixed stack object"); - auto &Object = YMF.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); + if (StackObject.IsFixed) { + auto &Object = YMF.FixedStackObjects[StackObject.ID]; + printStackObjectDbgInfo(DebugVar, Object, MST); + } else { + auto &Object = YMF.StackObjects[StackObject.ID]; + printStackObjectDbgInfo(DebugVar, Object, MST); } } } |