1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Use the generic Lfunc_begin label on ppc.

This removes yet another custom label to mark the start of a function.

llvm-svn: 231390
This commit is contained in:
Rafael Espindola 2015-03-05 18:55:50 +00:00
parent bdce8557da
commit 22f2e68861
10 changed files with 103 additions and 31 deletions

View File

@ -118,6 +118,9 @@ protected:
// Print the EH begin symbol with an assignment. Defaults to false.
bool UseAssignmentForEHBegin;
// Do we need to create a local symbol for .size?
bool NeedsLocalForSize;
/// This prefix is used for globals like constant pool entries that are
/// completely private to the .s file and should not have names in the .o
/// file. Defaults to "L"
@ -427,6 +430,7 @@ public:
const char *getLabelSuffix() const { return LabelSuffix; }
bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; }
bool needsLocalForSize() const { return NeedsLocalForSize; }
const char *getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; }
const char *getPrivateLabelPrefix() const { return PrivateLabelPrefix; }
bool hasLinkerPrivateGlobalPrefix() const {

View File

@ -556,8 +556,12 @@ void AsmPrinter::EmitFunctionHeader() {
OutStreamer.EmitLabel(DeadBlockSyms[i]);
}
if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo()) {
bool NeedsLocalForSize = MAI->needsLocalForSize();
if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo() ||
NeedsLocalForSize) {
CurrentFnBegin = createTempSymbol("func_begin", getFunctionNumber());
if (NeedsLocalForSize)
CurrentFnSymForSize = CurrentFnBegin;
if (MAI->useAssignmentForEHBegin()) {
MCSymbol *CurPos = OutContext.CreateTempSymbol();

View File

@ -39,6 +39,7 @@ MCAsmInfo::MCAsmInfo() {
CommentString = "#";
LabelSuffix = ":";
UseAssignmentForEHBegin = false;
NeedsLocalForSize = false;
PrivateGlobalPrefix = "L";
PrivateLabelPrefix = PrivateGlobalPrefix;
LinkerPrivateGlobalPrefix = "";

View File

@ -45,6 +45,10 @@ PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) {
void PPCELFMCAsmInfo::anchor() { }
PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) {
// FIXME: This is not always needed. For example, it is not needed in the
// v2 abi.
NeedsLocalForSize = true;
if (is64Bit) {
PointerSize = CalleeSaveStackSlotSize = 8;
}

View File

@ -1082,11 +1082,6 @@ void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
// Emit a null environment pointer.
OutStreamer.EmitIntValue(0, 8 /* size */);
OutStreamer.SwitchSection(Current.first, Current.second);
MCSymbol *RealFnSym = OutContext.GetOrCreateSymbol(
".L." + Twine(CurrentFnSym->getName()));
OutStreamer.EmitLabel(RealFnSym);
CurrentFnSymForSize = RealFnSym;
}

View File

@ -17,16 +17,18 @@ entry:
; An empty function is perfectly fine on ELF.
; LINUX-NO-FP: func:
; LINUX-NO-FP-NEXT: {{^}}.L[[BEGIN:.*]]:{{$}}
; LINUX-NO-FP-NEXT: .cfi_startproc
; LINUX-NO-FP-NEXT: {{^}}#
; LINUX-NO-FP-NEXT: {{^}}.L{{.*}}:{{$}}
; LINUX-NO-FP-NEXT: .size func, .L{{.*}}-func
; LINUX-NO-FP-NEXT: {{^}}.L[[END:.*]]:{{$}}
; LINUX-NO-FP-NEXT: .size func, .L[[END]]-.L[[BEGIN]]
; LINUX-NO-FP-NEXT: .cfi_endproc
; A cfi directive can point to the end of a function. It (and in fact the
; entire body) could be optimized out because of the unreachable, but we
; don't do it right now.
; LINUX-FP: func:
; LINUX-FP-NEXT: {{^}}.L[[BEGIN:.*]]:{{$}}
; LINUX-FP-NEXT: .cfi_startproc
; LINUX-FP-NEXT: {{^}}#
; LINUX-FP-NEXT: stw 31, -4(1)
@ -38,6 +40,6 @@ entry:
; LINUX-FP-NEXT: mr 31, 1
; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
; LINUX-FP-NEXT: .cfi_def_cfa_register r31
; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
; LINUX-FP-NEXT: .size func, .Lfunc_end0-func
; LINUX-FP-NEXT: {{^}}.L[[END:.*]]:{{$}}
; LINUX-FP-NEXT: .size func, .L[[END]]-.L[[BEGIN]]
; LINUX-FP-NEXT: .cfi_endproc

View File

@ -2,6 +2,31 @@
target datalayout = "E-m:e-i64:64-n32:64"
target triple = "powerpc64-unknown-linux-gnu"
; CHECK-LABEL: test:
; CHECK: {{^}}.L[[test_BEGIN:.*]]:{{$}}
; CHECK-LABEL: property_access1:
; CHECK: {{^}}.L[[property_access1_BEGIN:.*]]:{{$}}
; CHECK-LABEL: property_access2:
; CHECK: {{^}}.L[[property_access2_BEGIN:.*]]:{{$}}
; CHECK-LABEL: property_access3:
; CHECK: {{^}}.L[[property_access3_BEGIN:.*]]:{{$}}
; CHECK-LABEL: anyreg_test1:
; CHECK: {{^}}.L[[anyreg_test1_BEGIN:.*]]:{{$}}
; CHECK-LABEL: anyreg_test2:
; CHECK: {{^}}.L[[anyreg_test2_BEGIN:.*]]:{{$}}
; CHECK-LABEL: patchpoint_spilldef:
; CHECK: {{^}}.L[[patchpoint_spilldef_BEGIN:.*]]:{{$}}
; CHECK-LABEL: patchpoint_spillargs:
; CHECK: {{^}}.L[[patchpoint_spillargs_BEGIN:.*]]:{{$}}
; Stackmap Header: no constants - 6 callsites
; CHECK-LABEL: .section .llvm_stackmaps
; CHECK-NEXT: __LLVM_StackMaps:
@ -36,7 +61,7 @@ target triple = "powerpc64-unknown-linux-gnu"
; test
; CHECK-LABEL: .long .L{{.*}}-.L.test
; CHECK: .long .L{{.*}}-.L[[test_BEGIN]]
; CHECK-NEXT: .short 0
; 3 locations
; CHECK-NEXT: .short 3
@ -62,7 +87,7 @@ entry:
}
; property access 1 - %obj is an anyreg call argument and should therefore be in a register
; CHECK-LABEL: .long .L{{.*}}-.L.property_access1
; CHECK: .long .L{{.*}}-.L[[property_access1_BEGIN]]
; CHECK-NEXT: .short 0
; 2 locations
; CHECK-NEXT: .short 2
@ -84,7 +109,7 @@ entry:
}
; property access 2 - %obj is an anyreg call argument and should therefore be in a register
; CHECK-LABEL: .long .L{{.*}}-.L.property_access2
; CHECK: .long .L{{.*}}-.L[[property_access2_BEGIN]]
; CHECK-NEXT: .short 0
; 2 locations
; CHECK-NEXT: .short 2
@ -107,7 +132,7 @@ entry:
}
; property access 3 - %obj is a frame index
; CHECK-LABEL: .long .L{{.*}}-.L.property_access3
; CHECK: .long .L{{.*}}-.L[[property_access3_BEGIN]]
; CHECK-NEXT: .short 0
; 2 locations
; CHECK-NEXT: .short 2
@ -130,7 +155,7 @@ entry:
}
; anyreg_test1
; CHECK-LABEL: .long .L{{.*}}-.L.anyreg_test1
; CHECK: .long .L{{.*}}-.L[[anyreg_test1_BEGIN]]
; CHECK-NEXT: .short 0
; 14 locations
; CHECK-NEXT: .short 14
@ -212,7 +237,7 @@ entry:
}
; anyreg_test2
; CHECK-LABEL: .long .L{{.*}}-.L.anyreg_test2
; CHECK: .long .L{{.*}}-.L[[anyreg_test2_BEGIN]]
; CHECK-NEXT: .short 0
; 14 locations
; CHECK-NEXT: .short 14
@ -297,7 +322,7 @@ entry:
;
; <rdar://problem/15432754> [JS] Assertion: "Folded a def to a non-store!"
;
; CHECK-LABEL: .long .L{{.*}}-.L.patchpoint_spilldef
; CHECK: .long .L{{.*}}-.L[[patchpoint_spilldef_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 3
; Loc 0: Register (some register that will be spilled to the stack)
@ -327,7 +352,7 @@ entry:
;
; <rdar://problem/15487687> [JS] AnyRegCC argument ends up being spilled
;
; CHECK-LABEL: .long .L{{.*}}-.L.patchpoint_spillargs
; CHECK: .long .L{{.*}}-.L[[patchpoint_spillargs_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 5
; Loc 0: Return a register

View File

@ -7,7 +7,7 @@
; CHECK-NEXT: .quad .TOC.@tocbase
; CHECK-NEXT: .quad 0
; CHECK-NEXT: .text
; CHECK-NEXT: .L.test1:
; CHECK-NEXT: .L[[BEGIN:.*]]:
define i32 @test1(i32 %a) nounwind {
entry:
@ -19,4 +19,4 @@ entry:
; however, using this directive with recent binutils will result in the error:
; .size expression for XXX does not evaluate to a constant
; so we must use the label which actually tags the start of the function.
; CHECK: .size test1, .Lfunc_end0-.L.test1
; CHECK: .size test1, .Lfunc_end0-.L[[BEGIN]]

View File

@ -7,6 +7,40 @@
target datalayout = "E-m:e-i64:64-n32:64"
target triple = "powerpc64-unknown-linux-gnu"
; CHECK-LABEL: constantargs:
; CHECK: {{^}}.L[[constantargs_BEGIN:.*]]:{{$}}
; CHECK-LABEL: osrinline:
; CHECK: {{^}}.L[[osrinline_BEGIN:.*]]:{{$}}
; CHECK-LABEL: osrcold:
; CHECK: {{^}}.L[[osrcold_BEGIN:.*]]:{{$}}
; CHECK-LABEL: propertyRead:
; CHECK: {{^}}.L[[propertyRead_BEGIN:.*]]:{{$}}
; CHECK-LABEL: propertyWrite:
; CHECK: {{^}}.L[[propertyWrite_BEGIN:.*]]:{{$}}
; CHECK-LABEL: jsVoidCall:
; CHECK: {{^}}.L[[jsVoidCall_BEGIN:.*]]:{{$}}
; CHECK-LABEL: jsIntCall:
; CHECK: {{^}}.L[[jsIntCall_BEGIN:.*]]:{{$}}
; CHECK-LABEL: spilledValue:
; CHECK: {{^}}.L[[spilledValue_BEGIN:.*]]:{{$}}
; CHECK-LABEL: spilledStackMapValue:
; CHECK: {{^}}.L[[spilledStackMapValue_BEGIN:.*]]:{{$}}
; CHECK-LABEL: liveConstant:
; CHECK: {{^}}.L[[liveConstant_BEGIN:.*]]:{{$}}
; CHECK-LABEL: clobberLR:
; CHECK: {{^}}.L[[clobberLR_BEGIN:.*]]:{{$}}
; CHECK-LABEL: .section .llvm_stackmaps
; CHECK-NEXT: __LLVM_StackMaps:
; Header
@ -51,7 +85,7 @@ target triple = "powerpc64-unknown-linux-gnu"
; Constant arguments
;
; CHECK-NEXT: .quad 1
; CHECK-NEXT: .long .L{{.*}}-.L.constantargs
; CHECK-NEXT: .long .L{{.*}}-.L[[constantargs_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 4
; SmallConstant
@ -84,7 +118,7 @@ entry:
; Inline OSR Exit
;
; CHECK-LABEL: .long .L{{.*}}-.L.osrinline
; CHECK: .long .L{{.*}}-.L[[osrinline_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 2
; CHECK-NEXT: .byte 1
@ -108,7 +142,7 @@ entry:
;
; 2 live variables in register.
;
; CHECK-LABEL: .long .L{{.*}}-.L.osrcold
; CHECK: .long .L{{.*}}-.L[[osrcold_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 2
; CHECK-NEXT: .byte 1
@ -133,7 +167,7 @@ ret:
}
; Property Read
; CHECK-LABEL: .long .L{{.*}}-.L.propertyRead
; CHECK: .long .L{{.*}}-.L[[propertyRead_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 0
;
@ -148,7 +182,7 @@ entry:
}
; Property Write
; CHECK-LABEL: .long .L{{.*}}-.L.propertyWrite
; CHECK: .long .L{{.*}}-.L[[propertyWrite_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 2
; CHECK-NEXT: .byte 1
@ -170,7 +204,7 @@ entry:
;
; 2 live variables in registers.
;
; CHECK-LABEL: .long .L{{.*}}-.L.jsVoidCall
; CHECK: .long .L{{.*}}-.L[[jsVoidCall_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 2
; CHECK-NEXT: .byte 1
@ -192,7 +226,7 @@ entry:
;
; 2 live variables in registers.
;
; CHECK-LABEL: .long .L{{.*}}-.L.jsIntCall
; CHECK: .long .L{{.*}}-.L[[jsIntCall_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 2
; CHECK-NEXT: .byte 1
@ -215,7 +249,7 @@ entry:
;
; Verify 28 stack map entries.
;
; CHECK-LABEL: .long .L{{.*}}-.L.spilledValue
; CHECK: .long .L{{.*}}-.L[[spilledValue_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 28
;
@ -234,7 +268,7 @@ entry:
;
; Verify 30 stack map entries.
;
; CHECK-LABEL: .long .L{{.*}}-.L.spilledStackMapValue
; CHECK: .long .L{{.*}}-.L[[spilledStackMapValue_BEGIN]]
; CHECK-NEXT: .short 0
; CHECK-NEXT: .short 30
;
@ -252,7 +286,7 @@ entry:
; Map a constant value.
;
; CHECK-LABEL: .long .L{{.*}}-.L.liveConstant
; CHECK: .long .L{{.*}}-.L[[liveConstant_BEGIN]]
; CHECK-NEXT: .short 0
; 1 location
; CHECK-NEXT: .short 1
@ -269,7 +303,7 @@ define void @liveConstant() {
; Map a value when LR is the only free register.
;
; CHECK-LABEL: .long .L{{.*}}-.L.clobberLR
; CHECK: .long .L{{.*}}-.L[[clobberLR_BEGIN]]
; CHECK-NEXT: .short 0
; 1 location
; CHECK-NEXT: .short 1

View File

@ -16,6 +16,7 @@ target triple = "powerpc64le-unknown-linux-gnu"
define i64 @use_toc(i64 %a) nounwind {
entry:
; CHECK-LABEL: @use_toc
; CHECK-NEXT: .L{{.*}}:
; CHECK-NEXT: .Ltmp[[TMP1:[0-9]+]]:
; CHECK-NEXT: addis 2, 12, .TOC.-.Ltmp[[TMP1]]@ha
; CHECK-NEXT: addi 2, 2, .TOC.-.Ltmp[[TMP1]]@l
@ -32,6 +33,7 @@ declare void @callee()
define void @use_toc_implicit() nounwind {
entry:
; CHECK-LABEL: @use_toc_implicit
; CHECK-NEXT: .L{{.*}}:
; CHECK-NEXT: .Ltmp[[TMP1:[0-9]+]]:
; CHECK-NEXT: addis 2, 12, .TOC.-.Ltmp[[TMP1]]@ha
; CHECK-NEXT: addi 2, 2, .TOC.-.Ltmp[[TMP1]]@l
@ -45,6 +47,7 @@ entry:
define i64 @no_toc(i64 %a) nounwind {
entry:
; CHECK-LABEL: @no_toc
; CHECK-NEXT: .L{{.*}}:
; CHECK-NEXT: %entry
ret i64 %a
}