From: Rafael Espindola Date: Tue, 10 Mar 2015 03:58:36 +0000 (+0000) Subject: Use a better name for compile unit labels. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=44292e80acfd76d3584054b059a9559f2f449390;p=oota-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231750 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h index 935fe921670..e2bfe90c9ed 100644 --- a/include/llvm/MC/MCSection.h +++ b/include/llvm/MC/MCSection.h @@ -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 diff --git a/include/llvm/MC/MCSectionCOFF.h b/include/llvm/MC/MCSectionCOFF.h index 6914f2e7768..6bffdf940d1 100644 --- a/include/llvm/MC/MCSectionCOFF.h +++ b/include/llvm/MC/MCSectionCOFF.h @@ -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; } diff --git a/include/llvm/MC/MCSectionELF.h b/include/llvm/MC/MCSectionELF.h index a50e542fd85..5fc64a693a8 100644 --- a/include/llvm/MC/MCSectionELF.h +++ b/include/llvm/MC/MCSectionELF.h @@ -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; } diff --git a/include/llvm/MC/MCSectionMachO.h b/include/llvm/MC/MCSectionMachO.h index 725106c766c..0c00a7dc1ac 100644 --- a/include/llvm/MC/MCSectionMachO.h +++ b/include/llvm/MC/MCSectionMachO.h @@ -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; } diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 64bee0cebb9..85649492e23 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -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); } diff --git a/lib/Target/NVPTX/NVPTXSection.h b/lib/Target/NVPTX/NVPTXSection.h index 8bc6336ff73..6bb1e3dbb27 100644 --- a/lib/Target/NVPTX/NVPTXSection.h +++ b/lib/Target/NVPTX/NVPTXSection.h @@ -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 diff --git a/test/DebugInfo/X86/dwarf-aranges.ll b/test/DebugInfo/X86/dwarf-aranges.ll index 57207c4717e..56acbdf428a 100644 --- a/test/DebugInfo/X86/dwarf-aranges.ll +++ b/test/DebugInfo/X86/dwarf-aranges.ll @@ -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 -- diff --git a/test/DebugInfo/X86/dwarf-pubnames-split.ll b/test/DebugInfo/X86/dwarf-pubnames-split.ll index 12dbb4a3b1b..97ff1ca426a 100644 --- a/test/DebugInfo/X86/dwarf-pubnames-split.ll +++ b/test/DebugInfo/X86/dwarf-pubnames-split.ll @@ -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 { diff --git a/test/DebugInfo/X86/multiple-aranges.ll b/test/DebugInfo/X86/multiple-aranges.ll index 80970695a55..99878a594a9 100644 --- a/test/DebugInfo/X86/multiple-aranges.ll +++ b/test/DebugInfo/X86/multiple-aranges.ll @@ -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 diff --git a/test/DebugInfo/X86/ref_addr_relocation.ll b/test/DebugInfo/X86/ref_addr_relocation.ll index 5534689aea6..4cf7abcb6a9 100644 --- a/test/DebugInfo/X86/ref_addr_relocation.ll +++ b/test/DebugInfo/X86/ref_addr_relocation.ll @@ -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. diff --git a/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll b/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll index 76945f3fe4f..8e1c3c92448 100644 --- a/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll +++ b/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll @@ -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 {