42 NVPTXLowerAlloca() : FunctionPass(ID) {}
43 StringRef getPassName()
const override {
44 return "convert address space of alloca'ed memory to local";
49char NVPTXLowerAlloca::ID = 1;
67 unsigned AllocAddrSpace = allocaInst->getAddressSpace();
70 "AllocaInst can only be in Generic or Local address space for "
89 ASCastToLocalAS->insertAfter(allocaInst->getIterator());
90 AllocaInLocalAS = ASCastToLocalAS;
97 AllocaInGenericAS->insertAfter(AllocaInLocalAS->
getIterator());
106 if (LI && LI->getPointerOperand() == allocaInst &&
108 LI->setOperand(LI->getPointerOperandIndex(), AllocaInGenericAS);
112 if (
SI &&
SI->getPointerOperand() == allocaInst &&
114 SI->setOperand(
SI->getPointerOperandIndex(), AllocaInGenericAS);
118 if (GI && GI->getPointerOperand() == allocaInst) {
119 GI->setOperand(GI->getPointerOperandIndex(), AllocaInGenericAS);
123 if (BI && BI->getOperand(0) == allocaInst) {
124 BI->setOperand(0, AllocaInGenericAS);
134 return new NVPTXLowerAlloca();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool runOnFunction(Function &F, bool PostInlining)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This class represents a conversion between pointers from one address space to another.
FunctionPass class - This class is used to implement most global optimizations.
static LLVM_ABI PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
A Use represents the edge between a Value definition and its users.
self_iterator getIterator()
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
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...
FunctionPass * createNVPTXLowerAllocaPass()