Go to the documentation of this file.
22 #ifndef LLVM_LIB_TRANSFORMS_OBJCARC_OBJCARC_H
23 #define LLVM_LIB_TRANSFORMS_OBJCARC_OBJCARC_H
41 Value *OldArg = cast<CallInst>(CI)->getArgOperand(0);
50 "Can't delete non-forwarding instruction with users!");
68 if (
const auto *
C = dyn_cast<CallInst>(Opnd))
70 return dyn_cast<InvokeInst>(Opnd);
74 template<
class PHINodeTy,
class VectorTy>
76 auto *
BB = PN.getParent();
77 for (
auto &
P :
BB->phis()) {
80 unsigned I = 0,
E = PN.getNumIncomingValues();
82 auto *
BB = PN.getIncomingBlock(
I);
83 auto *PNOpnd = PN.getIncomingValue(
I)->stripPointerCasts();
84 auto *POpnd =
P.getIncomingValueForBlock(
BB)->stripPointerCasts();
89 PHIList.push_back(&
P);
95 return dyn_cast_or_null<MDString>(
M.getModuleFlag(MarkerKey));
109 : EP(
P), ContractPass(ContractPass) {}
127 if (
auto *CI = dyn_cast<CallInst>(
I))
128 return RVCalls.count(CI);
134 auto It = RVCalls.find(CI);
135 if (It != RVCalls.end()) {
137 for (
auto U = It->second->user_begin(),
E = It->second->user_end(); U !=
E; ++U)
138 if (
auto *CI = dyn_cast<CallInst>(*U))
146 NewCall->copyMetadata(*It->second);
147 It->second->replaceAllUsesWith(NewCall);
148 It->second->eraseFromParent();
ARCInstKind GetBasicARCInstKind(const Value *V)
Determine which objc runtime call instruction class V belongs to.
bool RecursivelyDeleteTriviallyDeadInstructions(Value *V, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr, std::function< void(Value *)> AboutToDeleteCallback=std::function< void(Value *)>())
If the specified value is a trivially dead instruction, delete it.
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
static CallBase * removeOperandBundle(CallBase *CB, uint32_t ID, Instruction *InsertPt=nullptr)
Create a clone of CB with operand bundle ID removed.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
(vector float) vec_cmpeq(*A, *B) C
@ RetainRV
objc_retainAutoreleasedReturnValue
void getEquivalentPHIs(PHINodeTy &PN, VectorTy &PHIList)
Return the list of PHI nodes that are equivalent to PN.
@ OB_clang_arc_attachedcall
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
CallInst * insertRVCallWithColors(Instruction *InsertPt, CallBase *AnnotatedCall, const DenseMap< BasicBlock *, ColorVector > &BlockColors)
Insert a retainRV/claimRV call with colors.
std::pair< bool, bool > insertAfterInvokes(Function &F, DominatorTree *DT)
Insert a retainRV/claimRV call to the normal destination blocks of invokes with operand bundle "clang...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
CallInst * insertRVCall(Instruction *InsertPt, CallBase *AnnotatedCall)
Insert a retainRV/claimRV call.
A Module instance is used to store all the information related to an LLVM module.
static const Instruction * getreturnRVOperand(const Instruction &Inst, ARCInstKind Class)
If Inst is a ReturnRV and its operand is a call or invoke, return the operand.
const char * getRVMarkerModuleFlagStr()
Intrinsic::ID getIntrinsicID() const
Returns the intrinsic ID of the intrinsic called or Intrinsic::not_intrinsic if the called function i...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool IsNullOrUndef(const Value *V)
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Declarations for ObjC runtime functions and constants.
static MDString * getRVInstMarker(Module &M)
bool contains(const Instruction *I) const
See if an instruction is a bundled retainRV/claimRV call.
static void EraseInstruction(Instruction *CI)
Erase the given instruction.
CallInst * createCallInstWithColors(FunctionCallee Func, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore, const DenseMap< BasicBlock *, ColorVector > &BlockColors)
Create a call instruction with the correct funclet token.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This class represents a function call, abstracting a target machine's calling convention.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
BundledRetainClaimRVs(ARCRuntimeEntryPoints &P, bool ContractPass)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Value * getOperand(unsigned i) const
LLVM Value Representation.
bool IsForwarding(ARCInstKind Class)
Test if the given class represents instructions which return their argument verbatim.
bool IsNoopOnNull(ARCInstKind Class)
Test if the given class represents instructions which do nothing if passed a null pointer.
void eraseInst(CallInst *CI)
Remove a retainRV/claimRV call entirely.