34 NVPTXImageOptimizer();
49 NVPTXImageOptimizer::NVPTXImageOptimizer()
57 InstrToDelete.clear();
65 if (
CallInst *CI = dyn_cast<CallInst>(
I)) {
66 Function *CalledF = CI->getCalledFunction();
72 Changed |= replaceIsTypePSampler(Instr);
75 Changed |= replaceIsTypePSurface(Instr);
78 Changed |= replaceIsTypePTexture(Instr);
87 for (
unsigned i = 0, e = InstrToDelete.size(); i != e; ++i)
88 InstrToDelete[i]->eraseFromParent();
93 bool NVPTXImageOptimizer::replaceIsTypePSampler(
Instruction &
I) {
99 }
else if (
isImage(*TexHandle)) {
109 bool NVPTXImageOptimizer::replaceIsTypePSurface(
Instruction &I) {
128 bool NVPTXImageOptimizer::replaceIsTypePTexture(
Instruction &I) {
153 if (
BranchInst *BI = dyn_cast<BranchInst>(*UI)) {
154 if (BI->isUnconditional())
continue;
158 Dest = BI->getSuccessor(1);
161 Dest = BI->getSuccessor(0);
162 BranchInst::Create(Dest, BI);
163 InstrToDelete.push_back(BI);
167 InstrToDelete.push_back(From);
170 Value *NVPTXImageOptimizer::cleanupValue(
Value *V) {
172 return cleanupValue(EVI->getAggregateOperand());
178 return new NVPTXImageOptimizer();
bool isIntrinsic() const
isIntrinsic - Returns true if the function's name starts with "llvm.".
This class represents lattice values for constants.
This class represents a function call, abstracting a target machine's calling convention.
LLVMContext & getContext() const
All values hold a context through their type.
static Constant * getTrue(Type *Ty)
For a boolean type or a vector of boolean type, return true or a vector with every element true...
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
FunctionPass * createNVPTXImageOptimizerPass()
bool isSampler(const Value &val)
Value * getOperand(unsigned i) const
static bool runOnFunction(Function &F, bool PostInlining)
LLVM Basic Block Representation.
Conditional or Unconditional Branch instruction.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
FunctionPass class - This class is used to implement most global optimizations.
bool isImage(const Value &val)
Iterator for intrusive lists based on ilist_node.
This is the shared class of boolean and integer constants.
BlockVerifier::State From
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
bool isImageReadWrite(const Value &val)
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
static Constant * getFalse(Type *Ty)
For a boolean type or a vector of boolean type, return false or a vector with every element false...
bool isImageReadOnly(const Value &val)
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
LLVM Value Representation.
bool isImageWriteOnly(const Value &val)