diff options
| author | Jim Laskey <jlaskey@mac.com> | 2006-09-18 14:47:26 +0000 |
|---|---|---|
| committer | Jim Laskey <jlaskey@mac.com> | 2006-09-18 14:47:26 +0000 |
| commit | d30bba331f0f7451b9cd98a7fcbf9ea7b08eb131 (patch) | |
| tree | 4014150967ba0e980364eac3f10e951e92897481 /llvm | |
| parent | 67a35bbce7c16f1e7be5b81e987075f08196d6ad (diff) | |
| download | bcm5719-llvm-d30bba331f0f7451b9cd98a7fcbf9ea7b08eb131.tar.gz bcm5719-llvm-d30bba331f0f7451b9cd98a7fcbf9ea7b08eb131.zip | |
Sort out mangled names for globals
llvm-svn: 30460
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineDebugInfo.h | 3 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/DwarfWriter.cpp | 36 |
2 files changed, 26 insertions, 13 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineDebugInfo.h b/llvm/include/llvm/CodeGen/MachineDebugInfo.h index 17d28d8c7b9..c02eaf7224f 100644 --- a/llvm/include/llvm/CodeGen/MachineDebugInfo.h +++ b/llvm/include/llvm/CodeGen/MachineDebugInfo.h @@ -622,6 +622,9 @@ public: } void setIsStatic(bool IS) { IsStatic = IS; } void setIsDefinition(bool ID) { IsDefinition = ID; } + bool hasMangledName() const { + return !DisplayName.empty(); + } /// ApplyToFields - Target the visitor to the fields of the GlobalDesc. /// diff --git a/llvm/lib/CodeGen/DwarfWriter.cpp b/llvm/lib/CodeGen/DwarfWriter.cpp index 22d67449e17..0921cc5c647 100644 --- a/llvm/lib/CodeGen/DwarfWriter.cpp +++ b/llvm/lib/CodeGen/DwarfWriter.cpp @@ -1592,20 +1592,23 @@ DIE *DwarfWriter::NewGlobalVariable(GlobalVariableDesc *GVD) { // Get the global variable itself. GlobalVariable *GV = GVD->getGlobalVariable(); - // Generate the mangled name. - std::string MangledName = Asm->Mang->getValueName(GV); - // Gather the details (simplify add attribute code.) - const std::string &Name = GVD->getName(); - + const std::string &Name = GVD->hasMangledName() ? GVD->getDisplayName() + : GVD->getName(); + const std::string &MangledName = GVD->hasMangledName() ? GVD->getName() + : ""; // Get the global's type. DIE *Type = NewType(Unit->getDie(), GVD->getType(), Unit); // Create the globale variable DIE. DIE *VariableDie = new DIE(DW_TAG_variable); - VariableDie->AddString (DW_AT_name, DW_FORM_string, Name); - VariableDie->AddDIEntry (DW_AT_type, DW_FORM_ref4, Type); - VariableDie->AddUInt (DW_AT_external, DW_FORM_flag, 1); + VariableDie->AddString(DW_AT_name, DW_FORM_string, Name); + if (!MangledName.empty()) { + VariableDie->AddString(DW_AT_MIPS_linkage_name, DW_FORM_string, + MangledName); + } + VariableDie->AddDIEntry(DW_AT_type, DW_FORM_ref4, Type); + VariableDie->AddUInt(DW_AT_external, DW_FORM_flag, 1); // Add source line info if available. AddSourceLine(VariableDie, UnitDesc, GVD->getLine()); @@ -1642,17 +1645,24 @@ DIE *DwarfWriter::NewSubprogram(SubprogramDesc *SPD) { if (Slot) return Slot; // Gather the details (simplify add attribute code.) - const std::string &Name = SPD->getName(); + const std::string &Name = SPD->hasMangledName() ? SPD->getDisplayName() + : SPD->getName(); + const std::string &MangledName = SPD->hasMangledName() ? SPD->getName() + : ""; DIE *Type = NewType(Unit->getDie(), SPD->getType(), Unit); unsigned IsExternal = SPD->isStatic() ? 0 : 1; DIE *SubprogramDie = new DIE(DW_TAG_subprogram); - SubprogramDie->AddString (DW_AT_name, DW_FORM_string, Name); + SubprogramDie->AddString(DW_AT_name, DW_FORM_string, Name); + if (!MangledName.empty()) { + SubprogramDie->AddString(DW_AT_MIPS_linkage_name, DW_FORM_string, + MangledName); + } if (Type) { - SubprogramDie->AddDIEntry (DW_AT_type, DW_FORM_ref4, Type); + SubprogramDie->AddDIEntry(DW_AT_type, DW_FORM_ref4, Type); } - SubprogramDie->AddUInt (DW_AT_external, DW_FORM_flag, IsExternal); - SubprogramDie->AddUInt (DW_AT_prototyped, DW_FORM_flag, 1); + SubprogramDie->AddUInt(DW_AT_external, DW_FORM_flag, IsExternal); + SubprogramDie->AddUInt(DW_AT_prototyped, DW_FORM_flag, 1); // Add source line info if available. AddSourceLine(SubprogramDie, UnitDesc, SPD->getLine()); |

