Debian Codegraph @

clang/test/CodeGen/arm-cmse-attr.c

raw
1 // RUN: %clang_cc1 -triple thumbv8m.base-none-eabi -O1 -emit-llvm %s -o - 2>&1 | \
2 // RUN: FileCheck %s --check-prefix=CHECK-NOSE --check-prefix=CHECK
3 // RUN: %clang_cc1 -triple thumbebv8m.base-none-eabi -O1 -emit-llvm %s -o - 2>&1 | \
4 // RUN: FileCheck %s --check-prefix=CHECK-NOSE --check-prefix=CHECK
5 // RUN: %clang_cc1 -triple thumbv8m.base-none-eabi -mcmse -O1 -emit-llvm %s -o - 2>&1 | \
6 // RUN: FileCheck %s --check-prefix=CHECK-SE --check-prefix=CHECK
7 // RUN: %clang_cc1 -triple thumbebv8m.base-none-eabi -mcmse -O1 -emit-llvm %s -o - 2>&1 | \
8 // RUN: FileCheck %s --check-prefix=CHECK-SE --check-prefix=CHECK
9
10 typedef void (*callback_t)(void) __attribute__((cmse_nonsecure_call));
11 typedef void callback2_t(void) __attribute__((cmse_nonsecure_call));
12
13 void f1(callback_t fptr)
14 {
15 fptr();
16 }
17
18 void f2(callback2_t *fptr)
19 {
20 fptr();
21 }
22
23 void f3(void) __attribute__((cmse_nonsecure_entry));
24 void f3(void)
25 {
26 }
27
28 void f4(void) __attribute__((cmse_nonsecure_entry))
29 {
30 }
31
32 // CHECK: define{{.*}} void @f1(ptr noundef readonly captures(none) %fptr) {{[^#]*}}#0 {
33 // CHECK: call void %fptr() #2
34 // CHECK: define{{.*}} void @f2(ptr noundef readonly captures(none) %fptr) {{[^#]*}}#0 {
35 // CHECK: call void %fptr() #2
36 // CHECK: define{{.*}} void @f3() {{[^#]*}}#1 {
37 // CHECK: define{{.*}} void @f4() {{[^#]*}}#1 {
38
39 // CHECK-NOSE-NOT: cmse_nonsecure_entry
40 // CHECK-NOSE-NOT: cmse_nonsecure_call
41 // CHECK-SE: attributes #0 = { nounwind
42 // CHECK-SE: attributes #1 = { {{.*}} "cmse_nonsecure_entry"
43 // CHECK-SE: attributes #2 = { {{.*}} "cmse_nonsecure_call"