summaryrefslogtreecommitdiff
path: root/lib/VMCore/Pass.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-13 05:33:01 +0000
committerChris Lattner <sabre@nondot.org>2003-10-13 05:33:01 +0000
commit3e58d9bb320f247740672aeb3129c4755d02b599 (patch)
tree47c0f71fbf7a3ffc04996e8429f5eb8cb86436fa /lib/VMCore/Pass.cpp
parent4a650af59912110a246c0a041bff38c92f0e56a2 (diff)
downloadllvm-3e58d9bb320f247740672aeb3129c4755d02b599.tar.gz
llvm-3e58d9bb320f247740672aeb3129c4755d02b599.tar.bz2
llvm-3e58d9bb320f247740672aeb3129c4755d02b599.tar.xz
* Remove extraneous #includes
* Fix a nasty initializer ordering bug. Any only-CFG passes which registered themselves before the CFGOnlyAnalysis vector initialized got forgotten and thus got invalidated and recomputed. In particular, in my compiled version of gccas, the Loop information pass was being recomputed unnecessarily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Pass.cpp')
-rw-r--r--lib/VMCore/Pass.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp
index 0d25afc769..c9b97c879a 100644
--- a/lib/VMCore/Pass.cpp
+++ b/lib/VMCore/Pass.cpp
@@ -1,4 +1,4 @@
-//===- Pass.cpp - LLVM Pass Infrastructure Impementation ------------------===//
+//===- Pass.cpp - LLVM Pass Infrastructure Implementation -----------------===//
//
// This file implements the LLVM Pass infrastructure. It is primarily
// responsible with ensuring that passes are executed and batched together
@@ -11,9 +11,6 @@
#include "llvm/Module.h"
#include "Support/STLExtras.h"
#include "Support/TypeInfo.h"
-#include "Config/sys/resource.h"
-#include "Config/sys/time.h"
-#include "Config/unistd.h"
#include <set>
// IncludeFile - Stub function used to help linking out.
@@ -23,10 +20,15 @@ IncludeFile::IncludeFile(void*) {}
// AnalysisID Class Implementation
//
-static std::vector<const PassInfo*> CFGOnlyAnalyses;
+// getCFGOnlyAnalyses - A wrapper around the CFGOnlyAnalyses which make it
+// initializer order independent.
+static std::vector<const PassInfo*> &getCFGOnlyAnalyses() {
+ static std::vector<const PassInfo*> CFGOnlyAnalyses;
+ return CFGOnlyAnalyses;
+}
void RegisterPassBase::setOnlyUsesCFG() {
- CFGOnlyAnalyses.push_back(PIObj);
+ getCFGOnlyAnalyses().push_back(PIObj);
}
//===----------------------------------------------------------------------===//
@@ -56,7 +58,7 @@ void AnalysisUsage::setPreservesCFG() {
// that only depend on the CFG (like dominators, loop info, etc...)
//
Preserved.insert(Preserved.end(),
- CFGOnlyAnalyses.begin(), CFGOnlyAnalyses.end());
+ getCFGOnlyAnalyses().begin(), getCFGOnlyAnalyses().end());
}