[llvm-commits] [llvm] r61772 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Devang Patel
dpatel at apple.com
Mon Jan 5 15:21:35 PST 2009
Author: dpatel
Date: Mon Jan 5 17:21:35 2009
New Revision: 61772
URL: http://llvm.org/viewvc/llvm-project?rev=61772&view=rev
Log:
Construct subprogram DIEs using DebugInfo.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=61772&r1=61771&r2=61772&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Mon Jan 5 17:21:35 2009
@@ -3214,6 +3214,45 @@
}
}
+ /// ConstructSubprograms - Create DIEs for each of the externally visible
+ /// subprograms.
+ void ConstructSubprograms() {
+
+ std::string SPName = "llvm.dbg.subprograms";
+ std::vector<GlobalVariable*> Result;
+ getGlobalVariablesUsing(*M, SPName, Result);
+ for (std::vector<GlobalVariable *>::iterator RI = Result.begin(),
+ RE = Result.end(); RI != RE; ++RI) {
+
+ DISubprogram *SP = new DISubprogram(*RI);
+ CompileUnit *Unit = FindCompileUnit(SP->getCompileUnit());
+
+ // Check for pre-existence.
+ DIE *&Slot = Unit->getDieMapSlotFor(SP->getGV());
+ if (Slot) continue;
+
+ DIE *SubprogramDie = new DIE(DW_TAG_subprogram);
+ AddString(SubprogramDie, DW_AT_name, DW_FORM_string, SP->getName());
+ const std::string &LinkageName = SP->getLinkageName();
+ if (!LinkageName.empty())
+ AddString(SubprogramDie, DW_AT_MIPS_linkage_name, DW_FORM_string,
+ LinkageName);
+ DIType SPTy = SP->getType();
+ AddType(Unit, SubprogramDie, SPTy);
+ if (!SP->isLocalToUnit())
+ AddUInt(SubprogramDie, DW_AT_external, DW_FORM_flag, 1);
+ AddUInt(SubprogramDie, DW_AT_prototyped, DW_FORM_flag, 1);
+
+ AddSourceLine(SubprogramDie, SP);
+ //Add to map.
+ Slot = SubprogramDie;
+ //Add to context owner.
+ Unit->getDie()->AddChild(SubprogramDie);
+ //Expose as global.
+ Unit->AddGlobal(SP->getName(), SubprogramDie);
+ }
+ }
+
/// ConstructSubprogramDIEs - Create DIEs for each of the externally visible
/// subprograms.
void ConstructSubprogramDIEs() {
More information about the llvm-commits
mailing list