From 622b02601bafdf40d103d67951fae88f409c4641 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 19 Jan 2010 06:19:05 +0000 Subject: [PATCH] MDNodes are not expected to disappear or replaced by another MDNode, so there is no need to pay the cost of WeakVH and ValueMaps. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93865 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 17 +++++++++-------- lib/CodeGen/AsmPrinter/DwarfDebug.h | 14 +++++++------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 138e9748811..b9910c35bad 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -56,12 +56,12 @@ class CompileUnit { /// GVToDieMap - Tracks the mapping of unit level debug informaton /// variables to debug information entries. /// FIXME : Rename GVToDieMap -> NodeToDieMap - ValueMap GVToDieMap; + DenseMap GVToDieMap; /// GVToDIEEntryMap - Tracks the mapping of unit level debug informaton /// descriptors to debug information entries using a DIEEntry proxy. /// FIXME : Rename - ValueMap GVToDIEEntryMap; + DenseMap GVToDIEEntryMap; /// Globals - A map of globally visible named entities for this unit. /// @@ -108,7 +108,7 @@ public: /// getDIEEntry - Returns the debug information entry for the speciefied /// debug variable. DIEEntry *getDIEEntry(MDNode *N) { - ValueMap::iterator I = GVToDIEEntryMap.find(N); + DenseMap::iterator I = GVToDIEEntryMap.find(N); if (I == GVToDIEEntryMap.end()) return NULL; return I->second; @@ -1162,7 +1162,8 @@ DIE *DwarfDebug::createSubprogramDIE(const DISubprogram &SP, bool MakeDecl) { addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_constu); addUInt(Block, 0, dwarf::DW_FORM_data1, SP.getVirtualIndex()); addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, 0, Block); - ContainingTypeMap.insert(std::make_pair(SPDie, WeakVH(SP.getContainingType().getNode()))); + ContainingTypeMap.insert(std::make_pair(SPDie, + SP.getContainingType().getNode())); } if (MakeDecl || !SP.isDefinition()) { @@ -1379,7 +1380,7 @@ DIE *DwarfDebug::constructInlinedScopeDIE(DbgScope *Scope) { InlinedSubprogramDIEs.insert(OriginDIE); // Track the start label for this inlined function. - ValueMap >::iterator + DenseMap >::iterator I = InlineInfo.find(InlinedSP.getNode()); if (I == InlineInfo.end()) { @@ -1808,7 +1809,7 @@ void DwarfDebug::endModule() { TE = TopLevelDIEsVector.end(); TI != TE; ++TI) ModuleCU->getCUDie()->addChild(*TI); - for (DenseMap::iterator CI = ContainingTypeMap.begin(), + for (DenseMap::iterator CI = ContainingTypeMap.begin(), CE = ContainingTypeMap.end(); CI != CE; ++CI) { DIE *SPDie = CI->first; MDNode *N = dyn_cast_or_null(CI->second); @@ -2042,7 +2043,7 @@ bool DwarfDebug::extractScopeInformation(MachineFunction *MF) { // and end of a scope respectively. Create an inverse map that list scopes // starts (and ends) with an instruction. One instruction may start (or end) // multiple scopes. - for (ValueMap::iterator DI = DbgScopeMap.begin(), + for (DenseMap::iterator DI = DbgScopeMap.begin(), DE = DbgScopeMap.end(); DI != DE; ++DI) { DbgScope *S = DI->second; if (S->isAbstractScope()) @@ -2922,7 +2923,7 @@ void DwarfDebug::emitDebugInlineInfo() { E = InlinedSPNodes.end(); I != E; ++I) { MDNode *Node = *I; - ValueMap >::iterator II + DenseMap >::iterator II = InlineInfo.find(Node); SmallVector &Labels = II->second; DISubprogram SP(Node); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index 950f40d69b8..fb6cb1ce29b 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -20,7 +20,7 @@ #include "llvm/CodeGen/MachineLocation.h" #include "llvm/Analysis/DebugInfo.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/ADT/ValueMap.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringMap.h" @@ -136,25 +136,25 @@ class DwarfDebug : public Dwarf { /// DbgScopeMap - Tracks the scopes in the current function. /// - ValueMap DbgScopeMap; + DenseMap DbgScopeMap; /// ConcreteScopes - Tracks the concrete scopees in the current function. /// These scopes are also included in DbgScopeMap. - ValueMap ConcreteScopes; + DenseMap ConcreteScopes; /// AbstractScopes - Tracks the abstract scopes a module. These scopes are /// not included DbgScopeMap. - ValueMap AbstractScopes; + DenseMap AbstractScopes; SmallVectorAbstractScopesList; /// AbstractVariables - Collection on abstract variables. - ValueMap AbstractVariables; + DenseMap AbstractVariables; /// InliendSubprogramDIEs - Collection of subprgram DIEs that are marked /// (at the end of the module) as DW_AT_inline. SmallPtrSet InlinedSubprogramDIEs; - DenseMap ContainingTypeMap; + DenseMap ContainingTypeMap; /// AbstractSubprogramDIEs - Collection of abstruct subprogram DIEs. SmallPtrSet AbstractSubprogramDIEs; @@ -176,7 +176,7 @@ class DwarfDebug : public Dwarf { /// InlineInfo - Keep track of inlined functions and their location. This /// information is used to populate debug_inlined section. typedef std::pair InlineInfoLabels; - ValueMap > InlineInfo; + DenseMap > InlineInfo; SmallVector InlinedSPNodes; /// CompileUnitOffsets - A vector of the offsets of the compile units. This is -- 2.34.1