BumpPtrAllocator &Allocator;
private:
- /// This method will do fixpoint iteration until fixpoint or the
- /// maximum iteration count is reached.
- ///
- /// If the maximum iteration count is reached, This method will
- /// indicate pessimistic fixpoint on attributes that transitively depend
- /// on attributes that were scheduled for an update.
- void runTillFixpoint();
-
- /// Gets called after scheduling, manifests attributes to the LLVM IR.
- ChangeStatus manifestAttributes();
-
- /// Gets called after attributes have been manifested, cleans up the IR.
- /// Deletes dead functions, blocks and instructions.
- /// Rewrites function signitures and updates the call graph.
- ChangeStatus cleanupIR();
-
/// Run `::update` on \p AA and track the dependences queried while doing so.
/// Also adjust the state if we know further updates are not necessary.
ChangeStatus updateAA(AbstractAttribute &AA);
return true;
}
-void Attributor::runTillFixpoint() {
+ChangeStatus Attributor::run() {
LLVM_DEBUG(dbgs() << "[Attributor] Identified and initialized "
<< AllAbstractAttributes.size()
<< " abstract attributes.\n");
<< IterationCounter << "/" << MaxFixpointIterations
<< " iterations\n");
+ size_t NumFinalAAs = AllAbstractAttributes.size();
+
// Reset abstract arguments not settled in a sound fixpoint by now. This
// happens when we stopped the fixpoint iteration early. Note that only the
// ones marked as "changed" *and* the ones transitively depending on them
<< " abstract attributes.\n";
});
- if (VerifyMaxFixpointIterations &&
- IterationCounter != MaxFixpointIterations) {
- errs() << "\n[Attributor] Fixpoint iteration done after: "
- << IterationCounter << "/" << MaxFixpointIterations
- << " iterations\n";
- llvm_unreachable("The fixpoint was not reached with exactly the number of "
- "specified iterations!");
- }
-}
-
-ChangeStatus Attributor::manifestAttributes() {
- size_t NumFinalAAs = AllAbstractAttributes.size();
-
unsigned NumManifested = 0;
unsigned NumAtFixpoint = 0;
ChangeStatus ManifestChange = ChangeStatus::UNCHANGED;
llvm_unreachable("Expected the final number of abstract attributes to "
"remain unchanged!");
}
- return ManifestChange;
-}
-ChangeStatus Attributor::cleanupIR() {
// Delete stuff at the end to avoid invalid references and a nice order.
+ {
LLVM_DEBUG(dbgs() << "\n[Attributor] Delete at least "
<< ToBeDeletedFunctions.size() << " functions and "
<< ToBeDeletedBlocks.size() << " blocks and "
FoundDeadFn = true;
}
}
+ }
// Rewrite the functions as requested during manifest.
- ChangeStatus ManifestChange =
- rewriteFunctionSignatures(CGModifiedFunctions);
+ ManifestChange =
+ ManifestChange | rewriteFunctionSignatures(CGModifiedFunctions);
- for (Function *Fn : CGModifiedFunctions)
- CGUpdater.reanalyzeFunction(*Fn);
+ for (Function *Fn : CGModifiedFunctions)
+ CGUpdater.reanalyzeFunction(*Fn);
- for (Function *Fn : ToBeDeletedFunctions)
- CGUpdater.removeFunction(*Fn);
+ for (Function *Fn : ToBeDeletedFunctions)
+ CGUpdater.removeFunction(*Fn);
- NumFnDeleted += ToBeDeletedFunctions.size();
+ NumFnDeleted += ToBeDeletedFunctions.size();
+
+ if (VerifyMaxFixpointIterations &&
+ IterationCounter != MaxFixpointIterations) {
+ errs() << "\n[Attributor] Fixpoint iteration done after: "
+ << IterationCounter << "/" << MaxFixpointIterations
+ << " iterations\n";
+ llvm_unreachable("The fixpoint was not reached with exactly the number of "
+ "specified iterations!");
+ }
#ifdef EXPENSIVE_CHECKS
for (Function *F : Functions) {
return ManifestChange;
}
-ChangeStatus Attributor::run() {
- runTillFixpoint();
- ChangeStatus ManifestChange = manifestAttributes();
- ChangeStatus CleanupChange = cleanupIR();
- return ManifestChange | CleanupChange;
-}
-
ChangeStatus Attributor::updateAA(AbstractAttribute &AA) {
// Use a new dependence vector for this update.
DependenceVector DV;