41 if (!CI || CI->getCalledValue() != &
F)
46 B.
CreateGEP(Int8Ty, CI->getArgOperand(0), CI->getArgOperand(1));
50 Value *ResultPtr = B.
CreateGEP(Int8Ty, CI->getArgOperand(0), OffsetI32);
53 CI->eraseFromParent();
70 if (
Function* Fn = dyn_cast<Function>(FCache)) {
81 assert(CI->getCalledFunction() &&
"Cannot lower an indirect call!");
84 IRBuilder<> Builder(CI->getParent(), CI->getIterator());
87 NewCI->setName(CI->getName());
88 NewCI->setTailCallKind(CI->getTailCallKind());
90 CI->replaceAllUsesWith(NewCI);
91 CI->eraseFromParent();
100 if (
F.getName().startswith(
"llvm.load.relative.")) {
104 switch (
F.getIntrinsicID()) {
150 Changed |=
lowerObjCCall(
F,
"objc_retainAutoreleasedReturnValue");
162 Changed |=
lowerObjCCall(
F,
"objc_unsafeClaimAutoreleasedReturnValue");
189 class PreISelIntrinsicLoweringLegacyPass :
public ModulePass {
193 PreISelIntrinsicLoweringLegacyPass() :
ModulePass(ID) {}
203 "pre-isel-intrinsic-lowering",
"Pre-ISel Intrinsic Lowering",
207 return new PreISelIntrinsicLoweringLegacyPass;
This class represents lattice values for constants.
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeList AttributeList)
Look up the specified function in the module symbol table.
A Module instance is used to store all the information related to an LLVM module. ...
LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, unsigned Align, const char *Name)
Provided to resolve 'CreateAlignedLoad(Ptr, Align, "...")' correctly, instead of converting the strin...
This class represents a function call, abstracting a target machine's calling convention.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
static bool setNonLazyBind(Function &F)
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
LinkageTypes getLinkage() const
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
static bool lowerLoadRelative(Function &F)
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
A set of analyses that are preserved following a run of a transformation pass.
The instances of the Type class are immutable: once they are created, they are never changed...
INITIALIZE_PASS(PreISelIntrinsicLoweringLegacyPass, "pre-isel-intrinsic-lowering", "Pre-ISel Intrinsic Lowering", false, false) ModulePass *llvm
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
static bool lowerObjCCall(Function &F, const char *NewFn, bool setNonLazyBind=false)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Value * CreateGEP(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &Name="")
Module.h This file contains the declarations for the Module class.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
static IntegerType * getInt32Ty(LLVMContext &C)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
ModulePass * createPreISelIntrinsicLoweringPass()
This pass lowers the @llvm.load.relative and @llvm.objc.
A container for analyses that lazily runs them and caches their results.
static bool lowerIntrinsics(Module &M)
static IntegerType * getInt8Ty(LLVMContext &C)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.