[llvm] [llvm] Consistently respect `naked` fn attribute in `TargetFrameLowering::hasFP()` (PR #106014)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 11:31:53 PDT 2024


================
@@ -0,0 +1,11 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc < %s -mtriple aarch64 | FileCheck %s -check-prefixes=NAKED
+
+define dso_local void @_start() naked "frame-pointer"="all" {
+; NAKED-LABEL: _start:
+; NAKED:       // %bb.0:
+; NAKED-NEXT:    mov w8, #42 // =0x2a
+; NAKED-NEXT:    blr x8
+  call void inttoptr (i32 42 to ptr)()
----------------
arichardson wrote:

Is it legal to have non-inline-assembly statements in a naked function? 

For example clang gives me the following (https://godbolt.org/z/ozqMMWqqM)
```
__attribute__((naked)) void foo(uint64_t value) {
    constexpr int i = 1;
    __asm__("eor r0, r0, %0"::"i"(i));

}
```
`error: non-ASM statement in naked function is not supported`

GCC allows a lot more in naked functions, but maybe this test should just be an empty inline asm block?

https://github.com/llvm/llvm-project/pull/106014


More information about the llvm-commits mailing list