Go to the documentation of this file.
39 auto CI = dyn_cast<CallInst>(U.getUser());
40 if (!CI || CI->getCalledOperand() != &
F)
45 B.CreateGEP(Int8Ty, CI->getArgOperand(0), CI->getArgOperand(1));
46 Value *OffsetPtrI32 =
B.CreateBitCast(OffsetPtr, Int32PtrTy);
49 Value *ResultPtr =
B.CreateGEP(Int8Ty, CI->getArgOperand(0), OffsetI32);
51 CI->replaceAllUsesWith(ResultPtr);
52 CI->eraseFromParent();
81 Fn->setLinkage(
F.getLinkage());
85 Fn->addFnAttr(Attribute::NonLazyBind);
92 auto *CB = cast<CallBase>(U.getUser());
94 if (CB->getCalledFunction() != &
F) {
99 "use expected to be the argument of operand bundle "
100 "\"clang.arc.attachedcall\"");
105 auto *CI = cast<CallInst>(CB);
106 assert(CI->getCalledFunction() &&
"Cannot lower an indirect call!");
123 if (!CI->use_empty())
124 CI->replaceAllUsesWith(NewCI);
125 CI->eraseFromParent();
132 bool Changed =
false;
134 if (
F.getName().startswith(
"llvm.load.relative.")) {
138 switch (
F.getIntrinsicID()) {
141 case Intrinsic::objc_autorelease:
144 case Intrinsic::objc_autoreleasePoolPop:
147 case Intrinsic::objc_autoreleasePoolPush:
150 case Intrinsic::objc_autoreleaseReturnValue:
153 case Intrinsic::objc_copyWeak:
156 case Intrinsic::objc_destroyWeak:
159 case Intrinsic::objc_initWeak:
162 case Intrinsic::objc_loadWeak:
165 case Intrinsic::objc_loadWeakRetained:
168 case Intrinsic::objc_moveWeak:
171 case Intrinsic::objc_release:
174 case Intrinsic::objc_retain:
177 case Intrinsic::objc_retainAutorelease:
180 case Intrinsic::objc_retainAutoreleaseReturnValue:
183 case Intrinsic::objc_retainAutoreleasedReturnValue:
184 Changed |=
lowerObjCCall(
F,
"objc_retainAutoreleasedReturnValue");
186 case Intrinsic::objc_retainBlock:
189 case Intrinsic::objc_storeStrong:
192 case Intrinsic::objc_storeWeak:
195 case Intrinsic::objc_unsafeClaimAutoreleasedReturnValue:
196 Changed |=
lowerObjCCall(
F,
"objc_unsafeClaimAutoreleasedReturnValue");
198 case Intrinsic::objc_retainedObject:
201 case Intrinsic::objc_unretainedObject:
204 case Intrinsic::objc_unretainedPointer:
207 case Intrinsic::objc_retain_autorelease:
210 case Intrinsic::objc_sync_enter:
213 case Intrinsic::objc_sync_exit:
223 class PreISelIntrinsicLoweringLegacyPass :
public ModulePass {
227 PreISelIntrinsicLoweringLegacyPass() :
ModulePass(
ID) {}
237 "pre-isel-intrinsic-lowering",
"Pre-ISel Intrinsic Lowering",
241 return new PreISelIntrinsicLoweringLegacyPass;
A set of analyses that are preserved following a run of a transformation pass.
static bool lowerLoadRelative(Function &F)
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
static bool lowerIntrinsics(Module &M)
void setTailCallKind(TailCallKind TCK)
ARCInstKind GetFunctionClass(const Function *F)
Determine if F is one of the special known Functions.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
The instances of the Type class are immutable: once they are created, they are never changed.
bool IsNeverTail(ARCInstKind Class)
Test if the given class represents instructions which are never safe to mark with the "tail" keyword.
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
static IntegerType * getInt8Ty(LLVMContext &C)
static IntegerType * getInt32Ty(LLVMContext &C)
ModulePass * createPreISelIntrinsicLoweringPass()
This pass lowers the @llvm.load.relative and @llvm.objc.
static CallInst::TailCallKind getOverridingTailCallKind(const Function &F)
@ RetainRV
objc_retainAutoreleasedReturnValue
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void setName(const Twine &Name)
Change the name of the value.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool IsAlwaysTail(ARCInstKind Class)
Test if the given class represents instructions which are always safe to mark with the "tail" keyword...
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
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...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A Module instance is used to store all the information related to an LLVM module.
INITIALIZE_PASS(PreISelIntrinsicLoweringLegacyPass, "pre-isel-intrinsic-lowering", "Pre-ISel Intrinsic Lowering", false, false) ModulePass *llvm
ARCInstKind getAttachedARCFunctionKind(const CallBase *CB)
This function returns the ARCInstKind of the function attached to operand bundle clang_arc_attachedca...
static bool lowerObjCCall(Function &F, const char *NewFn, bool setNonLazyBind=false)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
A container for analyses that lazily runs them and caches their results.
This class represents a function call, abstracting a target machine's calling convention.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
static bool setNonLazyBind(Function &F)
LLVM Value Representation.
A Use represents the edge between a Value definition and its users.
@ UnsafeClaimRV
objc_unsafeClaimAutoreleasedReturnValue