Skip to content

Commit 30d69c2

Browse files
committed
[PM] Remove the old 'PassManager.h' header file at the top level of
LLVM's include tree and the use of using declarations to hide the 'legacy' namespace for the old pass manager. This undoes the primary modules-hostile change I made to keep out-of-tree targets building. I sent an email inquiring about whether this would be reasonable to do at this phase and people seemed fine with it, so making it a reality. This should allow us to start bootstrapping with modules to a certain extent along with making it easier to mix and match headers in general. The updates to any code for users of LLVM are very mechanical. Switch from including "llvm/PassManager.h" to "llvm/IR/LegacyPassManager.h". Qualify the types which now produce compile errors with "legacy::". The most common ones are "PassManager", "PassManagerBase", and "FunctionPassManager". llvm-svn: 229094
1 parent 24f5910 commit 30d69c2

File tree

65 files changed

+124
-180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+124
-180
lines changed

llvm/bindings/go/llvm/InstrumentationBindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
#include "InstrumentationBindings.h"
1515
#include "llvm-c/Core.h"
16+
#include "llvm/IR/LegacyPassManager.h"
1617
#include "llvm/IR/Module.h"
17-
#include "llvm/PassManager.h"
1818
#include "llvm/Transforms/Instrumentation.h"
1919

2020
using namespace llvm;

llvm/examples/ExceptionDemo/ExceptionDemo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
#include "llvm/IR/IRBuilder.h"
5757
#include "llvm/IR/Intrinsics.h"
5858
#include "llvm/IR/LLVMContext.h"
59+
#include "llvm/IR/LegacyPassManager.h"
5960
#include "llvm/IR/Module.h"
60-
#include "llvm/PassManager.h"
6161
#include "llvm/Support/Dwarf.h"
6262
#include "llvm/Support/TargetSelect.h"
6363
#include "llvm/Target/TargetOptions.h"

llvm/examples/Kaleidoscope/Chapter4/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include "llvm/IR/DerivedTypes.h"
77
#include "llvm/IR/IRBuilder.h"
88
#include "llvm/IR/LLVMContext.h"
9+
#include "llvm/IR/LegacyPassManager.h"
910
#include "llvm/IR/Module.h"
1011
#include "llvm/IR/Verifier.h"
11-
#include "llvm/PassManager.h"
1212
#include "llvm/Support/TargetSelect.h"
1313
#include "llvm/Transforms/Scalar.h"
1414
#include <cctype>

llvm/examples/Kaleidoscope/Chapter5/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include "llvm/IR/DerivedTypes.h"
77
#include "llvm/IR/IRBuilder.h"
88
#include "llvm/IR/LLVMContext.h"
9+
#include "llvm/IR/LegacyPassManager.h"
910
#include "llvm/IR/Module.h"
1011
#include "llvm/IR/Verifier.h"
11-
#include "llvm/PassManager.h"
1212
#include "llvm/Support/TargetSelect.h"
1313
#include "llvm/Transforms/Scalar.h"
1414
#include <cctype>

llvm/examples/Kaleidoscope/Chapter6/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include "llvm/IR/DerivedTypes.h"
77
#include "llvm/IR/IRBuilder.h"
88
#include "llvm/IR/LLVMContext.h"
9+
#include "llvm/IR/LegacyPassManager.h"
910
#include "llvm/IR/Module.h"
1011
#include "llvm/IR/Verifier.h"
11-
#include "llvm/PassManager.h"
1212
#include "llvm/Support/TargetSelect.h"
1313
#include "llvm/Transforms/Scalar.h"
1414
#include <cctype>

llvm/examples/Kaleidoscope/Chapter7/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include "llvm/IR/DerivedTypes.h"
77
#include "llvm/IR/IRBuilder.h"
88
#include "llvm/IR/LLVMContext.h"
9+
#include "llvm/IR/LegacyPassManager.h"
910
#include "llvm/IR/Module.h"
1011
#include "llvm/IR/Verifier.h"
11-
#include "llvm/PassManager.h"
1212
#include "llvm/Support/TargetSelect.h"
1313
#include "llvm/Transforms/Scalar.h"
1414
#include <cctype>

llvm/examples/Kaleidoscope/Chapter8/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#include "llvm/IR/DerivedTypes.h"
99
#include "llvm/IR/IRBuilder.h"
1010
#include "llvm/IR/LLVMContext.h"
11+
#include "llvm/IR/LegacyPassManager.h"
1112
#include "llvm/IR/Module.h"
1213
#include "llvm/IR/Verifier.h"
13-
#include "llvm/PassManager.h"
1414
#include "llvm/Support/Host.h"
1515
#include "llvm/Support/TargetSelect.h"
1616
#include "llvm/Transforms/Scalar.h"

llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#include "llvm/IR/DerivedTypes.h"
77
#include "llvm/IR/IRBuilder.h"
88
#include "llvm/IR/LLVMContext.h"
9+
#include "llvm/IR/LegacyPassManager.h"
910
#include "llvm/IR/Module.h"
1011
#include "llvm/IR/Verifier.h"
1112
#include "llvm/IRReader/IRReader.h"
12-
#include "llvm/PassManager.h"
1313
#include "llvm/Support/CommandLine.h"
1414
#include "llvm/Support/SourceMgr.h"
1515
#include "llvm/Support/TargetSelect.h"

llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
#include "llvm/IR/DerivedTypes.h"
1010
#include "llvm/IR/IRBuilder.h"
1111
#include "llvm/IR/LLVMContext.h"
12+
#include "llvm/IR/LegacyPassManager.h"
1213
#include "llvm/IR/Module.h"
1314
#include "llvm/IR/Verifier.h"
1415
#include "llvm/IRReader/IRReader.h"
15-
#include "llvm/PassManager.h"
1616
#include "llvm/Support/CommandLine.h"
1717
#include "llvm/Support/FileSystem.h"
1818
#include "llvm/Support/Path.h"

llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#include "llvm/IR/DerivedTypes.h"
88
#include "llvm/IR/IRBuilder.h"
99
#include "llvm/IR/LLVMContext.h"
10+
#include "llvm/IR/LegacyPassManager.h"
1011
#include "llvm/IR/Module.h"
1112
#include "llvm/IR/Verifier.h"
1213
#include "llvm/IRReader/IRReader.h"
13-
#include "llvm/PassManager.h"
1414
#include "llvm/Support/CommandLine.h"
1515
#include "llvm/Support/FileSystem.h"
1616
#include "llvm/Support/Path.h"

llvm/examples/Kaleidoscope/MCJIT/initial/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include "llvm/IR/DerivedTypes.h"
77
#include "llvm/IR/IRBuilder.h"
88
#include "llvm/IR/LLVMContext.h"
9+
#include "llvm/IR/LegacyPassManager.h"
910
#include "llvm/IR/Module.h"
1011
#include "llvm/IR/Verifier.h"
11-
#include "llvm/PassManager.h"
1212
#include "llvm/Support/TargetSelect.h"
1313
#include "llvm/Transforms/Scalar.h"
1414
#include <cctype>

llvm/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include "llvm/IR/DerivedTypes.h"
77
#include "llvm/IR/IRBuilder.h"
88
#include "llvm/IR/LLVMContext.h"
9+
#include "llvm/IR/LegacyPassManager.h"
910
#include "llvm/IR/Module.h"
1011
#include "llvm/IR/Verifier.h"
11-
#include "llvm/PassManager.h"
1212
#include "llvm/Support/TargetSelect.h"
1313
#include "llvm/Transforms/Scalar.h"
1414
#include <cctype>

llvm/examples/Kaleidoscope/MCJIT/lazy/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#include "llvm/IR/DerivedTypes.h"
99
#include "llvm/IR/IRBuilder.h"
1010
#include "llvm/IR/LLVMContext.h"
11+
#include "llvm/IR/LegacyPassManager.h"
1112
#include "llvm/IR/Module.h"
1213
#include "llvm/IR/Verifier.h"
13-
#include "llvm/PassManager.h"
1414
#include "llvm/Support/TargetSelect.h"
1515
#include "llvm/Transforms/Scalar.h"
1616
#include <cctype>

llvm/examples/Kaleidoscope/Orc/initial/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#include "llvm/IR/DerivedTypes.h"
99
#include "llvm/IR/IRBuilder.h"
1010
#include "llvm/IR/LLVMContext.h"
11+
#include "llvm/IR/LegacyPassManager.h"
1112
#include "llvm/IR/Module.h"
1213
#include "llvm/IR/Verifier.h"
13-
#include "llvm/PassManager.h"
1414
#include "llvm/Support/TargetSelect.h"
1515
#include "llvm/Transforms/Scalar.h"
1616
#include <cctype>

llvm/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include "llvm/IR/DerivedTypes.h"
88
#include "llvm/IR/IRBuilder.h"
99
#include "llvm/IR/LLVMContext.h"
10+
#include "llvm/IR/LegacyPassManager.h"
1011
#include "llvm/IR/Module.h"
1112
#include "llvm/IR/Verifier.h"
12-
#include "llvm/PassManager.h"
1313
#include "llvm/Support/TargetSelect.h"
1414
#include "llvm/Transforms/Scalar.h"
1515
#include <cctype>

llvm/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include "llvm/IR/DerivedTypes.h"
88
#include "llvm/IR/IRBuilder.h"
99
#include "llvm/IR/LLVMContext.h"
10+
#include "llvm/IR/LegacyPassManager.h"
1011
#include "llvm/IR/Module.h"
1112
#include "llvm/IR/Verifier.h"
12-
#include "llvm/PassManager.h"
1313
#include "llvm/Support/TargetSelect.h"
1414
#include "llvm/Transforms/Scalar.h"
1515
#include <cctype>

llvm/include/llvm/ExecutionEngine/Orc/CompileUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#define LLVM_EXECUTIONENGINE_ORC_COMPILEUTILS_H
1616

1717
#include "llvm/ExecutionEngine/ObjectMemoryBuffer.h"
18+
#include "llvm/IR/LegacyPassManager.h"
1819
#include "llvm/MC/MCContext.h"
1920
#include "llvm/Object/ObjectFile.h"
20-
#include "llvm/PassManager.h"
2121
#include "llvm/Target/TargetMachine.h"
2222

2323
namespace llvm {
@@ -34,7 +34,7 @@ class SimpleCompiler {
3434
SmallVector<char, 0> ObjBufferSV;
3535
raw_svector_ostream ObjStream(ObjBufferSV);
3636

37-
PassManager PM;
37+
legacy::PassManager PM;
3838
MCContext *Ctx;
3939
if (TM.addPassesToEmitMC(PM, Ctx, ObjStream))
4040
llvm_unreachable("Target does not support MC emission.");

llvm/include/llvm/PassManager.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ namespace legacy {
2727
class FunctionPassManager;
2828
class PassManagerBase;
2929
}
30-
using legacy::FunctionPassManager;
31-
using legacy::PassManagerBase;
3230

3331
/// PassManagerBuilder - This class is used to set up a standard optimization
3432
/// sequence for languages like C and C++, allowing some APIs to customize the
@@ -59,7 +57,7 @@ class PassManagerBuilder {
5957
/// Extensions are passed the builder itself (so they can see how it is
6058
/// configured) as well as the pass manager to add stuff to.
6159
typedef void (*ExtensionFn)(const PassManagerBuilder &Builder,
62-
PassManagerBase &PM);
60+
legacy::PassManagerBase &PM);
6361
enum ExtensionPointTy {
6462
/// EP_EarlyAsPossible - This extension point allows adding passes before
6563
/// any other transformations, allowing them to see the code as it is coming
@@ -139,19 +137,20 @@ class PassManagerBuilder {
139137
void addExtension(ExtensionPointTy Ty, ExtensionFn Fn);
140138

141139
private:
142-
void addExtensionsToPM(ExtensionPointTy ETy, PassManagerBase &PM) const;
143-
void addInitialAliasAnalysisPasses(PassManagerBase &PM) const;
144-
void addLTOOptimizationPasses(PassManagerBase &PM);
140+
void addExtensionsToPM(ExtensionPointTy ETy,
141+
legacy::PassManagerBase &PM) const;
142+
void addInitialAliasAnalysisPasses(legacy::PassManagerBase &PM) const;
143+
void addLTOOptimizationPasses(legacy::PassManagerBase &PM);
145144

146145
public:
147146
/// populateFunctionPassManager - This fills in the function pass manager,
148147
/// which is expected to be run on each function immediately as it is
149148
/// generated. The idea is to reduce the size of the IR in memory.
150-
void populateFunctionPassManager(FunctionPassManager &FPM);
149+
void populateFunctionPassManager(legacy::FunctionPassManager &FPM);
151150

152151
/// populateModulePassManager - This sets up the primary pass manager.
153-
void populateModulePassManager(PassManagerBase &MPM);
154-
void populateLTOPassManager(PassManagerBase &PM);
152+
void populateModulePassManager(legacy::PassManagerBase &MPM);
153+
void populateLTOPassManager(legacy::PassManagerBase &PM);
155154
};
156155

157156
/// Registers a function for adding a standard set of passes. This should be

llvm/include/llvm/module.modulemap

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,11 @@ module LLVM_IR {
7171
umbrella "IR"
7272
module * { export * }
7373

74-
// We cannot have llvm/PassManager.h and llvm/IR/PassManager.h in the same TU,
75-
// so we can't include llvm/IR/PassManager.h in the IR module.
76-
exclude header "IR/PassManager.h"
77-
exclude header "IR/LegacyPassManager.h"
78-
7974
// These are intended for (repeated) textual inclusion.
8075
textual header "IR/Instruction.def"
8176
textual header "IR/Metadata.def"
8277
}
8378

84-
module LLVM_LegacyPassManager {
85-
requires cplusplus
86-
module CompatInterface { header "PassManager.h" export * }
87-
module Implementation { header "IR/LegacyPassManager.h" export * }
88-
}
89-
90-
module LLVM_IR_PassManager {
91-
requires cplusplus
92-
// FIXME PR19358: This doesn't work! conflict LLVM_LegacyPassManager, "cannot use legacy pass manager and new pass manager in same file"
93-
header "IR/PassManager.h"
94-
export *
95-
}
96-
9779
module LLVM_IRReader { requires cplusplus umbrella "IRReader" module * { export * } }
9880
module LLVM_LineEditor { requires cplusplus umbrella "LineEditor" module * { export * } }
9981
module LLVM_LTO { requires cplusplus umbrella "LTO" module * { export * } }

llvm/lib/Analysis/Lint.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
#include "llvm/IR/Function.h"
5252
#include "llvm/IR/InstVisitor.h"
5353
#include "llvm/IR/IntrinsicInst.h"
54+
#include "llvm/IR/LegacyPassManager.h"
5455
#include "llvm/Pass.h"
55-
#include "llvm/PassManager.h"
5656
#include "llvm/Support/Debug.h"
5757
#include "llvm/Support/raw_ostream.h"
5858
using namespace llvm;
@@ -903,7 +903,7 @@ void llvm::lintFunction(const Function &f) {
903903
Function &F = const_cast<Function&>(f);
904904
assert(!F.isDeclaration() && "Cannot lint external functions");
905905

906-
FunctionPassManager FPM(F.getParent());
906+
legacy::FunctionPassManager FPM(F.getParent());
907907
Lint *V = new Lint();
908908
FPM.add(V);
909909
FPM.run(F);
@@ -912,7 +912,7 @@ void llvm::lintFunction(const Function &f) {
912912
/// lintModule - Check a module for errors, printing messages on stderr.
913913
///
914914
void llvm::lintModule(const Module &M) {
915-
PassManager PM;
915+
legacy::PassManager PM;
916916
Lint *V = new Lint();
917917
PM.add(V);
918918
PM.run(const_cast<Module&>(M));

llvm/lib/CodeGen/LLVMTargetMachine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
#include "llvm/CodeGen/MachineModuleInfo.h"
2323
#include "llvm/CodeGen/Passes.h"
2424
#include "llvm/IR/IRPrintingPasses.h"
25+
#include "llvm/IR/LegacyPassManager.h"
2526
#include "llvm/IR/Verifier.h"
2627
#include "llvm/MC/MCAsmInfo.h"
2728
#include "llvm/MC/MCContext.h"
2829
#include "llvm/MC/MCInstrInfo.h"
2930
#include "llvm/MC/MCStreamer.h"
3031
#include "llvm/MC/MCSubtargetInfo.h"
31-
#include "llvm/PassManager.h"
3232
#include "llvm/Support/CommandLine.h"
3333
#include "llvm/Support/ErrorHandling.h"
3434
#include "llvm/Support/FormattedStream.h"

llvm/lib/CodeGen/Passes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
#include "llvm/CodeGen/MachineFunctionPass.h"
1818
#include "llvm/CodeGen/RegAllocRegistry.h"
1919
#include "llvm/IR/IRPrintingPasses.h"
20+
#include "llvm/IR/LegacyPassManager.h"
2021
#include "llvm/IR/Verifier.h"
2122
#include "llvm/MC/MCAsmInfo.h"
22-
#include "llvm/PassManager.h"
2323
#include "llvm/Support/CommandLine.h"
2424
#include "llvm/Support/Debug.h"
2525
#include "llvm/Support/ErrorHandling.h"

llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
#include "llvm/IR/DataLayout.h"
1616
#include "llvm/IR/DerivedTypes.h"
1717
#include "llvm/IR/Function.h"
18+
#include "llvm/IR/LegacyPassManager.h"
1819
#include "llvm/IR/Mangler.h"
1920
#include "llvm/IR/Module.h"
2021
#include "llvm/MC/MCAsmInfo.h"
2122
#include "llvm/Object/Archive.h"
2223
#include "llvm/Object/ObjectFile.h"
23-
#include "llvm/PassManager.h"
2424
#include "llvm/Support/DynamicLibrary.h"
2525
#include "llvm/Support/ErrorHandling.h"
2626
#include "llvm/Support/MemoryBuffer.h"
@@ -135,7 +135,7 @@ std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) {
135135
// MCJIT instance, since these conditions are tested by our caller,
136136
// generateCodeForModule.
137137

138-
PassManager PM;
138+
legacy::PassManager PM;
139139

140140
M->setDataLayout(TM->getDataLayout());
141141
PM.add(new DataLayoutPass());

0 commit comments

Comments
 (0)