forked from OSchip/llvm-project
[PM] Move away from the old llvm/PassManager.h header and its using
declarations and just use the legacy namespace qualifier in this file and the permanent header name. The old wrapper header is going away to make LLVM's build more modular, and without updating Clang I can't easily start to add usage of the new pass manager to Clang. This should make it more clear in the code which set of types is doing what. llvm-svn: 229090
This commit is contained in:
parent
1f832f7c27
commit
8f4f5090b4
|
@ -25,7 +25,7 @@
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/IR/Verifier.h"
|
#include "llvm/IR/Verifier.h"
|
||||||
#include "llvm/MC/SubtargetFeature.h"
|
#include "llvm/MC/SubtargetFeature.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/IR/LegacyPassManager.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/PrettyStackTrace.h"
|
#include "llvm/Support/PrettyStackTrace.h"
|
||||||
|
@ -56,9 +56,9 @@ class EmitAssemblyHelper {
|
||||||
|
|
||||||
Timer CodeGenerationTime;
|
Timer CodeGenerationTime;
|
||||||
|
|
||||||
mutable PassManager *CodeGenPasses;
|
mutable legacy::PassManager *CodeGenPasses;
|
||||||
mutable PassManager *PerModulePasses;
|
mutable legacy::PassManager *PerModulePasses;
|
||||||
mutable FunctionPassManager *PerFunctionPasses;
|
mutable legacy::FunctionPassManager *PerFunctionPasses;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TargetIRAnalysis getTargetIRAnalysis() const {
|
TargetIRAnalysis getTargetIRAnalysis() const {
|
||||||
|
@ -68,9 +68,9 @@ private:
|
||||||
return TargetIRAnalysis();
|
return TargetIRAnalysis();
|
||||||
}
|
}
|
||||||
|
|
||||||
PassManager *getCodeGenPasses() const {
|
legacy::PassManager *getCodeGenPasses() const {
|
||||||
if (!CodeGenPasses) {
|
if (!CodeGenPasses) {
|
||||||
CodeGenPasses = new PassManager();
|
CodeGenPasses = new legacy::PassManager();
|
||||||
CodeGenPasses->add(new DataLayoutPass());
|
CodeGenPasses->add(new DataLayoutPass());
|
||||||
CodeGenPasses->add(
|
CodeGenPasses->add(
|
||||||
createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
|
createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
|
||||||
|
@ -78,9 +78,9 @@ private:
|
||||||
return CodeGenPasses;
|
return CodeGenPasses;
|
||||||
}
|
}
|
||||||
|
|
||||||
PassManager *getPerModulePasses() const {
|
legacy::PassManager *getPerModulePasses() const {
|
||||||
if (!PerModulePasses) {
|
if (!PerModulePasses) {
|
||||||
PerModulePasses = new PassManager();
|
PerModulePasses = new legacy::PassManager();
|
||||||
PerModulePasses->add(new DataLayoutPass());
|
PerModulePasses->add(new DataLayoutPass());
|
||||||
PerModulePasses->add(
|
PerModulePasses->add(
|
||||||
createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
|
createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
|
||||||
|
@ -88,9 +88,9 @@ private:
|
||||||
return PerModulePasses;
|
return PerModulePasses;
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionPassManager *getPerFunctionPasses() const {
|
legacy::FunctionPassManager *getPerFunctionPasses() const {
|
||||||
if (!PerFunctionPasses) {
|
if (!PerFunctionPasses) {
|
||||||
PerFunctionPasses = new FunctionPassManager(TheModule);
|
PerFunctionPasses = new legacy::FunctionPassManager(TheModule);
|
||||||
PerFunctionPasses->add(new DataLayoutPass());
|
PerFunctionPasses->add(new DataLayoutPass());
|
||||||
PerFunctionPasses->add(
|
PerFunctionPasses->add(
|
||||||
createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
|
createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
|
||||||
|
@ -171,7 +171,7 @@ static void addObjCARCOptPass(const PassManagerBuilder &Builder, PassManagerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addSampleProfileLoaderPass(const PassManagerBuilder &Builder,
|
static void addSampleProfileLoaderPass(const PassManagerBuilder &Builder,
|
||||||
PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
const PassManagerBuilderWrapper &BuilderWrapper =
|
const PassManagerBuilderWrapper &BuilderWrapper =
|
||||||
static_cast<const PassManagerBuilderWrapper &>(Builder);
|
static_cast<const PassManagerBuilderWrapper &>(Builder);
|
||||||
const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
|
const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
|
||||||
|
@ -179,17 +179,17 @@ static void addSampleProfileLoaderPass(const PassManagerBuilder &Builder,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addAddDiscriminatorsPass(const PassManagerBuilder &Builder,
|
static void addAddDiscriminatorsPass(const PassManagerBuilder &Builder,
|
||||||
PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
PM.add(createAddDiscriminatorsPass());
|
PM.add(createAddDiscriminatorsPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
|
static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
|
||||||
PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
PM.add(createBoundsCheckingPass());
|
PM.add(createBoundsCheckingPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addSanitizerCoveragePass(const PassManagerBuilder &Builder,
|
static void addSanitizerCoveragePass(const PassManagerBuilder &Builder,
|
||||||
PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
const PassManagerBuilderWrapper &BuilderWrapper =
|
const PassManagerBuilderWrapper &BuilderWrapper =
|
||||||
static_cast<const PassManagerBuilderWrapper&>(Builder);
|
static_cast<const PassManagerBuilderWrapper&>(Builder);
|
||||||
const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
|
const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
|
||||||
|
@ -197,13 +197,13 @@ static void addSanitizerCoveragePass(const PassManagerBuilder &Builder,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addAddressSanitizerPasses(const PassManagerBuilder &Builder,
|
static void addAddressSanitizerPasses(const PassManagerBuilder &Builder,
|
||||||
PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
PM.add(createAddressSanitizerFunctionPass());
|
PM.add(createAddressSanitizerFunctionPass());
|
||||||
PM.add(createAddressSanitizerModulePass());
|
PM.add(createAddressSanitizerModulePass());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addMemorySanitizerPass(const PassManagerBuilder &Builder,
|
static void addMemorySanitizerPass(const PassManagerBuilder &Builder,
|
||||||
PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
const PassManagerBuilderWrapper &BuilderWrapper =
|
const PassManagerBuilderWrapper &BuilderWrapper =
|
||||||
static_cast<const PassManagerBuilderWrapper&>(Builder);
|
static_cast<const PassManagerBuilderWrapper&>(Builder);
|
||||||
const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
|
const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
|
||||||
|
@ -223,12 +223,12 @@ static void addMemorySanitizerPass(const PassManagerBuilder &Builder,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addThreadSanitizerPass(const PassManagerBuilder &Builder,
|
static void addThreadSanitizerPass(const PassManagerBuilder &Builder,
|
||||||
PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
PM.add(createThreadSanitizerPass());
|
PM.add(createThreadSanitizerPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addDataFlowSanitizerPass(const PassManagerBuilder &Builder,
|
static void addDataFlowSanitizerPass(const PassManagerBuilder &Builder,
|
||||||
PassManagerBase &PM) {
|
legacy::PassManagerBase &PM) {
|
||||||
const PassManagerBuilderWrapper &BuilderWrapper =
|
const PassManagerBuilderWrapper &BuilderWrapper =
|
||||||
static_cast<const PassManagerBuilderWrapper&>(Builder);
|
static_cast<const PassManagerBuilderWrapper&>(Builder);
|
||||||
const LangOptions &LangOpts = BuilderWrapper.getLangOpts();
|
const LangOptions &LangOpts = BuilderWrapper.getLangOpts();
|
||||||
|
@ -244,7 +244,7 @@ static TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addSymbolRewriterPass(const CodeGenOptions &Opts,
|
static void addSymbolRewriterPass(const CodeGenOptions &Opts,
|
||||||
PassManager *MPM) {
|
legacy::PassManager *MPM) {
|
||||||
llvm::SymbolRewriter::RewriteDescriptorList DL;
|
llvm::SymbolRewriter::RewriteDescriptorList DL;
|
||||||
|
|
||||||
llvm::SymbolRewriter::RewriteMapParser MapParser;
|
llvm::SymbolRewriter::RewriteMapParser MapParser;
|
||||||
|
@ -359,13 +359,13 @@ void EmitAssemblyHelper::CreatePasses() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the per-function pass manager.
|
// Set up the per-function pass manager.
|
||||||
FunctionPassManager *FPM = getPerFunctionPasses();
|
legacy::FunctionPassManager *FPM = getPerFunctionPasses();
|
||||||
if (CodeGenOpts.VerifyModule)
|
if (CodeGenOpts.VerifyModule)
|
||||||
FPM->add(createVerifierPass());
|
FPM->add(createVerifierPass());
|
||||||
PMBuilder.populateFunctionPassManager(*FPM);
|
PMBuilder.populateFunctionPassManager(*FPM);
|
||||||
|
|
||||||
// Set up the per-module pass manager.
|
// Set up the per-module pass manager.
|
||||||
PassManager *MPM = getPerModulePasses();
|
legacy::PassManager *MPM = getPerModulePasses();
|
||||||
if (!CodeGenOpts.RewriteMapFiles.empty())
|
if (!CodeGenOpts.RewriteMapFiles.empty())
|
||||||
addSymbolRewriterPass(CodeGenOpts, MPM);
|
addSymbolRewriterPass(CodeGenOpts, MPM);
|
||||||
if (CodeGenOpts.VerifyModule)
|
if (CodeGenOpts.VerifyModule)
|
||||||
|
@ -547,7 +547,7 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
|
||||||
formatted_raw_ostream &OS) {
|
formatted_raw_ostream &OS) {
|
||||||
|
|
||||||
// Create the code generator passes.
|
// Create the code generator passes.
|
||||||
PassManager *PM = getCodeGenPasses();
|
legacy::PassManager *PM = getCodeGenPasses();
|
||||||
|
|
||||||
// Add LibraryInfo.
|
// Add LibraryInfo.
|
||||||
llvm::Triple TargetTriple(TheModule->getTargetTriple());
|
llvm::Triple TargetTriple(TheModule->getTargetTriple());
|
||||||
|
|
Loading…
Reference in New Issue