diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2013-11-20 04:39:16 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2013-11-20 04:39:16 +0000 |
commit | d14894059fa4bbf67ae74caa64fa5f5a23272d63 (patch) | |
tree | 9e015381b517c86cec6ccc19312ef5254b75d821 /lib/IR/PassManager.cpp | |
parent | d23c759c0fa10b7fb244b4d2911b49b95138a7e1 (diff) | |
download | llvm-d14894059fa4bbf67ae74caa64fa5f5a23272d63.tar.gz llvm-d14894059fa4bbf67ae74caa64fa5f5a23272d63.tar.bz2 llvm-d14894059fa4bbf67ae74caa64fa5f5a23272d63.tar.xz |
[PM] Make the function pass manager more regular.
The FunctionPassManager is now itself a function pass. When run over
a function, it runs all N of its passes over that function. This is the
1:N mapping in the pass dimension only. This allows it to be used in
either a ModulePassManager or potentially some other manager that
works on IR units which are supersets of Functions.
This commit also adds the obvious adaptor to map from a module pass to
a function pass, running the function pass across every function in the
module.
The test has been updated to use this new pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/PassManager.cpp')
-rw-r--r-- | lib/IR/PassManager.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/IR/PassManager.cpp b/lib/IR/PassManager.cpp index b53a2b9671..35fc534151 100644 --- a/lib/IR/PassManager.cpp +++ b/lib/IR/PassManager.cpp @@ -53,15 +53,14 @@ void ModuleAnalysisManager::invalidateImpl(void *PassID, Module *M) { ModuleAnalysisResults.erase(PassID); } -bool FunctionPassManager::run(Module *M) { +bool FunctionPassManager::run(Function *F) { bool Changed = false; - for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) - for (unsigned Idx = 0, Size = Passes.size(); Idx != Size; ++Idx) - if (Passes[Idx]->run(I)) { - Changed = true; - if (AM) - AM->invalidateAll(I); - } + for (unsigned Idx = 0, Size = Passes.size(); Idx != Size; ++Idx) + if (Passes[Idx]->run(F)) { + Changed = true; + if (AM) + AM->invalidateAll(F); + } return Changed; } |