Skip to content

Commit ac04912

Browse files
committed
[HLSL] Add address space hlsl_constant(2) for constant buffer declarations
1 parent 1b1270f commit ac04912

21 files changed

+85
-132
lines changed

clang/include/clang/Basic/AddressSpaces.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ enum class LangAS : unsigned {
5858

5959
// HLSL specific address spaces.
6060
hlsl_groupshared,
61+
hlsl_constant,
6162

6263
// Wasm specific address spaces.
6364
wasm_funcref,

clang/lib/AST/TypePrinter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,6 +2556,8 @@ std::string Qualifiers::getAddrSpaceAsString(LangAS AS) {
25562556
return "__funcref";
25572557
case LangAS::hlsl_groupshared:
25582558
return "groupshared";
2559+
case LangAS::hlsl_constant:
2560+
return "hlsl_constant";
25592561
default:
25602562
return std::to_string(toTargetAddressSpace(AS));
25612563
}

clang/lib/Basic/Targets/AArch64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ static const unsigned ARM64AddrSpaceMap[] = {
4444
static_cast<unsigned>(AArch64AddrSpace::ptr32_uptr),
4545
static_cast<unsigned>(AArch64AddrSpace::ptr64),
4646
0, // hlsl_groupshared
47+
0, // hlsl_constant
4748
// Wasm address space values for this target are dummy values,
4849
// as it is only enabled for Wasm targets.
4950
20, // wasm_funcref

clang/lib/Basic/Targets/AMDGPU.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const LangASMap AMDGPUTargetInfo::AMDGPUDefIsPrivMap = {
8383
llvm::AMDGPUAS::FLAT_ADDRESS, // ptr32_uptr
8484
llvm::AMDGPUAS::FLAT_ADDRESS, // ptr64
8585
llvm::AMDGPUAS::FLAT_ADDRESS, // hlsl_groupshared
86+
llvm::AMDGPUAS::FLAT_ADDRESS, // hlsl_constant
8687

8788
};
8889
} // namespace targets

clang/lib/Basic/Targets/DirectX.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static const unsigned DirectXAddrSpaceMap[] = {
4242
0, // ptr32_uptr
4343
0, // ptr64
4444
3, // hlsl_groupshared
45+
2, // hlsl_constant
4546
// Wasm address space values for this target are dummy values,
4647
// as it is only enabled for Wasm targets.
4748
20, // wasm_funcref

clang/lib/Basic/Targets/NVPTX.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static const unsigned NVPTXAddrSpaceMap[] = {
4646
0, // ptr32_uptr
4747
0, // ptr64
4848
0, // hlsl_groupshared
49+
0, // hlsl_constant
4950
// Wasm address space values for this target are dummy values,
5051
// as it is only enabled for Wasm targets.
5152
20, // wasm_funcref

clang/lib/Basic/Targets/SPIR.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static const unsigned SPIRDefIsPrivMap[] = {
4747
0, // ptr32_uptr
4848
0, // ptr64
4949
0, // hlsl_groupshared
50+
2, // hlsl_constant
5051
// Wasm address space values for this target are dummy values,
5152
// as it is only enabled for Wasm targets.
5253
20, // wasm_funcref
@@ -80,6 +81,7 @@ static const unsigned SPIRDefIsGenMap[] = {
8081
0, // ptr32_uptr
8182
0, // ptr64
8283
0, // hlsl_groupshared
84+
0, // hlsl_constant
8385
// Wasm address space values for this target are dummy values,
8486
// as it is only enabled for Wasm targets.
8587
20, // wasm_funcref

clang/lib/Basic/Targets/SystemZ.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static const unsigned ZOSAddressMap[] = {
4242
1, // ptr32_uptr
4343
0, // ptr64
4444
0, // hlsl_groupshared
45+
0, // hlsl_constant
4546
0 // wasm_funcref
4647
};
4748

clang/lib/Basic/Targets/TCE.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static const unsigned TCEOpenCLAddrSpaceMap[] = {
5151
0, // ptr32_uptr
5252
0, // ptr64
5353
0, // hlsl_groupshared
54+
0, // hlsl_constant
5455
// Wasm address space values for this target are dummy values,
5556
// as it is only enabled for Wasm targets.
5657
20, // wasm_funcref

clang/lib/Basic/Targets/WebAssembly.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static const unsigned WebAssemblyAddrSpaceMap[] = {
4242
0, // ptr32_uptr
4343
0, // ptr64
4444
0, // hlsl_groupshared
45+
0, // hlsl_constant
4546
20, // wasm_funcref
4647
};
4748

0 commit comments

Comments
 (0)