Skip to content

Commit a684174

Browse files
authored
Merge branch 'main' into lldb-dap-module-event
2 parents 47b5695 + ef87c34 commit a684174

File tree

181 files changed

+4301
-878
lines changed

Some content is hidden

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

181 files changed

+4301
-878
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/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">;

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ struct MissingFeatures {
160160
static bool lambdaFieldToName() { return false; }
161161
static bool targetSpecificCXXABI() { return false; }
162162
static bool moduleNameHash() { return false; }
163+
static bool setDSOLocal() { return false; }
163164

164165
// Missing types
165166
static bool dataMemberType() { return false; }

clang/include/clang/Lex/HLSLRootSignatureTokenKinds.def

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#endif
2828

2929
// Defines the various types of enum
30+
#ifndef UNBOUNDED_ENUM
31+
#define UNBOUNDED_ENUM(NAME, LIT) ENUM(NAME, LIT)
32+
#endif
3033
#ifndef DESCRIPTOR_RANGE_OFFSET_ENUM
3134
#define DESCRIPTOR_RANGE_OFFSET_ENUM(NAME, LIT) ENUM(NAME, LIT)
3235
#endif
@@ -87,6 +90,9 @@ KEYWORD(flags)
8790
KEYWORD(numDescriptors)
8891
KEYWORD(offset)
8992

93+
// Unbounded Enum:
94+
UNBOUNDED_ENUM(unbounded, "unbounded")
95+
9096
// Descriptor Range Offset Enum:
9197
DESCRIPTOR_RANGE_OFFSET_ENUM(DescriptorRangeOffsetAppend, "DESCRIPTOR_RANGE_OFFSET_APPEND")
9298

@@ -118,6 +124,7 @@ SHADER_VISIBILITY_ENUM(Mesh, "SHADER_VISIBILITY_MESH")
118124
#undef DESCRIPTOR_RANGE_FLAG_ENUM_ON
119125
#undef ROOT_DESCRIPTOR_FLAG_ENUM
120126
#undef DESCRIPTOR_RANGE_OFFSET_ENUM
127+
#undef UNBOUNDED_ENUM
121128
#undef ENUM
122129
#undef KEYWORD
123130
#undef PUNCTUATOR

0 commit comments

Comments
 (0)