82 const char *getPassName()
const override {
83 return "Lower pointer arguments of CUDA kernels";
94 "Lower kernel arguments (NVPTX)",
false,
false)
109 void NVPTXLowerKernelArgs::handleByValParam(
Argument *Arg) {
114 assert(PType &&
"Expecting pointer type in handleByValParam");
122 Arg->replaceAllUsesWith(AllocA);
131 void NVPTXLowerKernelArgs::handlePointerParam(
Argument *Arg) {
133 "byval params should be handled by handleByValParam");
155 bool NVPTXLowerKernelArgs::runOnFunction(
Function &
F) {
163 handleByValParam(&Arg);
165 handlePointerParam(&Arg);
173 return new NVPTXLowerKernelArgs(TM);
LLVM Argument representation.
void setAlignment(unsigned Align)
static PointerType * get(Type *ElementType, unsigned AddressSpace)
PointerType::get - This constructs a pointer to an object of the specified type in a numbered address...
bool isKernelFunction(const llvm::Function &)
const Instruction & front() const
LoadInst - an instruction for reading from memory.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Type * getPointerElementType() const
StringRef getName() const
Return a constant reference to the value's name.
iterator begin()
Instruction iterator methods.
void initializeNVPTXLowerKernelArgsPass(PassRegistry &)
This class represents a conversion between pointers from one address space to another.
StructType - Class to represent struct types.
StoreInst - an instruction for storing to memory.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Type * getElementType() const
PointerType - Class to represent pointers.
The instances of the Type class are immutable: once they are created, they are never changed...
const Function * getParent() const
FunctionPass class - This class is used to implement most global optimizations.
bool isPointerTy() const
isPointerTy - True if this is an instance of PointerType.
FunctionPass * createNVPTXLowerKernelArgsPass(const NVPTXTargetMachine *TM)
bool hasByValAttr() const
Return true if this argument has the byval attribute on it in its containing function.
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
const BasicBlock & getEntryBlock() const
void setOperand(unsigned i, Value *Val)
INITIALIZE_PASS(NVPTXLowerKernelArgs,"nvptx-lower-kernel-args","Lower kernel arguments (NVPTX)", false, false) void NVPTXLowerKernelArgs
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getParamAlignment(unsigned i) const
Extract the alignment for a call or parameter (0=unknown).
LLVM Value Representation.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
iterator_range< arg_iterator > args()
AllocaInst - an instruction to allocate memory on the stack.