From: Rafael Espindola Date: Mon, 26 Mar 2018 20:40:22 +0000 (+0000) Subject: Use local symbols for creating .stack-size. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78fdca3cd55cbb28924542e9a7102a088bb4566c;p=platform%2Fupstream%2Fllvm.git Use local symbols for creating .stack-size. llvm-svn: 328581 --- diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index f117771..6b35d01 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -978,7 +978,7 @@ void AsmPrinter::emitStackSizeSection(const MachineFunction &MF) { OutStreamer->PushSection(); OutStreamer->SwitchSection(StackSizeSection); - const MCSymbol *FunctionSymbol = getSymbol(&MF.getFunction()); + const MCSymbol *FunctionSymbol = getFunctionBegin(); uint64_t StackSize = FrameInfo.getStackSize(); OutStreamer->EmitSymbolValue(FunctionSymbol, TM.getProgramPointerSize()); OutStreamer->EmitULEB128IntValue(StackSize); @@ -1506,7 +1506,8 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { CurrentFnBegin = nullptr; CurExceptionSym = nullptr; bool NeedsLocalForSize = MAI->needsLocalForSize(); - if (needFuncLabelsForEHOrDebugInfo(MF, MMI) || NeedsLocalForSize) { + if (needFuncLabelsForEHOrDebugInfo(MF, MMI) || NeedsLocalForSize || + MF.getTarget().Options.EmitStackSizeSection) { CurrentFnBegin = createTempSymbol("func_begin"); if (NeedsLocalForSize) CurrentFnSymForSize = CurrentFnBegin; diff --git a/llvm/test/CodeGen/ARM/stack-size-section.ll b/llvm/test/CodeGen/ARM/stack-size-section.ll index c1d7976..142261a 100644 --- a/llvm/test/CodeGen/ARM/stack-size-section.ll +++ b/llvm/test/CodeGen/ARM/stack-size-section.ll @@ -1,8 +1,9 @@ ; RUN: llc < %s -mtriple=armv7-linux -stack-size-section | FileCheck %s ; CHECK-LABEL: func1: +; CHECK-NEXT: .Lfunc_begin0: ; CHECK: .section .stack_sizes,"",%progbits -; CHECK-NEXT: .long func1 +; CHECK-NEXT: .long .Lfunc_begin0 ; CHECK-NEXT: .byte 8 define void @func1(i32, i32) #0 { alloca i32, align 4 @@ -11,8 +12,9 @@ define void @func1(i32, i32) #0 { } ; CHECK-LABEL: func2: +; CHECK-NEXT: .Lfunc_begin1: ; CHECK: .section .stack_sizes,"",%progbits -; CHECK-NEXT: .long func2 +; CHECK-NEXT: .long .Lfunc_begin1 ; CHECK-NEXT: .byte 16 define void @func2() #0 { alloca i32, align 4 diff --git a/llvm/test/CodeGen/SystemZ/stack-size-section.ll b/llvm/test/CodeGen/SystemZ/stack-size-section.ll index 52dffc8..f0e421f 100644 --- a/llvm/test/CodeGen/SystemZ/stack-size-section.ll +++ b/llvm/test/CodeGen/SystemZ/stack-size-section.ll @@ -1,16 +1,18 @@ ; RUN: llc < %s -mtriple=s390x-linux-gnu -stack-size-section | FileCheck %s ; CHECK-LABEL: func1: +; CHECK-NEXT: .Lfunc_begin0: ; CHECK: .section .stack_sizes,"",@progbits -; CHECK-NEXT: .quad func1 +; CHECK-NEXT: .quad .Lfunc_begin0 ; CHECK-NEXT: .byte 0 define void @func1(i32, i32) #0 { ret void } ; CHECK-LABEL: func2: +; CHECK-NEXT: .Lfunc_begin1: ; CHECK: .section .stack_sizes,"",@progbits -; CHECK-NEXT: .quad func2 +; CHECK-NEXT: .quad .Lfunc_begin1 ; CHECK-NEXT: .ascii "\250\001" define void @func2(i32, i32) #0 { alloca i32, align 4 @@ -19,8 +21,9 @@ define void @func2(i32, i32) #0 { } ; CHECK-LABEL: func3: +; CHECK-NEXT: .Lfunc_begin2: ; CHECK: .section .stack_sizes,"",@progbits -; CHECK-NEXT: .quad func3 +; CHECK-NEXT: .quad .Lfunc_begin2 ; CHECK-NEXT: .ascii "\250\001" define void @func3() #0 { alloca i32, align 4 diff --git a/llvm/test/CodeGen/X86/stack-size-section.ll b/llvm/test/CodeGen/X86/stack-size-section.ll index 28b26ae..80fa2cc 100644 --- a/llvm/test/CodeGen/X86/stack-size-section.ll +++ b/llvm/test/CodeGen/X86/stack-size-section.ll @@ -1,8 +1,9 @@ ; RUN: llc < %s -mtriple=x86_64-linux -stack-size-section | FileCheck %s ; CHECK-LABEL: func1: +; CHECK-NEXT: .Lfunc_begin0: ; CHECK: .section .stack_sizes,"",@progbits -; CHECK-NEXT: .quad func1 +; CHECK-NEXT: .quad .Lfunc_begin0 ; CHECK-NEXT: .byte 8 define void @func1(i32, i32) #0 { alloca i32, align 4 @@ -11,8 +12,9 @@ define void @func1(i32, i32) #0 { } ; CHECK-LABEL: func2: +; CHECK-NEXT: .Lfunc_begin1: ; CHECK: .section .stack_sizes,"",@progbits -; CHECK-NEXT: .quad func2 +; CHECK-NEXT: .quad .Lfunc_begin1 ; CHECK-NEXT: .byte 24 define void @func2() #0 { alloca i32, align 4