50 const char *getPassName()
const override {
51 return "convert address space of alloca'ed memory to local";
59 "Lower Alloca",
false,
false)
67 if (
auto allocaInst = dyn_cast<AllocaInst>(&
I)) {
76 NewASCToLocal->insertAfter(allocaInst);
77 NewASCToGeneric->insertAfter(NewASCToLocal);
79 UE = allocaInst->use_end();
86 const auto &AllocaUse = *UI++;
88 if (LI && LI->getPointerOperand() == allocaInst && !LI->isVolatile()) {
89 LI->
setOperand(LI->getPointerOperandIndex(), NewASCToGeneric);
93 if (
SI &&
SI->getPointerOperand() == allocaInst && !
SI->isVolatile()) {
94 SI->setOperand(
SI->getPointerOperandIndex(), NewASCToGeneric);
98 if (GI && GI->getPointerOperand() == allocaInst) {
99 GI->
setOperand(GI->getPointerOperandIndex(), NewASCToGeneric);
103 if (BI && BI->getOperand(0) == allocaInst) {
114 return new NVPTXLowerAlloca();
use_iterator_impl< Use > use_iterator
static PointerType * get(Type *ElementType, unsigned AddressSpace)
PointerType::get - This constructs a pointer to an object of the specified type in a numbered address...
LoadInst - an instruction for reading from memory.
This class represents a conversion between pointers from one address space to another.
This class represents a no-op cast from one type to another.
StoreInst - an instruction for storing to memory.
Type * getElementType() const
PointerType - Class to represent pointers.
GetElementPtrInst - an instruction for type-safe pointer arithmetic to access elements of arrays and ...
LLVM Basic Block Representation.
INITIALIZE_PASS(NVPTXLowerAlloca,"nvptx-lower-alloca","Lower Alloca", false, false) bool NVPTXLowerAlloca
BasicBlockPass class - This class is used to implement most local optimizations.
void initializeNVPTXLowerAllocaPass(PassRegistry &)
BasicBlockPass * createNVPTXLowerAllocaPass()
Module.h This file contains the declarations for the Module class.
void setOperand(unsigned i, Value *Val)
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)
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...