Use a better name for compile unit labels.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 10 Mar 2015 03:58:36 +0000 (03:58 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 10 Mar 2015 03:58:36 +0000 (03:58 +0000)
They mark the start of a compile unit, so name them .Lcu_*. Using
Section->getLabelBeginName() makes it looks like they mark the start of the
section.

While at it, switch to createTempSymbol to avoid collisions with labels
created in inline assembly. Not sure if a "don't crash" test is worth it.

With this getLabelBeginName is dead, delete it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231750 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCSection.h
include/llvm/MC/MCSectionCOFF.h
include/llvm/MC/MCSectionELF.h
include/llvm/MC/MCSectionMachO.h
lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
lib/Target/NVPTX/NVPTXSection.h
test/DebugInfo/X86/dwarf-aranges.ll
test/DebugInfo/X86/dwarf-pubnames-split.ll
test/DebugInfo/X86/multiple-aranges.ll
test/DebugInfo/X86/ref_addr_relocation.ll
test/DebugInfo/X86/stmt-list-multiple-compile-units.ll

index 935fe921670f0d456d03fa38fe3b6356bff659e3..e2bfe90c9ed0364aba0cf90ada01b8dbc20762df 100644 (file)
@@ -52,10 +52,6 @@ namespace llvm {
                                       raw_ostream &OS,
                                       const MCExpr *Subsection) const = 0;
 
-    // Convenience routines to get label names for the beginning/end of a
-    // section.
-    virtual std::string getLabelBeginName() const = 0;
-
     /// isBaseAddressKnownZero - Return true if we know that this section will
     /// get a base address of zero.  In cases where we know that this is true we
     /// can emit section offsets as direct references to avoid a subtraction
index 6914f2e77684746dbac3d69b6b474f1fbc82f091..6bffdf940d18e29856156a0f16b4b2037ab63ef2 100644 (file)
@@ -60,9 +60,6 @@ class MCSymbol;
     bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
 
     StringRef getSectionName() const { return SectionName; }
-    std::string getLabelBeginName() const override {
-      return SectionName.str() + "_begin";
-    }
     unsigned getCharacteristics() const { return Characteristics; }
     MCSymbol *getCOMDATSymbol() const { return COMDATSymbol; }
     int getSelection() const { return Selection; }
index a50e542fd8594f0bfeb2f75ccf9a655f5f0f942e..5fc64a693a8fb6adf0737c0c458ae9c2937b4ca7 100644 (file)
@@ -65,11 +65,6 @@ public:
   bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
 
   StringRef getSectionName() const { return SectionName; }
-  std::string getLabelBeginName() const override {
-    if (Group)
-      return (SectionName.str() + '_' + Group->getName() + "_begin").str();
-    return SectionName.str() + "_begin";
-  }
   unsigned getType() const { return Type; }
   unsigned getFlags() const { return Flags; }
   unsigned getEntrySize() const { return EntrySize; }
index 725106c766cf815db39ebb243670b36a0a7a32b1..0c00a7dc1ac8277e0db9a1015b2004773750ab92 100644 (file)
@@ -53,10 +53,6 @@ public:
     return StringRef(SectionName);
   }
 
-  std::string getLabelBeginName() const override {
-    return StringRef(getSegmentName().str() + getSectionName().str() + "_begin");
-  }
-
   unsigned getTypeAndAttributes() const { return TypeAndAttributes; }
   unsigned getStubSize() const { return Reserved2; }
 
index 64bee0cebb9f7dd15158005389879f31f1e30ad7..85649492e2315fa6d7eb148812cfe4177dca0158 100644 (file)
@@ -714,8 +714,7 @@ void DwarfCompileUnit::collectDeadVariables(DISubprogram SP) {
 void DwarfCompileUnit::emitHeader(const MCSymbol *ASectionSym) {
   // Don't bother labeling the .dwo unit, as its offset isn't used.
   if (!Skeleton) {
-    LabelBegin =
-      Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
+    LabelBegin = Asm->createTempSymbol("cu_begin", getUniqueID());
     Asm->OutStreamer.EmitLabel(LabelBegin);
   }
 
index 8bc6336ff73292ab2d63b89e09a7eed1187055c5..6bb1e3dbb27dc50286c03f2cdc7fc52f89ad590c 100644 (file)
@@ -39,7 +39,6 @@ public:
   bool isBaseAddressKnownZero() const override { return true; }
   bool UseCodeAlign() const override { return false; }
   bool isVirtualSection() const override { return false; }
-  std::string getLabelBeginName() const override { return ""; }
 };
 
 } // end namespace llvm
index 57207c4717e8c65367cecf0fea68a5e194fc6519..56acbdf428ae475b648c2a41004ca42776f81bb2 100644 (file)
@@ -3,7 +3,7 @@
 
 ; -- header --
 ; CHECK: .short 2 # DWARF Arange version number
-; CHECK-NEXT: .long .L.debug_info_begin0
+; CHECK-NEXT: .long .Lcu_begin0
 ; CHECK-NEXT: .byte 8 # Address Size (in bytes)
 ; CHECK-NEXT: .byte 0 # Segment Size (in bytes)
 ; -- alignment --
index 12dbb4a3b1b454ab29d1a3469eb9b8748488f671..97ff1ca426a109c154e8f75b49287fbb1cfc6bbd 100644 (file)
@@ -9,7 +9,7 @@
 
 ; CHECK: .LpubTypes_begin0:
 ; CHECK-NEXT: .short    2                       # DWARF Version
-; CHECK-NEXT: .long     .L.debug_info_begin0    # Offset of Compilation Unit Info
+; CHECK-NEXT: .long     .Lcu_begin0             # Offset of Compilation Unit Info
 
 ; Function Attrs: nounwind uwtable
 define i32 @main() #0 {
index 80970695a55131d0890666a54a9648e1a3ec5e45..99878a594a923c21b3b420e68635607385bbf5e9 100644 (file)
@@ -6,7 +6,7 @@
 ; First CU
 ; CHECK-NEXT: .long   44                      # Length of ARange Set
 ; CHECK-NEXT: .short  2                       # DWARF Arange version number
-; CHECK-NEXT: .long   .L.debug_info_begin0    # Offset Into Debug Info Section
+; CHECK-NEXT: .long   .Lcu_begin0             # Offset Into Debug Info Section
 ; CHECK-NEXT: .byte   8                       # Address Size (in bytes)
 ; CHECK-NEXT: .byte   0                       # Segment Size (in bytes)
 ; CHECK-NEXT: .zero   4,255
@@ -18,7 +18,7 @@
 ; Second CU
 ; CHECK-NEXT: .long   44                      # Length of ARange Set
 ; CHECK-NEXT: .short  2                       # DWARF Arange version number
-; CHECK-NEXT: .long   .L.debug_info_begin1    # Offset Into Debug Info Section
+; CHECK-NEXT: .long   .Lcu_begin1             # Offset Into Debug Info Section
 ; CHECK-NEXT: .byte   8                       # Address Size (in bytes)
 ; CHECK-NEXT: .byte   0                       # Segment Size (in bytes)
 ; CHECK-NEXT: .zero   4,255
index 5534689aea6968d35ec209fa25861e43f4c39ae0..4cf7abcb6a961af0c3feab44c4e8c0032bf50571 100644 (file)
@@ -23,7 +23,7 @@
 ; CHECK: DW_TAG_variable
 ; CHECK: .long [[TYPE:.*]] # DW_AT_type
 ; CHECK: DW_TAG_structure_type
-; CHECK: debug_info_begin1
+; CHECK: cu_begin1
 ; CHECK: DW_TAG_compile_unit
 ; CHECK-NOT: DW_TAG_structure_type
 ; This variable's type is in the 1st CU.
index 76945f3fe4fb1ed6ae922fa7ace8ea114d18ecf5..8e1c3c924485bca2ac0fb908d68e1562a5c166bf 100644 (file)
 ; DWARF3-NOT: file_names
 
 ; PR15408
-; ASM: L__DWARF__debug_info_begin0:
+; ASM: Lcu_begin0:
 ; ASM: Lset3 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
 ; ASM-NEXT: .long   Lset3
-; ASM: L__DWARF__debug_info_begin1:
+; ASM: Lcu_begin1:
 ; ASM: Lset13 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
 ; ASM-NEXT: .long   Lset13
 define i32 @test(i32 %a) nounwind uwtable ssp {