1. Add a header guard for RegisterPasses.h to prevent multiple inclusion.

2. Include the helper function and the helper class in the RegisterPasses.h into the polly namespace.

llvm-svn: 155636
This commit is contained in:
Hongbin Zheng 2012-04-26 13:55:33 +00:00
parent f91c441e72
commit 746eefeddd
2 changed files with 10 additions and 3 deletions

View File

@ -11,10 +11,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef POLLY_REGISTER_PASSES_H
#define POLLY_REGISTER_PASSES_H
namespace llvm { namespace llvm {
class PassManagerBase; class PassManagerBase;
} }
namespace polly {
// Register the Polly preoptimization passes. Preoptimizations are used to // Register the Polly preoptimization passes. Preoptimizations are used to
// prepare the LLVM-IR for Polly. They increase the amount of code that can be // prepare the LLVM-IR for Polly. They increase the amount of code that can be
// optimized. // optimized.
@ -24,3 +27,5 @@ void registerPollyPreoptPasses(llvm::PassManagerBase &PM);
// Register the Polly optimizer (including its preoptimizations). // Register the Polly optimizer (including its preoptimizations).
void registerPollyPasses(llvm::PassManagerBase &PM, void registerPollyPasses(llvm::PassManagerBase &PM,
bool DisableCodegen = false); bool DisableCodegen = false);
}
#endif

View File

@ -105,7 +105,7 @@ CFGPrinter("polly-view-cfg",
cl::Hidden, cl::Hidden,
cl::init(false)); cl::init(false));
void initializePollyPasses(PassRegistry &Registry) { static void initializePollyPasses(PassRegistry &Registry) {
initializeCloogInfoPass(Registry); initializeCloogInfoPass(Registry);
initializeCodeGenerationPass(Registry); initializeCodeGenerationPass(Registry);
initializeCodePreparationPass(Registry); initializeCodePreparationPass(Registry);
@ -125,6 +125,7 @@ void initializePollyPasses(PassRegistry &Registry) {
initializeTempScopInfoPass(Registry); initializeTempScopInfoPass(Registry);
} }
namespace {
// Statically register all Polly passes such that they are available after // Statically register all Polly passes such that they are available after
// loading Polly. // loading Polly.
class StaticInitializer { class StaticInitializer {
@ -135,10 +136,11 @@ public:
initializePollyPasses(Registry); initializePollyPasses(Registry);
} }
}; };
} // end of anonymous namespace.
static StaticInitializer InitializeEverything; static StaticInitializer InitializeEverything;
void registerPollyPreoptPasses(llvm::PassManagerBase &PM) { void polly::registerPollyPreoptPasses(llvm::PassManagerBase &PM) {
// A standard set of optimization passes partially taken/copied from the // A standard set of optimization passes partially taken/copied from the
// set of default optimization passes. It is used to bring the code into // set of default optimization passes. It is used to bring the code into
// a canonical form that can than be analyzed by Polly. This set of passes is // a canonical form that can than be analyzed by Polly. This set of passes is
@ -170,7 +172,7 @@ void registerPollyPreoptPasses(llvm::PassManagerBase &PM) {
PM.add(polly::createRegionSimplifyPass()); PM.add(polly::createRegionSimplifyPass());
} }
void registerPollyPasses(llvm::PassManagerBase &PM, bool DisableCodegen) { void polly::registerPollyPasses(llvm::PassManagerBase &PM, bool DisableCodegen) {
bool RunCodegen = !DisableCodegen; bool RunCodegen = !DisableCodegen;
registerPollyPreoptPasses(PM); registerPollyPreoptPasses(PM);