From: Devang Patel Date: Thu, 26 Aug 2010 20:06:46 +0000 (+0000) Subject: Update DanglingDebugInfo so that it can be used to track llvm.dbg.declare also. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f2ec7ae2799c149e4eccfb5a3632f9ba8c6dae7b;p=oota-llvm.git Update DanglingDebugInfo so that it can be used to track llvm.dbg.declare also. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112213 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 15ad23de979..a1ff8adc462 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -875,12 +875,23 @@ void SelectionDAGBuilder::visit(unsigned Opcode, const User &I) { void SelectionDAGBuilder::resolveDanglingDebugInfo(const Value *V, SDValue Val) { DanglingDebugInfo &DDI = DanglingDebugInfoMap[V]; - if (DDI.getDI()) { - const DbgValueInst *DI = DDI.getDI(); + MDNode *Variable = NULL; + uint64_t Offset = 0; + + if (const DbgValueInst *DI = dyn_cast_or_null(DDI.getDI())) { + Variable = DI->getVariable(); + Offset = DI->getOffset(); + } else if (const DbgDeclareInst *DI = + dyn_cast_or_null(DDI.getDI())) + Variable = DI->getVariable(); + else { + assert (DDI.getDI() == NULL && "Invalid debug info intrinsic!"); + return; + } + + if (Variable) { DebugLoc dl = DDI.getdl(); unsigned DbgSDNodeOrder = DDI.getSDNodeOrder(); - MDNode *Variable = DI->getVariable(); - uint64_t Offset = DI->getOffset(); SDDbgValue *SDV; if (Val.getNode()) { if (!EmitFuncArgumentDbgValue(V, Variable, Offset, Val)) { diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index 2ba88974abe..047a05dd671 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -36,7 +36,7 @@ class BasicBlock; class BitCastInst; class BranchInst; class CallInst; -class DbgValueInst; +class DbgInfoIntrinsic; class ExtractElementInst; class ExtractValueInst; class FCmpInst; @@ -96,14 +96,14 @@ class SelectionDAGBuilder { /// DanglingDebugInfo - Helper type for DanglingDebugInfoMap. class DanglingDebugInfo { - const DbgValueInst* DI; + const DbgInfoIntrinsic* DI; DebugLoc dl; unsigned SDNodeOrder; public: DanglingDebugInfo() : DI(0), dl(DebugLoc()), SDNodeOrder(0) { } - DanglingDebugInfo(const DbgValueInst *di, DebugLoc DL, unsigned SDNO) : + DanglingDebugInfo(const DbgInfoIntrinsic *di, DebugLoc DL, unsigned SDNO) : DI(di), dl(DL), SDNodeOrder(SDNO) { } - const DbgValueInst* getDI() { return DI; } + const DbgInfoIntrinsic* getDI() { return DI; } DebugLoc getdl() { return dl; } unsigned getSDNodeOrder() { return SDNodeOrder; } };