//===----------------------------------------------------------------------===//
#include "llvm/Pass.h"
-#include "llvm/PassManager.h"
#include "llvm/PassRegistry.h"
-#include "llvm/Module.h"
-#include "llvm/ADT/StringMap.h"
#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/PassNameParser.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/System/Atomic.h"
-#include "llvm/System/Mutex.h"
-#include "llvm/System/Threading.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
// Pass Implementation
//
-Pass::Pass(PassKind K, char &pid) : Resolver(0), PassID(&pid), Kind(K) { }
-
// Force out-of-line virtual method.
Pass::~Pass() {
delete Resolver;
return Resolver->getAnalysisIfAvailable(&AID, true) != 0;
}
-// dumpPassStructure - Implement the -debug-passes=Structure option
+// dumpPassStructure - Implement the -debug-pass=Structure option
void Pass::dumpPassStructure(unsigned Offset) {
dbgs().indent(Offset*2) << getPassName() << "\n";
}
return createPrintFunctionPass(Banner, &O);
}
-// run - On a function, we simply initialize, run the function, then finalize.
-//
-bool FunctionPass::run(Function &F) {
- // Passes are not run on external functions!
- if (F.isDeclaration()) return false;
-
- bool Changed = doInitialization(*F.getParent());
- Changed |= runOnFunction(F);
- return Changed | doFinalization(*F.getParent());
-}
-
bool FunctionPass::doInitialization(Module &) {
// By default, don't do anything.
return false;
return 0;
}
-// To run this pass on a function, we simply call runOnBasicBlock once for each
-// function.
-//
-bool BasicBlockPass::runOnFunction(Function &F) {
- bool Changed = doInitialization(F);
- for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
- Changed |= runOnBasicBlock(*I);
- return Changed | doFinalization(F);
-}
-
bool BasicBlockPass::doInitialization(Module &) {
// By default, don't do anything.
return false;
*this, isDefault);
}
-
//===----------------------------------------------------------------------===//
// PassRegistrationListener implementation
//