35 InsertPt = Arg->getParent()->getEntryBlock().begin();
38 assert(InsertPt != InsertPt->getParent()->end() &&
39 "We don't call this function with Ptr being a terminator.");
55 if (!
all_of(V.users(), [](
User *U) { return isa<IntToPtrInst>(U); }))
59 for (
User *U : UsersToUpdate)
75 if (LI->getType()->isPointerTy() || LI->getType()->isIntegerTy()) {
78 if (Arg->hasByValAttr()) {
79 if (LI->getType()->isPointerTy())
89 if (Arg.getType()->isIntegerTy())
97class NVPTXMarkKernelPtrsGlobalLegacyPass :
public FunctionPass {
100 NVPTXMarkKernelPtrsGlobalLegacyPass() : FunctionPass(ID) {}
107 "nvptx-mark-kernel-ptrs-global",
108 "NVPTX Mark Kernel Pointers Global",
false,
false)
114char NVPTXMarkKernelPtrsGlobalLegacyPass::ID = 0;
117 return new NVPTXMarkKernelPtrsGlobalLegacyPass();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Expand Atomic instructions
static bool runOnFunction(Function &F, bool PostInlining)
NVPTX address space definition.
static bool markKernelPtrsGlobal(Function &F)
static void markPointerAsAS(Value *Ptr, unsigned AS)
static void handleIntToPtr(Value &V)
static void markPointerAsGlobal(Value *Ptr)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This class represents a conversion between pointers from one address space to another.
This class represents an incoming formal argument to a Function.
InstListType::iterator iterator
Instruction iterators...
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 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.
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
void setOperand(unsigned i, Value *Val)
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVMContext & getContext() const
All values hold a context through their type.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
FunctionPass * createNVPTXMarkKernelPtrsGlobalPass()
bool isKernelFunction(const Function &F)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
LLVM_ABI const Value * getUnderlyingObject(const Value *V, unsigned MaxLookup=MaxLookupSearchDepth)
This method strips off any GEP address adjustments, pointer casts or llvm.threadlocal....
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)