mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 00:06:05 +00:00

Summary: Clang supports the GNU style ``__attribute__((interrupt))`` attribute on RISCV targets. Permissible values for this parameter are user, supervisor, and machine. If there is no parameter, then it defaults to machine. Reference: https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Function-Attributes.html Based on initial patch by Zhaoshi Zheng. Reviewers: asb, aaron.ballman Reviewed By: asb, aaron.ballman Subscribers: rkruppe, the_o, aaron.ballman, MartinMosbeck, brucehoult, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, cfe-commits Differential Revision: https://reviews.llvm.org/D48412 llvm-svn: 338045
17 lines
800 B
C++
17 lines
800 B
C++
// RUN: %clang_cc1 -x c++ -triple riscv32-unknown-elf -emit-llvm -DCHECK_IR < %s | FileCheck %s
|
|
// RUN: %clang_cc1 -x c++ -triple riscv64-unknown-elf -emit-llvm -DCHECK_IR < %s | FileCheck %s
|
|
// RUN: %clang_cc1 %s -triple riscv32-unknown-elf -verify -fsyntax-only
|
|
// RUN: %clang_cc1 %s -triple riscv64-unknown-elf -verify -fsyntax-only
|
|
|
|
#if defined(CHECK_IR)
|
|
// CHECK-LABEL: @_Z11foo_defaultv() #0
|
|
// CHECK: ret void
|
|
[[gnu::interrupt]] void foo_default() {}
|
|
// CHECK: attributes #0
|
|
// CHECK: "interrupt"="machine"
|
|
#else
|
|
[[gnu::interrupt]] [[gnu::interrupt]] void foo1() {} // expected-warning {{repeated RISC-V 'interrupt' attribute}} \
|
|
// expected-note {{repeated RISC-V 'interrupt' attribute is here}}
|
|
[[gnu::interrupt]] void foo2() {}
|
|
#endif
|