Skip to content

Commit 0f7ad9e

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-inner-region-invert-if-needed
2 parents 29bfcd0 + 419a2cb commit 0f7ad9e

File tree

443 files changed

+15448
-8060
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

443 files changed

+15448
-8060
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,12 @@ RISC-V Support
634634
^^^^^^^^^^^^^^
635635

636636
- Add support for `-mtune=generic-ooo` (a generic out-of-order model).
637+
- Adds support for `__attribute__((interrupt("SiFive-CLIC-preemptible")))` and
638+
`__attribute__((interrupt("SiFive-CLIC-stack-swap")))`. The former
639+
automatically saves some interrupt CSRs before re-enabling interrupts in the
640+
function prolog, the latter swaps `sp` with the value in a CSR before it is
641+
used or modified. These two can also be combined, and can be combined with
642+
`interrupt("machine")`.
637643

638644
- Adds support for `__attribute__((interrupt("qci-nest")))` and
639645
`__attribute__((interrupt("qci-nonest")))`. These use instructions from

clang/include/clang/AST/OpenACCClause.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ class OpenACCWaitClause final
565565
llvm::ArrayRef<Expr *> getQueueIdExprs() const {
566566
return OpenACCClauseWithExprs::getExprs().drop_front();
567567
}
568+
// If this is a plain `wait` (no parens) this returns 'false'. Else Sema/Parse
569+
// ensures we have at least one QueueId expression.
570+
bool hasExprs() const { return getLParenLoc().isValid(); }
568571
};
569572

570573
class OpenACCNumGangsClause final

clang/include/clang/Basic/Attr.td

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,10 +2252,23 @@ def NoMicroMips : InheritableAttr, TargetSpecificAttr<TargetMips32> {
22522252
def RISCVInterrupt : InheritableAttr, TargetSpecificAttr<TargetRISCV> {
22532253
let Spellings = [GCC<"interrupt">];
22542254
let Subjects = SubjectList<[Function]>;
2255-
let Args = [EnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
2256-
["supervisor", "machine", "qci-nest", "qci-nonest"],
2257-
["supervisor", "machine", "qcinest", "qcinonest"],
2258-
1>];
2255+
let Args = [VariadicEnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
2256+
[
2257+
"supervisor",
2258+
"machine",
2259+
"qci-nest",
2260+
"qci-nonest",
2261+
"SiFive-CLIC-preemptible",
2262+
"SiFive-CLIC-stack-swap",
2263+
],
2264+
[
2265+
"supervisor",
2266+
"machine",
2267+
"qcinest",
2268+
"qcinonest",
2269+
"SiFiveCLICPreemptible",
2270+
"SiFiveCLICStackSwap",
2271+
]>];
22592272
let ParseKind = "Interrupt";
22602273
let Documentation = [RISCVInterruptDocs];
22612274
}

clang/include/clang/Basic/AttrDocs.td

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,8 +2900,9 @@ targets. This attribute may be attached to a function definition and instructs
29002900
the backend to generate appropriate function entry/exit code so that it can be
29012901
used directly as an interrupt service routine.
29022902

2903-
Permissible values for this parameter are ``supervisor``, ``machine``,
2904-
``qci-nest`` and ``qci-nonest``. If there is no parameter, then it defaults to
2903+
Permissible values for this parameter are ``machine``, ``supervisor``,
2904+
``qci-nest``, ``qci-nonest``, ``SiFive-CLIC-preemptible``, and
2905+
``SiFive-CLIC-stack-swap``. If there is no parameter, then it defaults to
29052906
``machine``.
29062907

29072908
The ``qci-nest`` and ``qci-nonest`` values require Qualcomm's Xqciint extension
@@ -2912,6 +2913,15 @@ restore interrupt state to the stack -- the ``qci-nest`` value will use
29122913
begin the interrupt handler. Both of these will use ``qc.c.mileaveret`` to
29132914
restore the state and return to the previous context.
29142915

2916+
The ``SiFive-CLIC-preemptible`` and ``SiFive-CLIC-stack-swap`` values are used
2917+
for machine-mode interrupts. For ``SiFive-CLIC-preemptible`` interrupts, the
2918+
values of ``mcause`` and ``mepc`` are saved onto the stack, and interrupts are
2919+
re-enabled. For ``SiFive-CLIC-stack-swap`` interrupts, the stack pointer is
2920+
swapped with ``mscratch`` before its first use and after its last use.
2921+
2922+
The SiFive CLIC values may be combined with each other and with the ``machine``
2923+
attribute value. Any other combination of different values is not allowed.
2924+
29152925
Repeated interrupt attribute on the same declaration will cause a warning
29162926
to be emitted. In case of repeated declarations, the last one prevails.
29172927

@@ -2921,6 +2931,7 @@ https://riscv.org/specifications/privileged-isa/
29212931
The RISC-V Instruction Set Manual Volume II: Privileged Architecture
29222932
Version 1.10.
29232933
https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.7
2934+
https://sifive.cdn.prismic.io/sifive/d1984d2b-c9b9-4c91-8de0-d68a5e64fa0f_sifive-interrupt-cookbook-v1p2.pdf
29242935
}];
29252936
}
29262937

clang/include/clang/Basic/BuiltinHeaders.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
HEADER(NO_HEADER, nullptr)
15-
HEADER(ARMACLE_H, "arm_acle.h")
1615
HEADER(BLOCKS_H, "Blocks.h")
1716
HEADER(COMPLEX_H, "complex.h")
1817
HEADER(CTYPE_H, "ctype.h")

clang/include/clang/Basic/BuiltinsAArch64.def

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ BUILTIN(__builtin_arm_wfi, "v", "")
5050
BUILTIN(__builtin_arm_sev, "v", "")
5151
BUILTIN(__builtin_arm_sevl, "v", "")
5252
BUILTIN(__builtin_arm_chkfeat, "WUiWUi", "")
53-
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
54-
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
55-
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
56-
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
57-
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
5853

5954
// Like __builtin_trap but provide an 16-bit immediate reason code (which goes into `brk #N`).
6055
BUILTIN(__builtin_arm_trap, "vUIs", "nr")
@@ -87,9 +82,6 @@ TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops")
8782
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
8883
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
8984
BUILTIN(__builtin_arm_isb, "vUi", "nc")
90-
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
91-
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
92-
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
9385

9486
TARGET_BUILTIN(__builtin_arm_jcvt, "Zid", "nc", "v8.3a")
9587

@@ -106,6 +98,16 @@ BUILTIN(__builtin_arm_wsr64, "vcC*WUi", "nc")
10698
TARGET_BUILTIN(__builtin_arm_wsr128, "vcC*LLLUi", "nc", "d128")
10799
BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc")
108100

101+
// MSVC
102+
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
103+
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
104+
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
105+
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
106+
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
107+
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
108+
LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES)
109+
LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
110+
109111
// Misc
110112
BUILTIN(__builtin_sponentry, "v*", "c")
111113

clang/include/clang/Basic/BuiltinsARM.def

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,11 @@ BUILTIN(__builtin_arm_wfi, "v", "")
186186
BUILTIN(__builtin_arm_sev, "v", "")
187187
BUILTIN(__builtin_arm_sevl, "v", "")
188188
BUILTIN(__builtin_arm_dbg, "vUi", "")
189-
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
190-
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
191-
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
192-
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
193-
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
194189

195190
// Data barrier
196191
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
197192
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
198193
BUILTIN(__builtin_arm_isb, "vUi", "nc")
199-
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
200-
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
201-
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
202194

203195
// Prefetch
204196
BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc")
@@ -217,6 +209,15 @@ BUILTIN(__builtin_sponentry, "v*", "c")
217209
// MSVC
218210
LANGBUILTIN(__emit, "vIUiC", "", ALL_MS_LANGUAGES)
219211

212+
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
213+
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
214+
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
215+
LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES)
216+
LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
217+
218+
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
219+
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
220+
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
220221
LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES)
221222
LANGBUILTIN(_MoveFromCoprocessor, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
222223
LANGBUILTIN(_MoveFromCoprocessor2, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)

clang/include/clang/Basic/Cuda.h

Lines changed: 2 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef LLVM_CLANG_BASIC_CUDA_H
1010
#define LLVM_CLANG_BASIC_CUDA_H
1111

12+
#include "clang/Basic/OffloadArch.h"
13+
1214
namespace llvm {
1315
class StringRef;
1416
class Twine;
@@ -54,98 +56,6 @@ const char *CudaVersionToString(CudaVersion V);
5456
// Input is "Major.Minor"
5557
CudaVersion CudaStringToVersion(const llvm::Twine &S);
5658

57-
enum class OffloadArch {
58-
UNUSED,
59-
UNKNOWN,
60-
// TODO: Deprecate and remove GPU architectures older than sm_52.
61-
SM_20,
62-
SM_21,
63-
SM_30,
64-
// This has a name conflict with sys/mac.h on AIX, rename it as a workaround.
65-
SM_32_,
66-
SM_35,
67-
SM_37,
68-
SM_50,
69-
SM_52,
70-
SM_53,
71-
SM_60,
72-
SM_61,
73-
SM_62,
74-
SM_70,
75-
SM_72,
76-
SM_75,
77-
SM_80,
78-
SM_86,
79-
SM_87,
80-
SM_89,
81-
SM_90,
82-
SM_90a,
83-
SM_100,
84-
SM_100a,
85-
SM_101,
86-
SM_101a,
87-
SM_120,
88-
SM_120a,
89-
GFX600,
90-
GFX601,
91-
GFX602,
92-
GFX700,
93-
GFX701,
94-
GFX702,
95-
GFX703,
96-
GFX704,
97-
GFX705,
98-
GFX801,
99-
GFX802,
100-
GFX803,
101-
GFX805,
102-
GFX810,
103-
GFX9_GENERIC,
104-
GFX900,
105-
GFX902,
106-
GFX904,
107-
GFX906,
108-
GFX908,
109-
GFX909,
110-
GFX90a,
111-
GFX90c,
112-
GFX9_4_GENERIC,
113-
GFX942,
114-
GFX950,
115-
GFX10_1_GENERIC,
116-
GFX1010,
117-
GFX1011,
118-
GFX1012,
119-
GFX1013,
120-
GFX10_3_GENERIC,
121-
GFX1030,
122-
GFX1031,
123-
GFX1032,
124-
GFX1033,
125-
GFX1034,
126-
GFX1035,
127-
GFX1036,
128-
GFX11_GENERIC,
129-
GFX1100,
130-
GFX1101,
131-
GFX1102,
132-
GFX1103,
133-
GFX1150,
134-
GFX1151,
135-
GFX1152,
136-
GFX1153,
137-
GFX12_GENERIC,
138-
GFX1200,
139-
GFX1201,
140-
AMDGCNSPIRV,
141-
Generic, // A processor model named 'generic' if the target backend defines a
142-
// public one.
143-
LAST,
144-
145-
CudaDefault = OffloadArch::SM_52,
146-
HIPDefault = OffloadArch::GFX906,
147-
};
148-
14959
enum class CUDAFunctionTarget {
15060
Device,
15161
Global,
@@ -154,21 +64,6 @@ enum class CUDAFunctionTarget {
15464
InvalidTarget
15565
};
15666

157-
static inline bool IsNVIDIAOffloadArch(OffloadArch A) {
158-
return A >= OffloadArch::SM_20 && A < OffloadArch::GFX600;
159-
}
160-
161-
static inline bool IsAMDOffloadArch(OffloadArch A) {
162-
// Generic processor model is for testing only.
163-
return A >= OffloadArch::GFX600 && A < OffloadArch::Generic;
164-
}
165-
166-
const char *OffloadArchToString(OffloadArch A);
167-
const char *OffloadArchToVirtualArchString(OffloadArch A);
168-
169-
// The input should have the form "sm_20".
170-
OffloadArch StringToOffloadArch(llvm::StringRef S);
171-
17267
/// Get the earliest CudaVersion that supports the given OffloadArch.
17368
CudaVersion MinVersionForOffloadArch(OffloadArch A);
17469

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12763,7 +12763,9 @@ def err_riscv_builtin_invalid_lmul : Error<
1276312763
def err_riscv_type_requires_extension : Error<
1276412764
"RISC-V type %0 requires the '%1' extension">;
1276512765
def err_riscv_attribute_interrupt_requires_extension : Error<
12766-
"RISC-V interrupt attribute '%0' requires extension '%1'">;
12766+
"RISC-V 'interrupt' attribute '%0' requires extension '%1'">;
12767+
def err_riscv_attribute_interrupt_invalid_combination : Error<
12768+
"RISC-V 'interrupt' attribute contains invalid combination of interrupt types">;
1276712769

1276812770
def err_std_source_location_impl_not_found : Error<
1276912771
"'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called">;

0 commit comments

Comments
 (0)