Update the pass manager to allow for function creation in function passes.

Add interfaces and update the pass execution logic to allow function
passes to create new functions, or ask for functions to be optimized
prior to continuing.

Doing so results in the pass pipeline halting execution on the current
function, and continuing with newly added functions, returning to the
previous function after the newly added functions are fully optimized.
This commit is contained in:
Mark Lacey
2015-12-17 15:15:58 -08:00
parent b70af8ae08
commit dbde7cc4c1
3 changed files with 41 additions and 3 deletions

View File

@@ -92,6 +92,13 @@ public:
/// \brief Run one iteration of the optimization pipeline.
void runOneIteration();
/// \brief Add a function to the function pass worklist.
void addFunctionToWorklist(SILFunction *F) {
assert(F && F->isDefinition() && F->shouldOptimize() &&
"Expected optimizable function definition!");
FunctionWorklist.push_back(F);
}
/// \brief Broadcast the invalidation of the module to all analysis.
void invalidateAnalysis(SILAnalysis::InvalidationKind K) {
assert(K != SILAnalysis::InvalidationKind::Nothing &&