summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2020-01-04 15:39:19 -0800
committerFangrui Song <maskray@google.com>2020-01-10 09:57:34 -0800
commita44c434b68e515ce9f2627367c83ff6b22328261 (patch)
treed568652ab8ec6c31af18a56b7925f053b0c41ff8 /clang/test/CodeGen
parenta8fbdc576990653e92ce1d766659005678fd8514 (diff)
downloadbcm5719-llvm-a44c434b68e515ce9f2627367c83ff6b22328261.tar.gz
bcm5719-llvm-a44c434b68e515ce9f2627367c83ff6b22328261.zip
Support function attribute patchable_function_entry
This feature is generic. Make it applicable for AArch64 and X86 because the backend has only implemented NOP insertion for AArch64 and X86. Reviewed By: nickdesaulniers, aaron.ballman Differential Revision: https://reviews.llvm.org/D72221
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/patchable-function-entry.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGen/patchable-function-entry.c b/clang/test/CodeGen/patchable-function-entry.c
new file mode 100644
index 00000000000..678d90ff78f
--- /dev/null
+++ b/clang/test/CodeGen/patchable-function-entry.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple aarch64 -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define void @f0() #0
+__attribute__((patchable_function_entry(0))) void f0() {}
+
+// CHECK: define void @f00() #0
+__attribute__((patchable_function_entry(0, 0))) void f00() {}
+
+// CHECK: define void @f2() #1
+__attribute__((patchable_function_entry(2))) void f2() {}
+
+// CHECK: define void @f20() #1
+__attribute__((patchable_function_entry(2, 0))) void f20() {}
+
+// CHECK: define void @f20decl() #1
+__attribute__((patchable_function_entry(2, 0))) void f20decl();
+void f20decl() {}
+
+/// M in patchable_function_entry(N,M) is currently ignored.
+// CHECK: attributes #0 = { {{.*}} "patchable-function-entry"="0"
+// CHECK: attributes #1 = { {{.*}} "patchable-function-entry"="2"
OpenPOWER on IntegriCloud