summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/PassManager.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-11-20 04:39:16 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-11-20 04:39:16 +0000
commitd895e29e88387d97dad1ef2d26184145e4029c56 (patch)
tree4786990b9fbdfe0f1bfb2d628515451f9b4b03be /llvm/lib/IR/PassManager.cpp
parentbabe7491255b8b4af57805c92237977f5d466288 (diff)
downloadbcm5719-llvm-d895e29e88387d97dad1ef2d26184145e4029c56.tar.gz
bcm5719-llvm-d895e29e88387d97dad1ef2d26184145e4029c56.zip
[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. llvm-svn: 195192
Diffstat (limited to 'llvm/lib/IR/PassManager.cpp')
-rw-r--r--llvm/lib/IR/PassManager.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/IR/PassManager.cpp b/llvm/lib/IR/PassManager.cpp
index b53a2b9671d..35fc534151a 100644
--- a/llvm/lib/IR/PassManager.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud