Go to the documentation of this file.
20 #include "llvm/IR/IntrinsicsDirectX.h"
26 #define DEBUG_TYPE "dxil-op-lower"
119 return ST->getStructName().str();
122 return ST->getStructName().str();
145 #define DXIL_OP_OPERATION_TABLE
146 #include "DXILOperation.inc"
147 #undef DXIL_OP_OPERATION_TABLE
165 Type *OverloadTy =
F.getReturnType();
175 assert(!
M.getFunction(FnName) &&
"Function already exists");
177 auto &Ctx =
M.getContext();
186 return M.getOrInsertFunction(FnName, DXILOpFT);
192 Value *DXILOpArg =
B.getInt32(
static_cast<unsigned>(DXILOp));
194 CallInst *CI = dyn_cast<CallInst>(U);
199 Args.emplace_back(DXILOpArg);
201 B.SetInsertPoint(CI);
212 bool Updated =
false;
214 #define DXIL_OP_INTRINSIC_MAP
215 #include "DXILOperation.inc"
216 #undef DXIL_OP_INTRINSIC_MAP
219 if (!
F.isDeclaration())
224 auto LowerIt = LowerMap.find(
ID);
225 if (LowerIt == LowerMap.end())
235 class DXILOpLowering :
public PassInfoMixin<DXILOpLowering> {
246 class DXILOpLoweringLegacy :
public ModulePass {
249 StringRef getPassName()
const override {
return "DXIL Op Lowering"; }
264 return new DXILOpLoweringLegacy();
static OverloadKind getOverloadKind(Type *Ty)
A set of analyses that are preserved following a run of a transformation pass.
@ FloatTyID
32-bit floating point type
@ DoubleTyID
64-bit floating point type
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A CRTP mix-in to automatically provide informational APIs needed for passes.
@ VoidTyID
type with no size
A raw_ostream that writes to an std::string.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
TypeID getTypeID() const
Return the type id for the type.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
The instances of the Type class are immutable: once they are created, they are never changed.
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
static IntegerType * getInt32Ty(LLVMContext &C)
static FunctionCallee createDXILOpFunction(DXIL::OpCode DXILOp, Function &F, Module &M)
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
llvm::Attribute::AttrKind FuncAttr
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
param_iterator param_end() const
void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
INITIALIZE_PASS_BEGIN(DXILOpLoweringLegacy, DEBUG_TYPE, "DXIL Op Lowering", false, false) INITIALIZE_PASS_END(DXILOpLoweringLegacy
ModulePass * createDXILOpLoweringLegacyPass()
Pass to lowering LLVM intrinsic call to DXIL op function call.
static bool lowerIntrinsics(Module &M)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Class to represent integer types.
param_iterator param_begin() const
void setName(const Twine &Name)
Change the name of the value.
unsigned OpCodeNameOffset
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
DXIL::OpCodeClass OpCodeClass
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
constexpr StringLiteral DXILOpNamePrefix
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A Module instance is used to store all the information related to an LLVM module.
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
Class to represent struct types.
StringRef - Represent a constant reference to a string, i.e.
StringRef getTypeName()
We provide a function which tries to compute the (demangled) name of a type statically.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static const char * getOverloadTypeName(OverloadKind Kind)
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
@ IntegerTyID
Arbitrary bit width integers.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static std::string constructOverloadName(OverloadKind Kind, Type *Ty, const OpCodeProperty &Prop)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
A container for analyses that lazily runs them and caches their results.
This class represents a function call, abstracting a target machine's calling convention.
unsigned OpCodeClassNameOffset
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
TypeID
Definitions of all of the base types for the Type system.
std::string & str()
Returns the string's reference.
LLVM Value Representation.
static void lowerIntrinsic(DXIL::OpCode DXILOp, Function &F, Module &M)
@ HalfTyID
16-bit floating point type
Class to represent function types.
reference emplace_back(ArgTypes &&... Args)