Skip to content

Commit 05d0cae

Browse files
committed
[RISCV] Remove support for attribute interrupt("user").
This was part of the N extension which didn't make it version 1.12 of the privilege specification. Reviewed By: kito-cheng Differential Revision: https://reviews.llvm.org/D149314
1 parent 96f3033 commit 05d0cae

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,8 +1864,8 @@ def RISCVInterrupt : InheritableAttr, TargetSpecificAttr<TargetRISCV> {
18641864
let Spellings = [GCC<"interrupt">];
18651865
let Subjects = SubjectList<[Function]>;
18661866
let Args = [EnumArgument<"Interrupt", "InterruptType",
1867-
["user", "supervisor", "machine"],
1868-
["user", "supervisor", "machine"],
1867+
["supervisor", "machine"],
1868+
["supervisor", "machine"],
18691869
1>];
18701870
let ParseKind = "Interrupt";
18711871
let Documentation = [RISCVInterruptDocs];

clang/lib/CodeGen/TargetInfo.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11524,7 +11524,6 @@ class RISCVTargetCodeGenInfo : public TargetCodeGenInfo {
1152411524

1152511525
const char *Kind;
1152611526
switch (Attr->getInterrupt()) {
11527-
case RISCVInterruptAttr::user: Kind = "user"; break;
1152811527
case RISCVInterruptAttr::supervisor: Kind = "supervisor"; break;
1152911528
case RISCVInterruptAttr::machine: Kind = "machine"; break;
1153011529
}

clang/test/Sema/riscv-interrupt-attr.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,32 @@
44
// RUN: %clang_cc1 %s -triple riscv64-unknown-elf -verify -fsyntax-only
55

66
#if defined(CHECK_IR)
7-
// CHECK-LABEL: @foo_user() #0
8-
// CHECK: ret void
9-
__attribute__((interrupt("user"))) void foo_user(void) {}
10-
// CHECK-LABEL: @foo_supervisor() #1
7+
// CHECK-LABEL: @foo_supervisor() #0
118
// CHECK: ret void
129
__attribute__((interrupt("supervisor"))) void foo_supervisor(void) {}
13-
// CHECK-LABEL: @foo_machine() #2
10+
// CHECK-LABEL: @foo_machine() #1
1411
// CHECK: ret void
1512
__attribute__((interrupt("machine"))) void foo_machine(void) {}
16-
// CHECK-LABEL: @foo_default() #2
13+
// CHECK-LABEL: @foo_default() #1
1714
// CHECK: ret void
1815
__attribute__((interrupt())) void foo_default(void) {}
19-
// CHECK-LABEL: @foo_default2() #2
16+
// CHECK-LABEL: @foo_default2() #1
2017
// CHECK: ret void
2118
__attribute__((interrupt())) void foo_default2(void) {}
2219
// CHECK: attributes #0
23-
// CHECK: "interrupt"="user"
24-
// CHECK: attributes #1
2520
// CHECK: "interrupt"="supervisor"
26-
// CHECK: attributes #2
21+
// CHECK: attributes #1
2722
// CHECK: "interrupt"="machine"
2823
#else
2924
struct a { int b; };
3025

3126
struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions}}
3227

3328
__attribute__((interrupt("USER"))) void foo1(void) {} // expected-warning {{'interrupt' attribute argument not supported: USER}}
29+
__attribute__((interrupt("user"))) void foo1b(void) {} // expected-warning {{'interrupt' attribute argument not supported: user}}
30+
__attribute__((interrupt("MACHINE"))) void foo1c(void) {} // expected-warning {{'interrupt' attribute argument not supported: MACHINE}}
3431

35-
__attribute__((interrupt("user", 1))) void foo2(void) {} // expected-error {{'interrupt' attribute takes no more than 1 argument}}
32+
__attribute__((interrupt("machine", 1))) void foo2(void) {} // expected-error {{'interrupt' attribute takes no more than 1 argument}}
3633

3734
__attribute__((interrupt)) int foo3(void) {return 0;} // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have a 'void' return type}}
3835

@@ -41,19 +38,17 @@ __attribute__((interrupt())) void foo4(void) {}
4138

4239
__attribute__((interrupt())) void foo5(int a) {} // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have no parameters}}
4340

44-
__attribute__((interrupt("user"), interrupt("supervisor"))) void foo6(void) {} // expected-warning {{repeated RISC-V 'interrupt' attribute}} \
41+
__attribute__((interrupt("machine"), interrupt("supervisor"))) void foo6(void) {} // expected-warning {{repeated RISC-V 'interrupt' attribute}} \
4542
// expected-note {{repeated RISC-V 'interrupt' attribute is here}}
4643

4744
__attribute__((interrupt, interrupt)) void foo7(void) {} // expected-warning {{repeated RISC-V 'interrupt' attribute}} \
4845
// expected-note {{repeated RISC-V 'interrupt' attribute is here}}
4946

5047
__attribute__((interrupt(""))) void foo8(void) {} // expected-warning {{'interrupt' attribute argument not supported}}
5148

52-
__attribute__((interrupt("user"))) void foo9(void);
5349
__attribute__((interrupt("supervisor"))) void foo9(void);
5450
__attribute__((interrupt("machine"))) void foo9(void);
5551

56-
__attribute__((interrupt("user"))) void foo10(void) {}
5752
__attribute__((interrupt("supervisor"))) void foo11(void) {}
5853
__attribute__((interrupt("machine"))) void foo12(void) {}
5954
__attribute__((interrupt())) void foo13(void) {}

0 commit comments

Comments
 (0)