diff options
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MIRParser.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIRParser.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp index 378102403b3..3d2db97acb4 100644 --- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp @@ -122,8 +122,9 @@ public: const yaml::StringValue &RegisterSource, bool IsRestored, int FrameIdx); + template <typename T> bool parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS, - const yaml::MachineStackObject &Object, + const T &Object, int FrameIdx); bool initializeConstantPool(PerFunctionMIParsingState &PFS, @@ -616,6 +617,8 @@ bool MIRParserImpl::initializeFrameInfo(PerFunctionMIParsingState &PFS, if (parseCalleeSavedRegister(PFS, CSIInfo, Object.CalleeSavedRegister, Object.CalleeSavedRestored, ObjectIdx)) return true; + if (parseStackObjectsDebugInfo(PFS, Object, ObjectIdx)) + return true; } // Initialize the ordinary frame objects. @@ -700,11 +703,11 @@ static bool typecheckMDNode(T *&Result, MDNode *Node, return false; } +template <typename T> bool MIRParserImpl::parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS, - const yaml::MachineStackObject &Object, int FrameIdx) { + const T &Object, int FrameIdx) { // Debug information can only be attached to stack objects; Fixed stack // objects aren't supported. - assert(FrameIdx >= 0 && "Expected a stack object frame index"); MDNode *Var = nullptr, *Expr = nullptr, *Loc = nullptr; if (parseMDNode(PFS, Var, Object.DebugVar) || parseMDNode(PFS, Expr, Object.DebugExpr) || @@ -719,7 +722,7 @@ bool MIRParserImpl::parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS, typecheckMDNode(DIExpr, Expr, Object.DebugExpr, "DIExpression", *this) || typecheckMDNode(DILoc, Loc, Object.DebugLoc, "DILocation", *this)) return true; - PFS.MF.setVariableDbgInfo(DIVar, DIExpr, unsigned(FrameIdx), DILoc); + PFS.MF.setVariableDbgInfo(DIVar, DIExpr, FrameIdx, DILoc); return false; } |