diff options
author | Chris Lattner <sabre@nondot.org> | 2007-09-24 03:35:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-09-24 03:35:37 +0000 |
commit | b3876c7446db98320b97310e61259b92267f5d82 (patch) | |
tree | 3cc6f22d074c0e9e9ee7f15cb7b8add084a66e80 /lib/CodeGen/DwarfWriter.cpp | |
parent | 83ab0d803f3f23c6743ba20b4dec8fb05beae7e7 (diff) | |
download | external_llvm-b3876c7446db98320b97310e61259b92267f5d82.zip external_llvm-b3876c7446db98320b97310e61259b92267f5d82.tar.gz external_llvm-b3876c7446db98320b97310e61259b92267f5d82.tar.bz2 |
When emitting .set directives, make sure the EH and Debug labels can't conflict.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/DwarfWriter.cpp')
-rw-r--r-- | lib/CodeGen/DwarfWriter.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index ed4de7d..e9cb692 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -798,9 +798,14 @@ protected: /// SubprogramCount - The running count of functions being compiled. /// unsigned SubprogramCount; + + /// Flavor - A unique string indicating what dwarf producer this is, used to + /// unique labels. + const char * const Flavor; unsigned SetCounter; - Dwarf(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) + Dwarf(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T, + const char *flavor) : O(OS) , Asm(A) , TAI(T) @@ -810,6 +815,7 @@ protected: , MF(NULL) , MMI(NULL) , SubprogramCount(0) + , Flavor(flavor) , SetCounter(1) { } @@ -839,11 +845,17 @@ public: PrintLabelName(Label.Tag, Label.Number); } void PrintLabelName(const char *Tag, unsigned Number) const { - O << TAI->getPrivateGlobalPrefix() << Tag; if (Number) O << Number; } + void PrintLabelName(const char *Tag, unsigned Number, + const char *Suffix) const { + O << TAI->getPrivateGlobalPrefix() << Tag; + if (Number) O << Number; + O << Suffix; + } + /// EmitLabel - Emit location label for internal use by Dwarf. /// void EmitLabel(DWLabel Label) const { @@ -888,7 +900,7 @@ public: bool IsSmall = false) { if (TAI->needsSet()) { O << "\t.set\t"; - PrintLabelName("set", SetCounter); + PrintLabelName("set", SetCounter, Flavor); O << ","; PrintLabelName(TagHi, NumberHi); O << "-"; @@ -896,9 +908,7 @@ public: O << "\n"; PrintRelDirective(IsSmall); - - PrintLabelName("set", SetCounter); - + PrintLabelName("set", SetCounter, Flavor); ++SetCounter; } else { PrintRelDirective(IsSmall); @@ -915,7 +925,7 @@ public: bool printAbsolute = false; if (TAI->needsSet()) { O << "\t.set\t"; - PrintLabelName("set", SetCounter); + PrintLabelName("set", SetCounter, Flavor); O << ","; PrintLabelName(Label, LabelNumber); @@ -932,7 +942,7 @@ public: PrintRelDirective(IsSmall); - PrintLabelName("set", SetCounter); + PrintLabelName("set", SetCounter, Flavor); ++SetCounter; } else { PrintRelDirective(IsSmall, true); @@ -2565,7 +2575,7 @@ public: // Main entry points. // DwarfDebug(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) - : Dwarf(OS, A, T) + : Dwarf(OS, A, T, "dbg") , CompileUnits() , AbbreviationsSet(InitAbbreviationsSetSize) , Abbreviations() @@ -3268,7 +3278,7 @@ public: // Main entry points. // DwarfException(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) - : Dwarf(OS, A, T) + : Dwarf(OS, A, T, "eh") , shouldEmit(false) {} |