[llvm] r231750 - Use a better name for compile unit labels.

Rafael Espindola rafael.espindola at gmail.com
Mon Mar 9 20:58:36 PDT 2015


Author: rafael
Date: Mon Mar  9 22:58:36 2015
New Revision: 231750

URL: http://llvm.org/viewvc/llvm-project?rev=231750&view=rev
Log:
Use a better name for compile unit labels.

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.

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

Modified: llvm/trunk/include/llvm/MC/MCSection.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSection.h (original)
+++ llvm/trunk/include/llvm/MC/MCSection.h Mon Mar  9 22:58:36 2015
@@ -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

Modified: llvm/trunk/include/llvm/MC/MCSectionCOFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionCOFF.h?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionCOFF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionCOFF.h Mon Mar  9 22:58:36 2015
@@ -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; }

Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionELF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionELF.h Mon Mar  9 22:58:36 2015
@@ -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; }

Modified: llvm/trunk/include/llvm/MC/MCSectionMachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionMachO.h?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionMachO.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionMachO.h Mon Mar  9 22:58:36 2015
@@ -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; }
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Mar  9 22:58:36 2015
@@ -714,8 +714,7 @@ void DwarfCompileUnit::collectDeadVariab
 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);
   }
 

Modified: llvm/trunk/lib/Target/NVPTX/NVPTXSection.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXSection.h?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXSection.h (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXSection.h Mon Mar  9 22:58:36 2015
@@ -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

Modified: llvm/trunk/test/DebugInfo/X86/dwarf-aranges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarf-aranges.ll?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarf-aranges.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarf-aranges.ll Mon Mar  9 22:58:36 2015
@@ -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 --

Modified: llvm/trunk/test/DebugInfo/X86/dwarf-pubnames-split.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarf-pubnames-split.ll?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarf-pubnames-split.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarf-pubnames-split.ll Mon Mar  9 22:58:36 2015
@@ -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 {

Modified: llvm/trunk/test/DebugInfo/X86/multiple-aranges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/multiple-aranges.ll?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/multiple-aranges.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/multiple-aranges.ll Mon Mar  9 22:58:36 2015
@@ -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

Modified: llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/ref_addr_relocation.ll Mon Mar  9 22:58:36 2015
@@ -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.

Modified: llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll?rev=231750&r1=231749&r2=231750&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll Mon Mar  9 22:58:36 2015
@@ -50,10 +50,10 @@
 ; 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 {





More information about the llvm-commits mailing list