@@ -35,30 +35,18 @@ def BinaryUintCategory : DXILOpCategory<"Binary uint">;
35
35
def UnaryFloatCategory : DXILOpCategory<"Unary float">;
36
36
def ComputeIDCategory : DXILOpCategory<"Compute/Mesh/Amplification shader">;
37
37
38
- // Following are the scalar types supported by DXIL operations and are synonymous
39
- // to llvm_*_ty defined for readability and ease of use in the context of this file.
40
-
41
- def voidTy : LLVMType<isVoid>;
42
-
43
- // Floating point types
44
- def f16Ty : LLVMType<f16>;
45
- def f32Ty : LLVMType<f32>;
46
- def f64Ty : LLVMType<f64>;
47
-
48
- // Integer types
49
- def i1Ty : LLVMType<i1>;
50
- def i8Ty : LLVMType<i8>;
51
- def i16Ty : LLVMType<i16>;
52
- def i32Ty : LLVMType<i32>;
53
- def i64Ty : LLVMType<i64>;
38
+ // Represent as any pointer type with an option to change to a qualified pointer
39
+ // type with address space specified.
40
+ def dxil_handle_ty : LLVMAnyPointerType;
41
+ def dxil_cbuffer_ty : LLVMAnyPointerType;
42
+ def dxil_resource_ty : LLVMAnyPointerType;
54
43
55
44
// The parameter description for a DXIL operation
56
- class DXILOpParameter<int pos, string type, string name, string doc,
45
+ class DXILOpParameter<int pos, LLVMType type, string name, string doc,
57
46
bit isConstant = 0, string enumName = "",
58
47
int maxValue = 0> {
59
48
int Pos = pos; // Position in parameter list
60
- string Type = type; // LLVM type name, $o for overload, $r for resource
61
- // type, $cb for legacy cbuffer, $u4 for u4 struct
49
+ LLVMType ParamType = type; // Parameter type
62
50
string Name = name; // Short, unique parameter name
63
51
string Doc = doc; // Description of this parameter
64
52
bit IsConstant = isConstant; // Whether this parameter requires a constant value in the IR
@@ -108,55 +96,55 @@ class DXILOperation<string name, int opCode, DXILOpClass opClass, DXILOpCategory
108
96
class LLVMIntrinsic<Intrinsic llvm_intrinsic_> { Intrinsic llvm_intrinsic = llvm_intrinsic_; }
109
97
110
98
def Sin : DXILOperation<"Sin", 13, UnaryClass, UnaryFloatCategory, "returns sine(theta) for theta in radians.",
111
- [f16Ty,f32Ty ], ReadNone,
99
+ [llvm_half_ty, llvm_float_ty ], ReadNone,
112
100
[
113
- DXILOpParameter<0, "$o" , "", "operation result">,
114
- DXILOpParameter<1, "i32" , "opcode", "DXIL opcode">,
115
- DXILOpParameter<2, "$o" , "value", "input value">
101
+ DXILOpParameter<0, llvm_anyfloat_ty , "", "operation result">,
102
+ DXILOpParameter<1, llvm_i32_ty , "opcode", "DXIL opcode">,
103
+ DXILOpParameter<2, llvm_anyfloat_ty , "value", "input value">
116
104
],
117
105
["floats"]>,
118
106
LLVMIntrinsic<int_sin>;
119
107
120
- def UMax : DXILOperation< "UMax", 39, BinaryClass, BinaryUintCategory, "unsigned integer maximum. UMax(a,b) = a > b ? a : b",
121
- [i16Ty,i32Ty,i64Ty], ReadNone,
108
+ def UMax : DXILOperation< "UMax", 39, BinaryClass, BinaryUintCategory, "unsigned integer maximum. UMax(a,b) = a > b ? a : b",
109
+ [llvm_i16_ty, llvm_i32_ty, llvm_i64_ty], ReadNone,
122
110
[
123
- DXILOpParameter<0, "$o", "", "operation result">,
124
- DXILOpParameter<1, "i32", "opcode", "DXIL opcode">,
125
- DXILOpParameter<2, "$o", "a", "input value">,
126
- DXILOpParameter<3, "$o", "b", "input value">
111
+ DXILOpParameter<0, llvm_anyint_ty, "", "operation result">,
112
+ DXILOpParameter<1, llvm_i32_ty, "opcode", "DXIL opcode">,
113
+ DXILOpParameter<2, llvm_anyint_ty, "a", "input value">,
114
+ DXILOpParameter<3, llvm_anyint_ty, "b", "input value">
127
115
],
128
116
["uints"]>,
129
117
LLVMIntrinsic<int_umax>;
130
118
131
- def ThreadId : DXILOperation< "ThreadId", 93, ThreadIdClass, ComputeIDCategory, "reads the thread ID", [i32Ty], ReadNone,
119
+ def ThreadId : DXILOperation< "ThreadId", 93, ThreadIdClass, ComputeIDCategory, "reads the thread ID", [llvm_i32_ty], ReadNone,
132
120
[
133
- DXILOpParameter<0, "i32", "", "thread ID component">,
134
- DXILOpParameter<1, "i32", "opcode", "DXIL opcode">,
135
- DXILOpParameter<2, "i32", "component", "component to read (x,y,z)">
121
+ DXILOpParameter<0, llvm_i32_ty, "", "thread ID component">,
122
+ DXILOpParameter<1, llvm_i32_ty, "opcode", "DXIL opcode">,
123
+ DXILOpParameter<2, llvm_i32_ty, "component", "component to read (x,y,z)">
136
124
]>,
137
125
LLVMIntrinsic<int_dx_thread_id>;
138
126
139
- def GroupId : DXILOperation< "GroupId", 94, GroupIdClass, ComputeIDCategory, "reads the group ID (SV_GroupID)", [i32Ty], ReadNone,
127
+ def GroupId : DXILOperation< "GroupId", 94, GroupIdClass, ComputeIDCategory, "reads the group ID (SV_GroupID)", [llvm_i32_ty], ReadNone,
140
128
[
141
- DXILOpParameter<0, "i32", "", "group ID component">,
142
- DXILOpParameter<1, "i32", "opcode", "DXIL opcode">,
143
- DXILOpParameter<2, "i32", "component", "component to read">
129
+ DXILOpParameter<0, llvm_i32_ty, "", "group ID component">,
130
+ DXILOpParameter<1, llvm_i32_ty, "opcode", "DXIL opcode">,
131
+ DXILOpParameter<2, llvm_i32_ty, "component", "component to read">
144
132
]>,
145
133
LLVMIntrinsic<int_dx_group_id>;
146
134
147
- def ThreadIdInGroup : DXILOperation< "ThreadIdInGroup", 95, ThreadIdInGroupClass, ComputeIDCategory,
148
- "reads the thread ID within the group (SV_GroupThreadID)", [i32Ty], ReadNone,
135
+ def ThreadIdInGroup : DXILOperation< "ThreadIdInGroup", 95, ThreadIdInGroupClass, ComputeIDCategory,
136
+ "reads the thread ID within the group (SV_GroupThreadID)", [llvm_i32_ty], ReadNone,
149
137
[
150
- DXILOpParameter<0, "i32", "", "thread ID in group component">,
151
- DXILOpParameter<1, "i32", "opcode", "DXIL opcode">,
152
- DXILOpParameter<2, "i32", "component", "component to read (x,y,z)">
138
+ DXILOpParameter<0, llvm_i32_ty, "", "thread ID in group component">,
139
+ DXILOpParameter<1, llvm_i32_ty, "opcode", "DXIL opcode">,
140
+ DXILOpParameter<2, llvm_i32_ty, "component", "component to read (x,y,z)">
153
141
]>,
154
142
LLVMIntrinsic<int_dx_thread_id_in_group>;
155
143
156
- def FlattenedThreadIdInGroup : DXILOperation< "FlattenedThreadIdInGroup", 96, FlattenedThreadIdInGroupClass, ComputeIDCategory,
157
- "provides a flattened index for a given thread within a given group (SV_GroupIndex)", [i32Ty], ReadNone,
144
+ def FlattenedThreadIdInGroup : DXILOperation< "FlattenedThreadIdInGroup", 96, FlattenedThreadIdInGroupClass, ComputeIDCategory,
145
+ "provides a flattened index for a given thread within a given group (SV_GroupIndex)", [llvm_i32_ty], ReadNone,
158
146
[
159
- DXILOpParameter<0, "i32", "", "result">,
160
- DXILOpParameter<1, "i32", "opcode", "DXIL opcode">
147
+ DXILOpParameter<0, llvm_i32_ty, "", "result">,
148
+ DXILOpParameter<1, llvm_i32_ty, "opcode", "DXIL opcode">
161
149
]>,
162
150
LLVMIntrinsic<int_dx_flattened_thread_id_in_group>;
0 commit comments