mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-18 10:31:57 +00:00
3f0ce4fa18
On MachO, and MachO only, we cannot have a truly empty function since that breaks the linker logic for atomizing the section. When we are emitting a frame pointer, the presence of an unreachable will create a cfi instruction pointing past the last instruction. This is perfectly fine. The FDE information encodes the pc range it applies to. If some tool cannot handle this, we should explicitly say which bug we are working around and only work around it when it is actually relevant (not for ELF for example). Given the unreachable we could omit the .cfi_def_cfa_register, but then again, we could also omit the entire function prologue if we wanted to. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217801 91177308-0d34-0410-b5e6-96231b3b80d8
55 lines
1.8 KiB
LLVM
55 lines
1.8 KiB
LLVM
; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck -check-prefix=CHECK-NO-FP %s
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -disable-fp-elim | FileCheck -check-prefix=CHECK-FP %s
|
|
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck -check-prefix=LINUX-NO-FP %s
|
|
; RUN: llc < %s -mtriple=x86_64-linux-gnu -disable-fp-elim | FileCheck -check-prefix=LINUX-FP %s
|
|
|
|
define void @func() {
|
|
entry:
|
|
unreachable
|
|
}
|
|
|
|
; MachO cannot handle an empty function.
|
|
; CHECK-NO-FP: _func:
|
|
; CHECK-NO-FP-NEXT: .cfi_startproc
|
|
; CHECK-NO-FP: nop
|
|
; CHECK-NO-FP-NEXT: .cfi_endproc
|
|
|
|
; CHECK-FP: _func:
|
|
; CHECK-FP-NEXT: .cfi_startproc
|
|
; CHECK-FP-NEXT: :
|
|
; CHECK-FP-NEXT: pushq %rbp
|
|
; CHECK-FP-NEXT: :
|
|
; CHECK-FP-NEXT: .cfi_def_cfa_offset 16
|
|
; CHECK-FP-NEXT: :
|
|
; CHECK-FP-NEXT: .cfi_offset %rbp, -16
|
|
; CHECK-FP-NEXT: movq %rsp, %rbp
|
|
; CHECK-FP-NEXT: :
|
|
; CHECK-FP-NEXT: .cfi_def_cfa_register %rbp
|
|
; CHECK-FP-NEXT: .cfi_endproc
|
|
|
|
; An empty function is perfectly fine on ELF.
|
|
; LINUX-NO-FP: func:
|
|
; 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: .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: .cfi_startproc
|
|
; LINUX-FP-NEXT: {{^}}#
|
|
; LINUX-FP-NEXT: pushq %rbp
|
|
; LINUX-FP-NEXT: {{^}}.L{{.*}}:{{$}}
|
|
; LINUX-FP-NEXT: .cfi_def_cfa_offset 16
|
|
; LINUX-FP-NEXT: {{^}}.L{{.*}}:{{$}}
|
|
; LINUX-FP-NEXT: .cfi_offset %rbp, -16
|
|
; LINUX-FP-NEXT: movq %rsp, %rbp
|
|
; 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: .cfi_endproc
|