From: Devang Patel Date: Thu, 1 Oct 2009 01:15:28 +0000 (+0000) Subject: Add another MDNode into DebugLocTuple. This will be used to keep track of inlined... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=a1434045c32eb6818354a607b84d99353af759b0 Add another MDNode into DebugLocTuple. This will be used to keep track of inlined functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83190 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/DebugLoc.h b/include/llvm/Support/DebugLoc.h index 358cfe3dae6..30590c7c1d7 100644 --- a/include/llvm/Support/DebugLoc.h +++ b/include/llvm/Support/DebugLoc.h @@ -25,17 +25,19 @@ namespace llvm { /// struct DebugLocTuple { MDNode *CompileUnit; + MDNode *InlinedLoc; unsigned Line, Col; DebugLocTuple() - : CompileUnit(0), Line(~0U), Col(~0U) {}; + : CompileUnit(0), InlinedLoc(0), Line(~0U), Col(~0U) {}; - DebugLocTuple(MDNode *n, unsigned l, unsigned c) - : CompileUnit(n), Line(l), Col(c) {}; + DebugLocTuple(MDNode *n, MDNode *i, unsigned l, unsigned c) + : CompileUnit(n), InlinedLoc(i), Line(l), Col(c) {}; bool operator==(const DebugLocTuple &DLT) const { return CompileUnit == DLT.CompileUnit && - Line == DLT.Line && Col == DLT.Col; + InlinedLoc == DLT.InlinedLoc && + Line == DLT.Line && Col == DLT.Col; } bool operator!=(const DebugLocTuple &DLT) const { return !(*this == DLT); @@ -66,18 +68,20 @@ namespace llvm { // Specialize DenseMapInfo for DebugLocTuple. template<> struct DenseMapInfo { static inline DebugLocTuple getEmptyKey() { - return DebugLocTuple(0, ~0U, ~0U); + return DebugLocTuple(0, 0, ~0U, ~0U); } static inline DebugLocTuple getTombstoneKey() { - return DebugLocTuple((MDNode*)~1U, ~1U, ~1U); + return DebugLocTuple((MDNode*)~1U, (MDNode*)~1U, ~1U, ~1U); } static unsigned getHashValue(const DebugLocTuple &Val) { return DenseMapInfo::getHashValue(Val.CompileUnit) ^ + DenseMapInfo::getHashValue(Val.InlinedLoc) ^ DenseMapInfo::getHashValue(Val.Line) ^ DenseMapInfo::getHashValue(Val.Col); } static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) { return LHS.CompileUnit == RHS.CompileUnit && + LHS.InlinedLoc == RHS.InlinedLoc && LHS.Line == RHS.Line && LHS.Col == RHS.Col; } diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 6df1610517b..6b13e74a739 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -952,7 +952,6 @@ void DIFactory::InsertDeclare(Value *Storage, DIVariable D, BasicBlock *BB) { /// processModule - Process entire module and collect debug info. void DebugInfoFinder::processModule(Module &M) { - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI) for (BasicBlock::iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE; @@ -1271,7 +1270,7 @@ bool getLocationInfo(const Value *V, std::string &DisplayName, Value *Context = SPI.getContext(); // If this location is already tracked then use it. - DebugLocTuple Tuple(cast(Context), SPI.getLine(), + DebugLocTuple Tuple(cast(Context), NULL, SPI.getLine(), SPI.getColumn()); DenseMap::iterator II = DebugLocInfo.DebugIdMap.find(Tuple); @@ -1292,9 +1291,11 @@ bool getLocationInfo(const Value *V, std::string &DisplayName, DebugLocTracker &DebugLocInfo) { DebugLoc DL; MDNode *Context = Loc.getScope().getNode(); - + MDNode *InlinedLoc = NULL; + if (!Loc.getOrigLocation().isNull()) + InlinedLoc = Loc.getOrigLocation().getNode(); // If this location is already tracked then use it. - DebugLocTuple Tuple(Context, Loc.getLineNumber(), + DebugLocTuple Tuple(Context, InlinedLoc, Loc.getLineNumber(), Loc.getColumnNumber()); DenseMap::iterator II = DebugLocInfo.DebugIdMap.find(Tuple); @@ -1321,7 +1322,7 @@ bool getLocationInfo(const Value *V, std::string &DisplayName, DICompileUnit CU(Subprogram.getCompileUnit()); // If this location is already tracked then use it. - DebugLocTuple Tuple(CU.getNode(), Line, /* Column */ 0); + DebugLocTuple Tuple(CU.getNode(), NULL, Line, /* Column */ 0); DenseMap::iterator II = DebugLocInfo.DebugIdMap.find(Tuple); if (II != DebugLocInfo.DebugIdMap.end()) diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 484ce94ffcd..7e834737f01 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -60,7 +60,7 @@ AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm, OutStreamer(*createAsmStreamer(OutContext, O, *T, 0)), LastMI(0), LastFn(0), Counter(~0U), - PrevDLT(0, ~0U, ~0U) { + PrevDLT(0, 0, ~0U, ~0U) { DW = 0; MMI = 0; switch (AsmVerbose) { case cl::BOU_UNSET: VerboseAsm = VDef; break;