Skip to content

Commit 0b838b8

Browse files
committed
Name cleanup
1 parent 192f342 commit 0b838b8

File tree

2 files changed

+45
-46
lines changed

2 files changed

+45
-46
lines changed

llvm/lib/Target/DirectX/DXIL.td

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313

1414
include "llvm/IR/Intrinsics.td"
1515

16-
// Abstract class to demarcate minimum Shader model version required
17-
// to support DXIL Op
18-
class DXILShaderModel<int major, int minor> {
16+
// Abstract class to represent major and minor version values
17+
class Version<int major, int minor> {
1918
int Major = major;
2019
int Minor = minor;
2120
}
@@ -24,13 +23,13 @@ class DXILShaderModel<int major, int minor> {
2423

2524
// Shader Model 6.0 - 6.8
2625
foreach i = 0...8 in {
27-
def SM6_#i : DXILShaderModel<6, i>;
26+
def SM6_#i : Version<6, i>;
2827
}
2928

3029
// Abstraction of class mapping valid DXIL Op overloads the minimum
3130
// version of Shader Model they are supported
32-
class DXILOpOverload<DXILShaderModel minsm, list<LLVMType> overloads> {
33-
DXILShaderModel ShaderModel = minsm;
31+
class DXILOpOverload<Version minsm, list<LLVMType> overloads> {
32+
Version ShaderModel = minsm;
3433
list<LLVMType> OpOverloads = overloads;
3534
}
3635

@@ -77,8 +76,8 @@ defset list<DXILOpClass> OpClasses = {
7776
def UnknownOpClass: DXILOpClass<[]>;
7877
}
7978

80-
// Abstraction DXIL Operation to LLVM intrinsic
81-
class DXILOpMappingBase {
79+
// Abstraction DXIL Operation
80+
class DXILOpPropertiesBase {
8281
int OpCode = 0; // Opcode of DXIL Operation
8382
DXILOpClass OpClass = UnknownOpClass;// Class of DXIL Operation.
8483
Intrinsic LLVMIntrinsic = ?; // LLVM Intrinsic DXIL Operation maps to
@@ -87,118 +86,118 @@ class DXILOpMappingBase {
8786
string Doc = ""; // A short description of the operation
8887
}
8988

90-
class DXILOpMapping<int opCode,
89+
class DXILOpProperties<int opCode,
9190
Intrinsic intrinsic,
9291
list<DXILOpOverload> overloadTypes,
93-
string doc> : DXILOpMappingBase {
92+
string doc> : DXILOpPropertiesBase {
9493
int OpCode = opCode;
9594
Intrinsic LLVMIntrinsic = intrinsic;
9695
list<DXILOpOverload> OpOverloadTypes = overloadTypes;
9796
string Doc = doc;
9897
}
9998

100-
// Concrete definitions of DXIL Operation mapping to corresponding LLVM intrinsic
99+
// Concrete definitions of DXIL Operation Properties to corresponding LLVM intrinsic
101100

102101
// IsSpecialFloat Class
103102
let OpClass = isSpecialFloat in {
104-
def IsInf : DXILOpMapping<9, int_dx_isinf, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
103+
def IsInf : DXILOpProperties<9, int_dx_isinf, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
105104
"Determines if the specified value is infinite.">;
106105
}
107106

108107
let OpClass = unary in {
109-
def Abs : DXILOpMapping<6, int_fabs, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty, llvm_double_ty]>],
108+
def Abs : DXILOpProperties<6, int_fabs, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty, llvm_double_ty]>],
110109
"Returns the absolute value of the input.">;
111110

112-
def Cos : DXILOpMapping<12, int_cos, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
111+
def Cos : DXILOpProperties<12, int_cos, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
113112
"Returns cosine(theta) for theta in radians.">;
114-
def Sin : DXILOpMapping<13, int_sin, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
113+
def Sin : DXILOpProperties<13, int_sin, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
115114
"Returns sine(theta) for theta in radians.">;
116-
def Tan : DXILOpMapping<14, int_tan, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
115+
def Tan : DXILOpProperties<14, int_tan, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
117116
"Returns tangent(theta) for theta in radians.">;
118-
def Exp2 : DXILOpMapping<21, int_exp2, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
117+
def Exp2 : DXILOpProperties<21, int_exp2, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
119118
"Returns the base 2 exponential, or 2**x, of the"
120119
" specified value. exp2(x) = 2**x.">;
121-
def Frac : DXILOpMapping<22, int_dx_frac, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
120+
def Frac : DXILOpProperties<22, int_dx_frac, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
122121
"Returns a fraction from 0 to 1 that represents the"
123122
" decimal part of the input.">;
124-
def Log2 : DXILOpMapping<23, int_log2, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
123+
def Log2 : DXILOpProperties<23, int_log2, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
125124
"Returns the base-2 logarithm of the specified value.">;
126-
def Sqrt : DXILOpMapping<24, int_sqrt, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
125+
def Sqrt : DXILOpProperties<24, int_sqrt, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
127126
"Returns the square root of the specified floating-point"
128127
"value, per component.">;
129-
def RSqrt : DXILOpMapping<25, int_dx_rsqrt, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
128+
def RSqrt : DXILOpProperties<25, int_dx_rsqrt, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
130129
"Returns the reciprocal of the square root of the"
131130
" specified value. rsqrt(x) = 1 / sqrt(x).">;
132-
def Round : DXILOpMapping<26, int_roundeven, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
131+
def Round : DXILOpProperties<26, int_roundeven, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
133132
"Returns the input rounded to the nearest integer"
134133
"within a floating-point type.">;
135-
def Floor : DXILOpMapping<27, int_floor, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
134+
def Floor : DXILOpProperties<27, int_floor, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
136135
"Returns the largest integer that is less than or equal to the input.">;
137-
def Ceil : DXILOpMapping<28, int_ceil, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
136+
def Ceil : DXILOpProperties<28, int_ceil, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
138137
"Returns the smallest integer that is greater than or equal to the input.">;
139-
def Trunc : DXILOpMapping<29, int_trunc, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
138+
def Trunc : DXILOpProperties<29, int_trunc, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
140139
"Returns the specified value truncated to the integer component.">;
141-
def Rbits : DXILOpMapping<30, int_bitreverse, [DXILOpOverload<SM6_0, [llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
140+
def Rbits : DXILOpProperties<30, int_bitreverse, [DXILOpOverload<SM6_0, [llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
142141
"Returns the specified value with its bits reversed.">;
143142
}
144143

145144
let OpClass = binary in {
146145
// Float overloads
147-
def FMax : DXILOpMapping<35, int_maxnum, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty, llvm_double_ty]>],
146+
def FMax : DXILOpProperties<35, int_maxnum, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty, llvm_double_ty]>],
148147
"Float maximum. FMax(a,b) = a > b ? a : b">;
149-
def FMin : DXILOpMapping<36, int_minnum, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty, llvm_double_ty]>],
148+
def FMin : DXILOpProperties<36, int_minnum, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty, llvm_double_ty]>],
150149
"Float minimum. FMin(a,b) = a < b ? a : b">;
151150
// Int overloads
152-
def SMax : DXILOpMapping<37, int_smax, [DXILOpOverload<SM6_0,[llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
151+
def SMax : DXILOpProperties<37, int_smax, [DXILOpOverload<SM6_0,[llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
153152
"Signed integer maximum. SMax(a,b) = a > b ? a : b">;
154-
def SMin : DXILOpMapping<38, int_smin, [DXILOpOverload<SM6_0,[llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
153+
def SMin : DXILOpProperties<38, int_smin, [DXILOpOverload<SM6_0,[llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
155154
"Signed integer minimum. SMin(a,b) = a < b ? a : b">;
156-
def UMax : DXILOpMapping<39, int_umax, [DXILOpOverload<SM6_0,[llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
155+
def UMax : DXILOpProperties<39, int_umax, [DXILOpOverload<SM6_0,[llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
157156
"Unsigned integer maximum. UMax(a,b) = a > b ? a : b">;
158-
def UMin : DXILOpMapping<40, int_umin, [DXILOpOverload<SM6_0,[llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
157+
def UMin : DXILOpProperties<40, int_umin, [DXILOpOverload<SM6_0,[llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
159158
"Unsigned integer minimum. UMin(a,b) = a < b ? a : b">;
160159
}
161160

162161
let OpClass = tertiary in {
163-
def FMad : DXILOpMapping<46, int_fmuladd, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty, llvm_double_ty]>],
162+
def FMad : DXILOpProperties<46, int_fmuladd, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty, llvm_double_ty]>],
164163
"Floating point arithmetic multiply/add operation."
165164
" fmad(m,a,b) = m * a + b.">;
166165
// Int overloads
167-
def IMad : DXILOpMapping<48, int_dx_imad, [DXILOpOverload<SM6_0, [llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
166+
def IMad : DXILOpProperties<48, int_dx_imad, [DXILOpOverload<SM6_0, [llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
168167
"Signed integer arithmetic multiply/add operation."
169168
" imad(m,a,b) = m * a + b.">;
170-
def UMad : DXILOpMapping<49, int_dx_umad, [DXILOpOverload<SM6_0, [llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
169+
def UMad : DXILOpProperties<49, int_dx_umad, [DXILOpOverload<SM6_0, [llvm_i16_ty, llvm_i32_ty, llvm_i64_ty]>],
171170
"Unsigned integer arithmetic multiply/add operation."
172171
" umad(m,a, = m * a + b.">;
173172
}
174173

175174
// Dot Operations
176175
let OpClass = dot2 in
177-
def Dot2 : DXILOpMapping<54, int_dx_dot2, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
176+
def Dot2 : DXILOpProperties<54, int_dx_dot2, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
178177
"dot product of two float vectors Dot(a,b) = a[0]*b[0] +"
179178
" ... + a[n]*b[n] where n is between 0 and 1">;
180179
let OpClass = dot3 in
181-
def Dot3 : DXILOpMapping<55, int_dx_dot3, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
180+
def Dot3 : DXILOpProperties<55, int_dx_dot3, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
182181
"dot product of two float vectors Dot(a,b) = a[0]*b[0] +"
183182
" ... + a[n]*b[n] where n is between 0 and 2">;
184183
let OpClass = dot4 in
185-
def Dot4 : DXILOpMapping<56, int_dx_dot4, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
184+
def Dot4 : DXILOpProperties<56, int_dx_dot4, [DXILOpOverload<SM6_0, [llvm_half_ty, llvm_float_ty]>],
186185
"dot product of two float vectors Dot(a,b) = a[0]*b[0] +"
187186
" ... + a[n]*b[n] where n is between 0 and 3">;
188187

189188
// Thread Operations
190189
let OpClass = threadId in
191-
def ThreadId : DXILOpMapping<93, int_dx_thread_id, [DXILOpOverload<SM6_0, [llvm_i32_ty]>],
190+
def ThreadId : DXILOpProperties<93, int_dx_thread_id, [DXILOpOverload<SM6_0, [llvm_i32_ty]>],
192191
"Reads the thread ID">;
193192
let OpClass = groupId in
194-
def GroupId : DXILOpMapping<94, int_dx_group_id, [DXILOpOverload<SM6_0, [llvm_i32_ty]>],
193+
def GroupId : DXILOpProperties<94, int_dx_group_id, [DXILOpOverload<SM6_0, [llvm_i32_ty]>],
195194
"Reads the group ID (SV_GroupID)">;
196195
let OpClass = threadIdInGroup in
197-
def ThreadIdInGroup : DXILOpMapping<95, int_dx_thread_id_in_group, [DXILOpOverload<SM6_0, [llvm_i32_ty]>],
196+
def ThreadIdInGroup : DXILOpProperties<95, int_dx_thread_id_in_group, [DXILOpOverload<SM6_0, [llvm_i32_ty]>],
198197
"Reads the thread ID within the group "
199198
"(SV_GroupThreadID)">;
200199
let OpClass = flattenedThreadIdInGroup in
201-
def FlattenedThreadIdInGroup : DXILOpMapping<96, int_dx_flattened_thread_id_in_group,
200+
def FlattenedThreadIdInGroup : DXILOpProperties<96, int_dx_flattened_thread_id_in_group,
202201
[DXILOpOverload<SM6_0, [llvm_i32_ty]>],
203202
"Provides a flattened index for a given"
204203
" thread within a given group (SV_GroupIndex)">;

llvm/utils/TableGen/DXILEmitter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,11 @@ static void emitDXILOperationTable(std::vector<DXILOperationDesc> &Ops,
509509
static void EmitDXILOperation(RecordKeeper &Records, raw_ostream &OS) {
510510
OS << "// Generated code, do not edit.\n";
511511
OS << "\n";
512-
// Get all DXIL Ops to intrinsic mapping records
513-
std::vector<Record *> OpIntrMaps =
514-
Records.getAllDerivedDefinitions("DXILOpMappingBase");
512+
// Get all DXIL Ops property records
513+
std::vector<Record *> OpIntrProps =
514+
Records.getAllDerivedDefinitions("DXILOpPropertiesBase");
515515
std::vector<DXILOperationDesc> DXILOps;
516-
for (auto *Record : OpIntrMaps) {
516+
for (auto *Record : OpIntrProps) {
517517
DXILOps.emplace_back(DXILOperationDesc(Record));
518518
}
519519
OS << "#ifdef DXIL_OP_ENUM\n";

0 commit comments

Comments
 (0)