36 UserDefineType = 1 << 9,
44 case OverloadKind::HALF:
46 case OverloadKind::FLOAT:
48 case OverloadKind::DOUBLE:
50 case OverloadKind::I1:
52 case OverloadKind::I8:
54 case OverloadKind::I16:
56 case OverloadKind::I32:
58 case OverloadKind::I64:
60 case OverloadKind::VOID:
61 case OverloadKind::ObjectType:
62 case OverloadKind::UserDefineType:
73 return OverloadKind::VOID;
75 return OverloadKind::HALF;
77 return OverloadKind::FLOAT;
79 return OverloadKind::DOUBLE;
85 return OverloadKind::I1;
87 return OverloadKind::I8;
89 return OverloadKind::I16;
91 return OverloadKind::I32;
93 return OverloadKind::I64;
96 return OverloadKind::VOID;
100 return OverloadKind::UserDefineType;
102 return OverloadKind::ObjectType;
105 return OverloadKind::VOID;
110 if (Kind < OverloadKind::UserDefineType) {
112 }
else if (Kind == OverloadKind::UserDefineType) {
114 return ST->getStructName().str();
115 }
else if (Kind == OverloadKind::ObjectType) {
117 return ST->getStructName().str();
144#define DXIL_OP_OPERATION_TABLE
145#include "DXILOperation.inc"
146#undef DXIL_OP_OPERATION_TABLE
150 if (Kind == OverloadKind::VOID) {
160 if (Kind == OverloadKind::VOID)
161 return TypeName.str();
163 assert(Kind < OverloadKind::UserDefineType &&
"invalid overload kind");
180 Type *FieldTypes[5] = {OverloadTy, OverloadTy, OverloadTy, OverloadTy,
192 case ParameterKind::VOID:
194 case ParameterKind::HALF:
196 case ParameterKind::FLOAT:
198 case ParameterKind::DOUBLE:
200 case ParameterKind::I1:
202 case ParameterKind::I8:
204 case ParameterKind::I16:
206 case ParameterKind::I32:
208 case ParameterKind::I64:
210 case ParameterKind::OVERLOAD:
212 case ParameterKind::RESOURCE_RET:
214 case ParameterKind::DXIL_HANDLE:
227 auto ParamKinds = getOpCodeParameterKind(*Prop);
233 return FunctionType::get(
250 if (
auto *Fn = M.getFunction(FnName))
254 return M.getOrInsertFunction(FnName, DXILOpFT);
265 FullArgs.
append(Args.begin(), Args.end());
270 bool NoOpCodeParam) {
277 case OverloadKind::VOID:
279 case OverloadKind::HALF:
281 case OverloadKind::FLOAT:
283 case OverloadKind::DOUBLE:
285 case OverloadKind::I1:
287 case OverloadKind::I8:
289 case OverloadKind::I16:
291 case OverloadKind::I32:
293 case OverloadKind::I64:
305 const unsigned SkipedParam = NoOpCodeParam ? 2 : 1;
309 auto ParamKinds = getOpCodeParameterKind(*Prop);
314 auto *ST = cast<StructType>(OverloadType);
315 OverloadType = ST->getElementType(0);
321 return ::getOpCodeName(DXILOp);
static FunctionType * getDXILOpFunctionType(const OpCodeProperty *Prop, Type *OverloadTy)
static StructType * getResRetType(Type *OverloadTy, LLVMContext &Ctx)
static const char * getOverloadTypeName(OverloadKind Kind)
static OverloadKind getOverloadKind(Type *Ty)
static StructType * getOrCreateStructType(StringRef Name, ArrayRef< Type * > EltTys, LLVMContext &Ctx)
static StructType * getHandleType(LLVMContext &Ctx)
static std::string constructOverloadName(OverloadKind Kind, Type *Ty, const OpCodeProperty &Prop)
constexpr StringLiteral DXILOpNamePrefix
static std::string constructOverloadTypeName(OverloadKind Kind, StringRef TypeName)
static Type * getTypeFromParameterKind(ParameterKind Kind, Type *OverloadTy)
static FunctionCallee getOrCreateDXILOpFunction(dxil::OpCode DXILOp, Type *OverloadTy, Module &M)
Module.h This file contains the declarations for the Module class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
This class represents a function call, abstracting a target machine's calling convention.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
Class to represent function types.
Type * getParamType(unsigned i) const
Parameter type accessors.
Type * getReturnType() const
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args=std::nullopt, const Twine &Name="", MDNode *FPMathTag=nullptr)
Class to represent integer types.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
This is an important class for using LLVM in a threaded context.
A Module instance is used to store all the information related to an LLVM module.
reference emplace_back(ArgTypes &&... Args)
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
StringRef - Represent a constant reference to a string, i.e.
Class to represent struct types.
static StructType * getTypeByName(LLVMContext &C, StringRef Name)
Return the type with the specified name, or null if there is none by that name.
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
static Type * getHalfTy(LLVMContext &C)
static Type * getDoubleTy(LLVMContext &C)
static IntegerType * getInt1Ty(LLVMContext &C)
TypeID
Definitions of all of the base types for the Type system.
@ HalfTyID
16-bit floating point type
@ VoidTyID
type with no size
@ FloatTyID
32-bit floating point type
@ IntegerTyID
Arbitrary bit width integers.
@ DoubleTyID
64-bit floating point type
void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
static Type * getVoidTy(LLVMContext &C)
static IntegerType * getInt16Ty(LLVMContext &C)
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
static IntegerType * getInt8Ty(LLVMContext &C)
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
static IntegerType * getInt32Ty(LLVMContext &C)
static IntegerType * getInt64Ty(LLVMContext &C)
static Type * getFloatTy(LLVMContext &C)
TypeID getTypeID() const
Return the type id for the type.
Type * getOverloadTy(dxil::OpCode OpCode, FunctionType *FT, bool NoOpCodeParam)
static const char * getOpCodeName(dxil::OpCode DXILOp)
CallInst * createDXILOpCall(dxil::OpCode OpCode, Type *OverloadTy, llvm::iterator_range< Use * > Args)
A range adaptor for a pair of iterators.
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
StringRef getTypeName()
We provide a function which tries to compute the (demangled) name of a type statically.
dxil::OpCodeClass OpCodeClass
unsigned OpCodeNameOffset
unsigned OpCodeClassNameOffset
unsigned ParameterTableOffset
llvm::Attribute::AttrKind FuncAttr