[clang] [Clang][RISCV] Add preprocessor macros for Zicfilp CFI scheme (PR #109600)

Kito Cheng via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 22 21:07:19 PDT 2024


================
@@ -1781,3 +1781,35 @@
 // RUN: %clang --target=riscv64-unknown-linux-gnu -mcpu=sifive-p450 -E -dM %s \
 // RUN:  -o - | FileCheck %s --check-prefix=CHECK-MISALIGNED-FAST
 // CHECK-MISALIGNED-FAST: __riscv_misaligned_fast 1
+
+// Landing Pad
+
+// RUN: %clang --target=riscv32 -menable-experimental-extensions \
+// RUN:   -march=rv32i_zicfilp1p0 -fcf-protection=branch \
+// RUN:   -fcf-branch-label-scheme=unlabeled -E -dM %s -o - \
+// RUN:   | FileCheck --check-prefix=CHECK-ZICFILP-UNLABELED %s
+// RUN: %clang --target=riscv64 -menable-experimental-extensions \
+// RUN:   -march=rv64i_zicfilp1p0 -fcf-protection=branch \
+// RUN:   -fcf-branch-label-scheme=unlabeled -E -dM %s -o - \
+// RUN:   | FileCheck --check-prefix=CHECK-ZICFILP-UNLABELED %s
+// CHECK-ZICFILP-UNLABELED-DAG: __riscv_landing_pad 1{{$}}
+// CHECK-ZICFILP-UNLABELED-DAG: __riscv_landing_pad_unlabeled 1{{$}}
----------------
kito-cheng wrote:

Add test case for 

1. `-march=rv32i -fcf-protection=branch -fcf-branch-label-scheme=*` and  `-march=rv64i -fcf-protection=branch -fcf-branch-label-scheme=*`
2. `-march=rv32i -fcf-branch-label-scheme=*` and  `-march=rv64i -fcf-branch-label-scheme=*`
3. `-march=rv32i_zicfilp -fcf-branch-label-scheme=*` and  `-march=rv64i_zicfilp -fcf-branch-label-scheme=*`



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


More information about the cfe-commits mailing list