Use the vanilla func_end symbol for .size.

No need to create yet another temp symbol.

llvm-svn: 231198
This commit is contained in:
Rafael Espindola 2015-03-04 01:35:23 +00:00
parent 151315f471
commit 310e4b592f
8 changed files with 11 additions and 14 deletions

View File

@ -882,7 +882,7 @@ void AsmPrinter::EmitFunctionBody() {
// Emit target-specific gunk after the function body.
EmitFunctionBodyEnd();
if (!MMI->getLandingPads().empty()) {
if (!MMI->getLandingPads().empty() || MAI->hasDotTypeDotSizeDirective()) {
// Create a symbol for the end of function.
CurrentFnEnd = createTempSymbol("func_end", getFunctionNumber());
OutStreamer.EmitLabel(CurrentFnEnd);
@ -891,13 +891,10 @@ void AsmPrinter::EmitFunctionBody() {
// If the target wants a .size directive for the size of the function, emit
// it.
if (MAI->hasDotTypeDotSizeDirective()) {
// Create a symbol for the end of function, so we can get the size as
// difference between the function label and the temp label.
MCSymbol *FnEndLabel = OutContext.CreateTempSymbol();
OutStreamer.EmitLabel(FnEndLabel);
// We can get the size as difference between the function label and the
// temp label.
const MCExpr *SizeExp =
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(FnEndLabel, OutContext),
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(CurrentFnEnd, OutContext),
MCSymbolRefExpr::Create(CurrentFnSymForSize,
OutContext),
OutContext);

View File

@ -39,5 +39,5 @@ entry:
; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
; LINUX-FP-NEXT: .cfi_def_cfa_register r31
; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
; LINUX-FP-NEXT: .size func, .Ltmp3-func
; LINUX-FP-NEXT: .size func, .Lfunc_end0-func
; LINUX-FP-NEXT: .cfi_endproc

View File

@ -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, .Ltmp0-.L.test1
; CHECK: .size test1, .Lfunc_end0-.L.test1

View File

@ -28,5 +28,5 @@ entry:
; LINUX-FP-NEXT: {{^}}.L{{.*}}:{{$}}
; LINUX-FP-NEXT: .cfi_register 15, 31
; LINUX-FP-NEXT: {{^}}.L{{.*}}:{{$}}
; LINUX-FP-NEXT: .size func, .Ltmp3-func
; LINUX-FP-NEXT: .size func, .Lfunc_end0-func
; LINUX-FP-NEXT: .cfi_endproc

View File

@ -50,5 +50,5 @@ entry:
; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
; LINUX-FP-NEXT: .cfi_def_cfa_register %rbp
; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
; LINUX-FP-NEXT: .size func, .Ltmp3-func
; LINUX-FP-NEXT: .size func, .Lfunc_end0-func
; LINUX-FP-NEXT: .cfi_endproc

View File

@ -66,7 +66,7 @@ define i1 @test_relocate(i32 addrspace(1)* %a) gc "statepoint-example" {
; Check that an ununsed relocate has no code-generation impact
; CHECK: pushq %rax
; CHECK: callq return_i1
; CHECK-NEXT: .Ltmp13:
; CHECK-NEXT: .Ltmp9:
; CHECK-NEXT: popq %rdx
; CHECK-NEXT: retq
entry:

View File

@ -28,7 +28,7 @@
; Then it's addressed via %rsp:
; CHECK: .quad [[START_LABEL]]-.Lfunc_begin0
; CHECK-NEXT: .Lfunc_end0-.Lfunc_begin0
; CHECK-NEXT: .Lfunc_end06-.Lfunc_begin0
; CHECK: DW_OP_breg7
; CHECK-NEXT: [[OFFSET]]
; CHECK: DW_OP_deref

View File

@ -21,7 +21,7 @@
; CHECK: .Ldebug_loc{{[0-9]+}}:
; CHECK: DW_OP_breg1
; CHECK: .quad [[START_LABEL]]-.Lfunc_begin0
; CHECK-NEXT: .quad .Lfunc_end0-.Lfunc_begin0
; CHECK-NEXT: .quad .Lfunc_end09-.Lfunc_begin0
; CHECK: DW_OP_breg6
; CHECK: DW_OP_deref