Files
clang-p2996/llvm/test/CodeGen/XCore/naked-fn-with-frame-pointer.ll
Alex Rønne Petersen ad4a582fd9 [llvm] Consistently respect naked fn attribute in TargetFrameLowering::hasFP() (#106014)
Some targets (e.g. PPC and Hexagon) already did this. I think it's best
to do this consistently so that frontend authors don't run into
inconsistent results when they emit `naked` functions. For example, in
Zig, we had to change our emit code to also set `frame-pointer=none` to
get reliable results across targets.

Note: I don't have commit access.
2024-10-18 09:35:42 +04:00

32 lines
940 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -march xcore | FileCheck %s -check-prefixes=CHECK
declare dso_local void @main()
define dso_local void @naked() naked "frame-pointer"="all" {
; CHECK-LABEL: naked:
; CHECK: # %bb.0:
; CHECK-NEXT: bl main
; CHECK-NEXT: .cc_bottom naked.function
call void @main()
unreachable
}
define dso_local void @normal() "frame-pointer"="all" {
; CHECK-LABEL: normal:
; CHECK: # %bb.0:
; CHECK-NEXT: entsp 2
; CHECK-NEXT: .cfi_def_cfa_offset 8
; CHECK-NEXT: .cfi_offset 15, 0
; CHECK-NEXT: stw r10, sp[1] # 4-byte Folded Spill
; CHECK-NEXT: .cfi_offset 10, -4
; CHECK-NEXT: ldaw r10, sp[0]
; CHECK-NEXT: .cfi_def_cfa_register 10
; CHECK-NEXT: extsp 1
; CHECK-NEXT: bl main
; CHECK-NEXT: ldaw sp, sp[1]
; CHECK-NEXT: .cc_bottom normal.function
call void @main()
unreachable
}