[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp MachineDebugInfo.cpp
Jim Laskey
jlaskey at apple.com
Thu Jan 26 13:23:01 PST 2006
Changes in directory llvm/lib/CodeGen:
DwarfWriter.cpp updated: 1.18 -> 1.19
MachineDebugInfo.cpp updated: 1.5 -> 1.6
---
Log message:
Use global information to fill out Dwarf compile units.
---
Diffs of the changes: (+18 -22)
DwarfWriter.cpp | 30 ++++++++++--------------------
MachineDebugInfo.cpp | 10 ++++++++--
2 files changed, 18 insertions(+), 22 deletions(-)
Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.18 llvm/lib/CodeGen/DwarfWriter.cpp:1.19
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.18 Thu Jan 26 14:21:46 2006
+++ llvm/lib/CodeGen/DwarfWriter.cpp Thu Jan 26 15:22:49 2006
@@ -1242,20 +1242,16 @@
/// NewCompileUnit - Create new compile unit information.
///
-DIE *DwarfWriter::NewCompileUnit(const std::string &Directory,
- const std::string &SourceName) {
+DIE *DwarfWriter::NewCompileUnit(const CompileUnitWrapper &CompileUnit) {
DIE *Unit = new DIE(DW_TAG_compile_unit, DW_CHILDREN_yes);
// FIXME - use the correct line set.
Unit->AddLabel (DW_AT_stmt_list, DW_FORM_data4, DWLabel("line", 0));
Unit->AddLabel (DW_AT_high_pc, DW_FORM_addr, DWLabel("text_end", 0));
Unit->AddLabel (DW_AT_low_pc, DW_FORM_addr, DWLabel("text_begin", 0));
- // FIXME - The producer needs to be in this form, but should come from
- // an appropriate source.
- Unit->AddString(DW_AT_producer, DW_FORM_string,
- "llvm 3.4.x (LLVM Research Group)");
- Unit->AddInt (DW_AT_language, DW_FORM_data1, DW_LANG_C89);
- Unit->AddString(DW_AT_name, DW_FORM_string, SourceName);
- Unit->AddString(DW_AT_comp_dir, DW_FORM_string, Directory);
+ Unit->AddString(DW_AT_producer, DW_FORM_string, CompileUnit.getProducer());
+ Unit->AddInt (DW_AT_language, DW_FORM_data1, CompileUnit.getLanguage());
+ Unit->AddString(DW_AT_name, DW_FORM_string, CompileUnit.getFileName());
+ Unit->AddString(DW_AT_comp_dir, DW_FORM_string, CompileUnit.getDirectory());
Unit->Complete(*this);
return Unit;
@@ -1700,17 +1696,11 @@
/// ConstructCompileUnitDIEs - Create a compile unit DIE for each source and
/// header file.
void DwarfWriter::ConstructCompileUnitDIEs() {
- // Get directory and source information.
- const UniqueVector<std::string> &Directories = DebugInfo->getDirectories();
- const UniqueVector<SourceFileInfo> &SourceFiles = DebugInfo->getSourceFiles();
-
- // Construct compile unit DIEs for each source.
- for (unsigned SourceID = 1, NSID = SourceFiles.size();
- SourceID <= NSID; ++SourceID) {
- const SourceFileInfo &SourceFile = SourceFiles[SourceID];
- const std::string &Directory = Directories[SourceFile.getDirectoryID()];
- const std::string &SourceName = SourceFile.getName();
- DIE *Unit = NewCompileUnit(Directory, SourceName);
+ const UniqueVector<CompileUnitWrapper> CUW = DebugInfo->getCompileUnits();
+
+ for (unsigned i = 1, N = CUW.size(); i <= N; ++i) {
+ const CompileUnitWrapper &CompileUnit = CUW[i];
+ DIE *Unit = NewCompileUnit(CompileUnit);
DWContext *Context = new DWContext(*this, NULL, Unit);
CompileUnits.push_back(Unit);
}
Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.5 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.6
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.5 Thu Jan 26 14:21:46 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp Thu Jan 26 15:22:49 2006
@@ -180,7 +180,7 @@
/// getContext - Return the "lldb.compile_unit" context global.
///
GlobalVariable *GlobalWrapper::getContext() const {
- return dyn_cast<GlobalVariable>(IC->getOperand(1));
+ return cast<GlobalVariable>(IC->getOperand(1));
}
/// getName - Return the name of the global.
@@ -192,7 +192,7 @@
/// getType - Return the type of the global.
///
const GlobalVariable *GlobalWrapper::getType() const {
- return dyn_cast<GlobalVariable>(IC->getOperand(4));
+ return cast<GlobalVariable>(IC->getOperand(4));
}
/// isStatic - Return true if the global is static.
@@ -274,6 +274,12 @@
if (CompileUnits.size() != Globals.size()) CompileUnits.reset();
}
+/// getCompileUnits - Return a vector of debug compile units.
+///
+const UniqueVector<CompileUnitWrapper> MachineDebugInfo::getCompileUnits()const{
+ return CompileUnits;
+}
+
/// getGlobalVariables - Return a vector of debug global variables.
///
std::vector<GlobalWrapper> MachineDebugInfo::getGlobalVariables(Module &M) {
More information about the llvm-commits
mailing list