mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: Switch pass managers based on LegacyPassManager IRGenOptions flag
This commit is contained in:
@@ -216,9 +216,10 @@ void setModuleFlags(IRGenModule &IGM) {
|
||||
}
|
||||
}
|
||||
|
||||
void swift::performLLVMOptimizations(const IRGenOptions &Opts,
|
||||
llvm::Module *Module,
|
||||
llvm::TargetMachine *TargetMachine) {
|
||||
static void
|
||||
performOptimizationsUsingLegacyPassManger(const IRGenOptions &Opts,
|
||||
llvm::Module *Module,
|
||||
llvm::TargetMachine *TargetMachine) {
|
||||
// Set up a pipeline.
|
||||
PassManagerBuilderWrapper PMBuilder(Opts);
|
||||
|
||||
@@ -389,6 +390,20 @@ void swift::performLLVMOptimizations(const IRGenOptions &Opts,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
performOptimizationsUsingNewPassManger(const IRGenOptions &Opts,
|
||||
llvm::Module *Module,
|
||||
llvm::TargetMachine *TargetMachine) {}
|
||||
|
||||
void swift::performLLVMOptimizations(const IRGenOptions &Opts,
|
||||
llvm::Module *Module,
|
||||
llvm::TargetMachine *TargetMachine) {
|
||||
if (Opts.LegacyPassManager)
|
||||
performOptimizationsUsingLegacyPassManger(Opts, Module, TargetMachine);
|
||||
else
|
||||
performOptimizationsUsingNewPassManger(Opts, Module, TargetMachine);
|
||||
}
|
||||
|
||||
/// Computes the MD5 hash of the llvm \p Module including the compiler version
|
||||
/// and options which influence the compilation.
|
||||
static MD5::MD5Result getHashOfModule(const IRGenOptions &Opts,
|
||||
|
||||
Reference in New Issue
Block a user