Skip to content

Commit f357fe3

Browse files
authored
[DirectX] Disentangle DXIL.td's op types from LLVMType. NFC
LLVMType is both too broad and too narrow for defining DXIL operations, in different ways. It's too broad in the sense that we don't need the full set of MVTs - the set of types DXIL operations work on is much smaller. It's too narrow in the sense that it's difficult to use it for the various fixed structure types in DXIL, like `%dx.types.Handle` or `%dx.Types.ResRet.f32`. Replace the usage of LLVMType in DXIL.td with DXILOpParamType, a simple class that we can define an enum of types from. Further, use this to replace the "ParameterKind" enum in DXILABI.h that has nothing to do with DXIL's ABI. Pull Request: llvm#104247
1 parent 6bb5a0b commit f357fe3

File tree

6 files changed

+234
-325
lines changed

6 files changed

+234
-325
lines changed

llvm/docs/DirectX/DXILOpTableGenDesign.rst

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,14 @@ properties are specified as fields of the ``DXILOp`` class as described below.
9393
class DXILOpClass;
9494
9595
Concrete operation records, such as ``unary`` are defined by inheriting from ``DXILOpClass``.
96-
6. Return type of the operation is represented as ``LLVMType``.
97-
7. Operation arguments are represented as a list of ``LLVMType`` with each type
98-
corresponding to the argument position. An overload type, if supported by the operation, is
99-
denoted as the positional type ``overloadTy`` in the argument or in the result, where
100-
``overloadTy`` is defined to be synonymous to ``llvm_any_ty``.
101-
102-
.. code-block::
103-
104-
defvar overloadTy = llvm_any_ty
105-
106-
Empty list, ``[]`` represents an operation with no arguments.
107-
96+
6. A set of type names are defined that represent return and argument types,
97+
which all inherit from ``DXILOpParamType``. These represent simple types
98+
like ``int32Ty``, DXIL types like ``dx.types.Handle``, and a special
99+
``overloadTy`` which can be any type allowed by ``Overloads``, described
100+
below.
101+
7. Operation return type is represented as a ``DXILOpParamType``, and arguments
102+
are represented as a list of the same. An operation with no return value
103+
shall specify ``VoidTy`` as its return.
108104
8. Valid operation overload types predicated on DXIL version are specified as
109105
a list of ``Overloads`` records. Representation of ``Overloads``
110106
class is described in a later section.
@@ -145,10 +141,10 @@ TableGen representations of its properties described above.
145141
Intrinsic LLVMIntrinsic = ?;
146142
147143
// Result type of the op.
148-
LLVMType result;
144+
DXILOpParamType result;
149145
150146
// List of argument types of the op. Default to 0 arguments.
151-
list<LLVMType> arguments = [];
147+
list<DXILOpParamType> arguments = [];
152148
153149
// List of valid overload types predicated by DXIL version
154150
list<Overloads> overloads;
@@ -233,9 +229,9 @@ overloads predicated on DXIL version as list of records of the following class
233229

234230
.. code-block::
235231
236-
class Overloads<Version minver, list<LLVMType> ols> {
232+
class Overloads<Version minver, list<DXILOpParamType> ols> {
237233
Version dxil_version = minver;
238-
list<LLVMType> overload_types = ols;
234+
list<DXILOpParamType> overload_types = ols;
239235
}
240236
241237
Following is an example specification of valid overload types for ``DXIL1_0`` and

llvm/include/llvm/Support/DXILABI.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,6 @@
2222
namespace llvm {
2323
namespace dxil {
2424

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-
CBufferRet,
38-
ResourceRet,
39-
DXILHandle,
40-
};
41-
4225
enum class ResourceClass : uint8_t {
4326
SRV = 0,
4427
UAV,

0 commit comments

Comments
 (0)