Go to the documentation of this file.
41 #define DEBUG_TYPE "objc-arc-ap-elim"
49 if (!
Callee->hasExactDefinition())
53 if (
const CallBase *JCB = dyn_cast<CallBase>(&
I))
56 if (Depth < 3 && !JCB->onlyReadsMemory() &&
57 MayAutorelease(*JCB,
Depth + 1))
78 if (Push && cast<CallInst>(&Inst)->getArgOperand(0) == Push) {
80 LLVM_DEBUG(
dbgs() <<
"ObjCARCAPElim::OptimizeBB: Zapping push pop "
86 Inst.eraseFromParent();
92 if (MayAutorelease(cast<CallBase>(Inst)))
121 "llvm.global_ctors is uncooperative!");
123 bool Changed =
false;
132 Function *
F = dyn_cast<Function>(cast<ConstantStruct>(
Op)->getOperand(1));
138 if (
F->isDeclaration())
141 if (std::next(
F->begin()) !=
F->end())
144 Changed |= OptimizeBB(&
F->front());
153 bool runOnModule(
Module &
M)
override;
165 "ObjC ARC autorelease pool elimination",
false,
false)
169 void ObjCARCAPElim::getAnalysisUsage(
AnalysisUsage &AU)
const {
173 bool ObjCARCAPElim::runOnModule(
Module &M) {
ARCInstKind GetBasicARCInstKind(const Value *V)
Determine which objc runtime call instruction class V belongs to.
A set of analyses that are preserved following a run of a transformation pass.
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...
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
INITIALIZE_PASS(ObjCARCAPElim, "objc-arc-apelim", "ObjC ARC autorelease pool elimination", false, false) Pass *llvm
LLVM Basic Block Representation.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
@ CallOrUser
could call objc_release and/or "use" pointers
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
Represent the analysis usage information of a pass.
static bool runImpl(const TargetLibraryInfo &TLI, Function &F)
ConstantArray - Constant Array Declarations.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ AutoreleasepoolPop
objc_autoreleasePoolPop
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
bool hasDefinitiveInitializer() const
hasDefinitiveInitializer - Whether the global variable has an initializer, and any other instances of...
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())
bool EnableARCOpts
A handy option to enable/disable all ARC Optimizations.
A Module instance is used to store all the information related to an LLVM module.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
amdgpu Simplify well known AMD library false FunctionCallee Callee
@ AutoreleasepoolPush
objc_autoreleasePoolPush
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
bool ModuleHasARC(const Module &M)
Test if the given module looks interesting to run ARC optimization on.
void initializeObjCARCAPElimPass(PassRegistry &)
Pass interface - Implemented by all 'passes'.
void preserveSet()
Mark an analysis set as preserved.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Pass * createObjCARCAPElimPass()
A container for analyses that lazily runs them and caches their results.
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
LLVM Value Representation.
A Use represents the edge between a Value definition and its users.