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
This commit is contained in:
Rafael Espindola 2015-03-10 03:58:36 +00:00
parent ec53c65238
commit 44292e80ac
11 changed files with 8 additions and 26 deletions

View 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

View 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; }

View 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; }

View 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; }

View 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);
}

View 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

View 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 --

View 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 {

View 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

View 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.

View File

@ -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 {