[llvm-commits] [llvm] r137683 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfDebug.cpp DwarfDebug.h
Devang Patel
dpatel at apple.com
Mon Aug 15 16:36:40 PDT 2011
Author: dpatel
Date: Mon Aug 15 18:36:40 2011
New Revision: 137683
URL: http://llvm.org/viewvc/llvm-project?rev=137683&view=rev
Log:
Continue to hoist uses of getCompileUnit() up. The goal is to get rid of uses of getCompileUnit().
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=137683&r1=137682&r2=137683&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 15 18:36:40 2011
@@ -539,28 +539,22 @@
}
/// constructGlobalVariableDIE - Construct global variable DIE.
-void DwarfDebug::constructGlobalVariableDIE(const MDNode *N) {
+void DwarfDebug::constructGlobalVariableDIE(CompileUnit *TheCU,
+ const MDNode *N) {
DIGlobalVariable GV(N);
// If debug information is malformed then ignore it.
if (GV.Verify() == false)
return;
- // Check for pre-existence.
- CompileUnit *TheCU = getCompileUnit(N);
TheCU->createGlobalVariableDIE(N);
return;
}
/// construct SubprogramDIE - Construct subprogram DIE.
-void DwarfDebug::constructSubprogramDIE(const MDNode *N) {
+void DwarfDebug::constructSubprogramDIE(CompileUnit *TheCU,
+ const MDNode *N) {
DISubprogram SP(N);
-
- // Check for pre-existence.
- CompileUnit *TheCU = getCompileUnit(N);
- if (TheCU->getDIE(N))
- return;
-
if (!SP.isDefinition())
// This is a method declaration which will be handled while constructing
// class type.
@@ -603,12 +597,16 @@
constructCompileUnit(CU_Nodes->getOperand(i));
if (GV_Nodes)
- for (unsigned i = 0, e = GV_Nodes->getNumOperands(); i != e; ++i)
- constructGlobalVariableDIE(GV_Nodes->getOperand(i));
+ for (unsigned i = 0, e = GV_Nodes->getNumOperands(); i != e; ++i) {
+ const MDNode *N = GV_Nodes->getOperand(i);
+ constructGlobalVariableDIE(getCompileUnit(N), N);
+ }
if (SP_Nodes)
- for (unsigned i = 0, e = SP_Nodes->getNumOperands(); i != e; ++i)
- constructSubprogramDIE(SP_Nodes->getOperand(i));
+ for (unsigned i = 0, e = SP_Nodes->getNumOperands(); i != e; ++i) {
+ const MDNode *N = SP_Nodes->getOperand(i);
+ constructSubprogramDIE(getCompileUnit(N), N);
+ }
} else {
@@ -634,13 +632,18 @@
// Create DIEs for each global variable.
for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(),
- E = DbgFinder.global_variable_end(); I != E; ++I)
- constructGlobalVariableDIE(*I);
+ E = DbgFinder.global_variable_end(); I != E; ++I) {
+ const MDNode *N = *I;
+ if (DIGlobalVariable(N).getVersion() <= LLVMDebugVersion9)
+ constructGlobalVariableDIE(getCompileUnit(N), N);
+ }
// Create DIEs for each subprogram.
for (DebugInfoFinder::iterator I = DbgFinder.subprogram_begin(),
- E = DbgFinder.subprogram_end(); I != E; ++I)
- constructSubprogramDIE(*I);
+ E = DbgFinder.subprogram_end(); I != E; ++I) {
+ const MDNode *N = *I;
+ constructSubprogramDIE(getCompileUnit(N), N);
+ }
}
// Tell MMI that we have debug info.
@@ -698,8 +701,8 @@
}
// Construct subprogram DIE and add variables DIEs.
- constructSubprogramDIE(SP);
CompileUnit *SPCU = getCompileUnit(SP);
+ constructSubprogramDIE(SPCU, SP);
DIE *ScopeDIE = SPCU->getDIE(SP);
for (unsigned i = 0, N = Variables.size(); i < N; ++i) {
if (DIE *VariableDIE =
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=137683&r1=137682&r2=137683&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Aug 15 18:36:40 2011
@@ -416,10 +416,10 @@
CompileUnit *getCompileUnit(const MDNode *N) const;
/// constructGlobalVariableDIE - Construct global variable DIE.
- void constructGlobalVariableDIE(const MDNode *N);
+ void constructGlobalVariableDIE(CompileUnit *TheCU, const MDNode *N);
/// construct SubprogramDIE - Construct subprogram DIE.
- void constructSubprogramDIE(const MDNode *N);
+ void constructSubprogramDIE(CompileUnit *TheCU, const MDNode *N);
/// recordSourceLine - Register a source line with debug info. Returns the
/// unique label that was emitted and which provides correspondence to
More information about the llvm-commits
mailing list