21#include "llvm/IR/IntrinsicsDirectX.h"
27#define DEBUG_TYPE "dxil-op-lower"
34 Value *DXILOpArg =
B.getInt32(
static_cast<unsigned>(DXILOp));
39 CallInst *CI = dyn_cast<CallInst>(U);
44 Args.emplace_back(DXILOpArg);
59#define DXIL_OP_INTRINSIC_MAP
60#include "DXILOperation.inc"
61#undef DXIL_OP_INTRINSIC_MAP
64 if (!
F.isDeclaration())
69 auto LowerIt = LowerMap.find(
ID);
70 if (LowerIt == LowerMap.end())
91class DXILOpLoweringLegacy :
public ModulePass {
99char DXILOpLoweringLegacy::ID = 0;
109 return new DXILOpLoweringLegacy();
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static bool lowerIntrinsics(Module &M)
static void lowerIntrinsic(dxil::OpCode DXILOp, Function &F, Module &M)
Module.h This file contains the declarations for the Module class.
This header defines various interfaces for pass management in LLVM.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static bool lowerIntrinsics(Module &M)
This file defines the SmallVector class.
A container for analyses that lazily runs them and caches their results.
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
This class represents a function call, abstracting a target machine's calling convention.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Type * getOverloadTy(dxil::OpCode OpCode, FunctionType *FT, bool NoOpCodeParam)
CallInst * createDXILOpCall(dxil::OpCode OpCode, Type *OverloadTy, llvm::iterator_range< Use * > Args)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
This is an optimization pass for GlobalISel generic memory operations.
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...
ModulePass * createDXILOpLoweringLegacyPass()
Pass to lowering LLVM intrinsic call to DXIL op function call.
A CRTP mix-in to automatically provide informational APIs needed for passes.