Skip to content

Commit db6bf92

Browse files
authored
[DirectX] Rename DXILOperationCommon.h to DXILABI.h. NFC
This is a good place to put all of the ABI-sensitive DXIL values that we'll need in both reading and writing contexts. Pull Request: #78224
1 parent 3e47e75 commit db6bf92

File tree

4 files changed

+65
-65
lines changed

4 files changed

+65
-65
lines changed

llvm/include/llvm/Support/DXILABI.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//===-- DXILABI.h - ABI Sensitive Values for DXIL ---------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file contains definitions of various constants and enums that are
10+
// required to remain stable as per the DXIL format's requirements.
11+
//
12+
// Documentation for DXIL can be found in
13+
// https://github.com/Microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst.
14+
//
15+
//===----------------------------------------------------------------------===//
16+
17+
#ifndef LLVM_SUPPORT_DXILABI_H
18+
#define LLVM_SUPPORT_DXILABI_H
19+
20+
#include "llvm/ADT/StringSwitch.h"
21+
22+
namespace llvm {
23+
namespace dxil {
24+
25+
enum class ParameterKind : uint8_t {
26+
INVALID = 0,
27+
VOID,
28+
HALF,
29+
FLOAT,
30+
DOUBLE,
31+
I1,
32+
I8,
33+
I16,
34+
I32,
35+
I64,
36+
OVERLOAD,
37+
CBUFFER_RET,
38+
RESOURCE_RET,
39+
DXIL_HANDLE,
40+
};
41+
42+
} // namespace dxil
43+
} // namespace llvm
44+
45+
#endif // LLVM_SUPPORT_DXILABI_H

llvm/include/llvm/Support/DXILOperationCommon.h

Lines changed: 0 additions & 63 deletions
This file was deleted.

llvm/lib/Target/DirectX/DXILOpBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "DXILConstants.h"
1414
#include "llvm/IR/IRBuilder.h"
1515
#include "llvm/IR/Module.h"
16-
#include "llvm/Support/DXILOperationCommon.h"
16+
#include "llvm/Support/DXILABI.h"
1717
#include "llvm/Support/ErrorHandling.h"
1818

1919
using namespace llvm;

llvm/utils/TableGen/DXILEmitter.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "llvm/ADT/SmallVector.h"
1717
#include "llvm/ADT/StringSet.h"
1818
#include "llvm/ADT/StringSwitch.h"
19-
#include "llvm/Support/DXILOperationCommon.h"
19+
#include "llvm/Support/DXILABI.h"
2020
#include "llvm/TableGen/Record.h"
2121
#include "llvm/TableGen/TableGenBackend.h"
2222

@@ -103,6 +103,24 @@ struct DXILOperationData {
103103
};
104104
} // end anonymous namespace
105105

106+
static ParameterKind parameterTypeNameToKind(StringRef Name) {
107+
return StringSwitch<ParameterKind>(Name)
108+
.Case("void", ParameterKind::VOID)
109+
.Case("half", ParameterKind::HALF)
110+
.Case("float", ParameterKind::FLOAT)
111+
.Case("double", ParameterKind::DOUBLE)
112+
.Case("i1", ParameterKind::I1)
113+
.Case("i8", ParameterKind::I8)
114+
.Case("i16", ParameterKind::I16)
115+
.Case("i32", ParameterKind::I32)
116+
.Case("i64", ParameterKind::I64)
117+
.Case("$o", ParameterKind::OVERLOAD)
118+
.Case("dx.types.Handle", ParameterKind::DXIL_HANDLE)
119+
.Case("dx.types.CBufRet", ParameterKind::CBUFFER_RET)
120+
.Case("dx.types.ResRet", ParameterKind::RESOURCE_RET)
121+
.Default(ParameterKind::INVALID);
122+
}
123+
106124
DXILParam::DXILParam(const Record *R) {
107125
Name = R->getValueAsString("name");
108126
Pos = R->getValueAsInt("pos");

0 commit comments

Comments
 (0)