Skip to content

Commit 773e74b

Browse files
authored
merge main into amd-staging (llvm#2493)
2 parents f48edb5 + 33d8edb commit 773e74b

File tree

246 files changed

+8296
-6485
lines changed

Some content is hidden

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

246 files changed

+8296
-6485
lines changed

clang/include/clang/Basic/AddressSpaces.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ enum class LangAS : unsigned {
6161
hlsl_constant,
6262
hlsl_private,
6363
hlsl_device,
64+
hlsl_input,
6465

6566
// Wasm specific address spaces.
6667
wasm_funcref,

clang/include/clang/Basic/Attr.td

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ def SharedVar : SubsetSubject<Var,
140140
[{S->hasGlobalStorage() && !S->getTLSKind()}],
141141
"global variables">;
142142

143+
def HLSLInputBuiltin
144+
: SubsetSubject<Var, [{S->hasGlobalStorage() &&
145+
S->getStorageClass() == StorageClass::SC_Static &&
146+
S->getType().isConstQualified()}],
147+
"static const globals">;
148+
143149
def GlobalVar : SubsetSubject<Var,
144150
[{S->hasGlobalStorage()}], "global variables">;
145151

@@ -4951,6 +4957,14 @@ def HLSLWaveSize: InheritableAttr {
49514957
let Documentation = [WaveSizeDocs];
49524958
}
49534959

4960+
def HLSLVkExtBuiltinInput : InheritableAttr {
4961+
let Spellings = [CXX11<"vk", "ext_builtin_input">];
4962+
let Args = [UnsignedArgument<"BuiltIn">];
4963+
let Subjects = SubjectList<[HLSLInputBuiltin], ErrorDiag>;
4964+
let LangOpts = [HLSL];
4965+
let Documentation = [HLSLVkExtBuiltinInputDocs];
4966+
}
4967+
49544968
def RandomizeLayout : InheritableAttr {
49554969
let Spellings = [GCC<"randomize_layout">];
49564970
let Subjects = SubjectList<[Record]>;

clang/include/clang/Basic/AttrDocs.td

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8508,6 +8508,29 @@ and copied back to the argument after the callee returns.
85088508
}];
85098509
}
85108510

8511+
def HLSLVkExtBuiltinInputDocs : Documentation {
8512+
let Category = DocCatVariable;
8513+
let Content = [{
8514+
Vulkan shaders have `Input` builtins. Those variables are externally
8515+
initialized by the driver/pipeline, but each copy is private to the current
8516+
lane.
8517+
8518+
Those builtins can be declared using the `[[vk::ext_builtin_input]]` attribute
8519+
like follows:
8520+
8521+
.. code-block:: c++
8522+
8523+
[[vk::ext_builtin_input(/* WorkgroupId */ 26)]]
8524+
static const uint3 groupid;
8525+
8526+
This variable will be lowered into a module-level variable, with the `Input`
8527+
storage class, and the `BuiltIn 26` decoration.
8528+
8529+
The full documentation for this inline SPIR-V attribute can be found here:
8530+
https://github.com/microsoft/hlsl-specs/blob/main/proposals/0011-inline-spirv.md
8531+
}];
8532+
}
8533+
85118534
def AnnotateTypeDocs : Documentation {
85128535
let Category = DocCatType;
85138536
let Heading = "annotate_type";

clang/include/clang/Basic/AttributeCommonInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class AttributeCommonInfo {
6969
IgnoredAttribute,
7070
UnknownAttribute,
7171
};
72-
enum class Scope { NONE, CLANG, GNU, MSVC, OMP, HLSL, GSL, RISCV };
72+
enum class Scope { NONE, CLANG, GNU, MSVC, OMP, HLSL, VK, GSL, RISCV };
7373
enum class AttrArgsInfo {
7474
None,
7575
Optional,

clang/include/clang/Basic/BuiltinHeaders.def

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

1414
HEADER(NO_HEADER, nullptr)
15+
HEADER(ARMACLE_H, "arm_acle.h")
1516
HEADER(BLOCKS_H, "Blocks.h")
1617
HEADER(COMPLEX_H, "complex.h")
1718
HEADER(CTYPE_H, "ctype.h")

clang/include/clang/Basic/BuiltinsAArch64.def

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ 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, "")
5358

5459
// Like __builtin_trap but provide an 16-bit immediate reason code (which goes into `brk #N`).
5560
BUILTIN(__builtin_arm_trap, "vUIs", "nr")
@@ -82,6 +87,9 @@ TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops")
8287
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
8388
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
8489
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, "")
8593

8694
TARGET_BUILTIN(__builtin_arm_jcvt, "Zid", "nc", "v8.3a")
8795

@@ -98,16 +106,6 @@ BUILTIN(__builtin_arm_wsr64, "vcC*WUi", "nc")
98106
TARGET_BUILTIN(__builtin_arm_wsr128, "vcC*LLLUi", "nc", "d128")
99107
BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc")
100108

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-
111109
// Misc
112110
BUILTIN(__builtin_sponentry, "v*", "c")
113111

clang/include/clang/Basic/BuiltinsARM.def

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,19 @@ 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, "")
189194

190195
// Data barrier
191196
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
192197
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
193198
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, "")
194202

195203
// Prefetch
196204
BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc")
@@ -209,15 +217,6 @@ BUILTIN(__builtin_sponentry, "v*", "c")
209217
// MSVC
210218
LANGBUILTIN(__emit, "vIUiC", "", ALL_MS_LANGUAGES)
211219

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)
221220
LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES)
222221
LANGBUILTIN(_MoveFromCoprocessor, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
223222
LANGBUILTIN(_MoveFromCoprocessor2, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)

clang/include/clang/Sema/SemaHLSL.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ class SemaHLSL : public SemaBase {
131131
void handleParamModifierAttr(Decl *D, const ParsedAttr &AL);
132132
bool handleResourceTypeAttr(QualType T, const ParsedAttr &AL);
133133

134+
void handleVkExtBuiltinInputAttr(Decl *D, const ParsedAttr &AL);
135+
134136
bool CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
135137
QualType ProcessResourceTypeAttributes(QualType Wrapped);
136138
HLSLAttributedResourceLocInfo

clang/lib/AST/Type.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ bool Qualifiers::isTargetAddressSpaceSupersetOf(LangAS A, LangAS B,
100100
// address spaces to default to work around this problem.
101101
(A == LangAS::Default && B == LangAS::hlsl_private) ||
102102
(A == LangAS::Default && B == LangAS::hlsl_device) ||
103+
(A == LangAS::Default && B == LangAS::hlsl_input) ||
103104
// Conversions from target specific address spaces may be legal
104105
// depending on the target information.
105106
Ctx.getTargetInfo().isAddressSpaceSupersetOf(A, B);

clang/lib/AST/TypePrinter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,6 +2667,8 @@ std::string Qualifiers::getAddrSpaceAsString(LangAS AS) {
26672667
return "hlsl_private";
26682668
case LangAS::hlsl_device:
26692669
return "hlsl_device";
2670+
case LangAS::hlsl_input:
2671+
return "hlsl_input";
26702672
case LangAS::wasm_funcref:
26712673
return "__funcref";
26722674
default:

0 commit comments

Comments
 (0)