[ARM] Emit local aliases (.Lfoo$local) for functions

ARMAsmPrinter::emitFunctionEntryLabel() was not calling the base class
function so the $local alias was not being emitted. This should not have
any function effect right now since ARM does not generate different code
for the $local symbols, but it could be improved in the future.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D131392
This commit is contained in:
Alex Richardson 2022-08-09 09:06:48 +00:00
parent 7925341d93
commit 9a2b14afa0
3 changed files with 3 additions and 4 deletions

View File

@ -82,8 +82,7 @@ void ARMAsmPrinter::emitFunctionEntryLabel() {
OutStreamer->emitSymbolAttribute(S, MCSA_ELF_TypeFunction); OutStreamer->emitSymbolAttribute(S, MCSA_ELF_TypeFunction);
OutStreamer->emitLabel(S); OutStreamer->emitLabel(S);
} }
AsmPrinter::emitFunctionEntryLabel();
OutStreamer->emitLabel(CurrentFnSym);
} }
void ARMAsmPrinter::emitXXStructor(const DataLayout &DL, const Constant *CV) { void ARMAsmPrinter::emitXXStructor(const DataLayout &DL, const Constant *CV) {

View File

@ -10,8 +10,7 @@ define dso_local ptr @dsolocal_func() nounwind {
; CHECK-NEXT: .type dsolocal_func,%function ; CHECK-NEXT: .type dsolocal_func,%function
; CHECK-NEXT: .code 32 ; CHECK-NEXT: .code 32
; CHECK-NEXT: dsolocal_func: ; CHECK-NEXT: dsolocal_func:
; TODO: PIC codegen should emit a $local alias here ; PIC-NEXT: .Ldsolocal_func$local:
; PIC-TODO-NEXT: .Ldsolocal_func$local:
; CHECK-NEXT: .fnstart ; CHECK-NEXT: .fnstart
; CHECK-NEXT: @ %bb.0: ; CHECK-NEXT: @ %bb.0:
; STATIC-NEXT: movw r0, :lower16:dsolocal_func ; STATIC-NEXT: movw r0, :lower16:dsolocal_func

View File

@ -24,6 +24,7 @@ ASM_FUNCTION_X86_RE = re.compile(
ASM_FUNCTION_ARM_RE = re.compile( ASM_FUNCTION_ARM_RE = re.compile(
r'^(?P<func>[0-9a-zA-Z_$]+):\n' # f: (name of function) r'^(?P<func>[0-9a-zA-Z_$]+):\n' # f: (name of function)
r'(?:\.L(?P=func)\$local:\n)?' # drop .L<func>$local:
r'\s+\.fnstart\n' # .fnstart r'\s+\.fnstart\n' # .fnstart
r'(?P<body>.*?)' # (body of the function) r'(?P<body>.*?)' # (body of the function)
r'^.Lfunc_end[0-9]+:', # .Lfunc_end0: or # -- End function r'^.Lfunc_end[0-9]+:', # .Lfunc_end0: or # -- End function