* 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.

llvm-svn: 9074
This commit is contained in:
Chris Lattner 2003-10-13 05:33:01 +00:00
parent 178957028b
commit ab16a659d7
1 changed files with 9 additions and 7 deletions

View File

@ -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 // This file implements the LLVM Pass infrastructure. It is primarily
// responsible with ensuring that passes are executed and batched together // responsible with ensuring that passes are executed and batched together
@ -11,9 +11,6 @@
#include "llvm/Module.h" #include "llvm/Module.h"
#include "Support/STLExtras.h" #include "Support/STLExtras.h"
#include "Support/TypeInfo.h" #include "Support/TypeInfo.h"
#include "Config/sys/resource.h"
#include "Config/sys/time.h"
#include "Config/unistd.h"
#include <set> #include <set>
// IncludeFile - Stub function used to help linking out. // IncludeFile - Stub function used to help linking out.
@ -23,10 +20,15 @@ IncludeFile::IncludeFile(void*) {}
// AnalysisID Class Implementation // 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() { 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...) // that only depend on the CFG (like dominators, loop info, etc...)
// //
Preserved.insert(Preserved.end(), Preserved.insert(Preserved.end(),
CFGOnlyAnalyses.begin(), CFGOnlyAnalyses.end()); getCFGOnlyAnalyses().begin(), getCFGOnlyAnalyses().end());
} }