Changeset View
Changeset View
Standalone View
Standalone View
llvm/tools/opt/NewPMDriver.cpp
Show All 21 Lines | |||||
#include "llvm/Config/llvm-config.h" | #include "llvm/Config/llvm-config.h" | ||||
#include "llvm/IR/Dominators.h" | #include "llvm/IR/Dominators.h" | ||||
#include "llvm/IR/IRPrintingPasses.h" | #include "llvm/IR/IRPrintingPasses.h" | ||||
#include "llvm/IR/LLVMContext.h" | #include "llvm/IR/LLVMContext.h" | ||||
#include "llvm/IR/Module.h" | #include "llvm/IR/Module.h" | ||||
#include "llvm/IR/PassManager.h" | #include "llvm/IR/PassManager.h" | ||||
#include "llvm/IR/Verifier.h" | #include "llvm/IR/Verifier.h" | ||||
#include "llvm/Passes/PassBuilder.h" | #include "llvm/Passes/PassBuilder.h" | ||||
#include "llvm/Passes/PassPlugin.h" | #include "llvm/Passes/PassPluginRegistry.h" | ||||
#include "llvm/Passes/StandardInstrumentations.h" | #include "llvm/Passes/StandardInstrumentations.h" | ||||
#include "llvm/Support/ErrorHandling.h" | #include "llvm/Support/ErrorHandling.h" | ||||
#include "llvm/Support/ToolOutputFile.h" | #include "llvm/Support/ToolOutputFile.h" | ||||
#include "llvm/Target/TargetMachine.h" | #include "llvm/Target/TargetMachine.h" | ||||
#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h" | #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h" | ||||
#include "llvm/Transforms/Instrumentation/AddressSanitizer.h" | #include "llvm/Transforms/Instrumentation/AddressSanitizer.h" | ||||
#include "llvm/Transforms/Scalar/LoopPassManager.h" | #include "llvm/Transforms/Scalar/LoopPassManager.h" | ||||
#include "llvm/Transforms/Utils/Debugify.h" | #include "llvm/Transforms/Utils/Debugify.h" | ||||
▲ Show 20 Lines • Show All 244 Lines • ▼ Show 20 Lines | #define HANDLE_EXTENSION(Ext) \ | ||||
llvm::PassPluginLibraryInfo get##Ext##PluginInfo(); | llvm::PassPluginLibraryInfo get##Ext##PluginInfo(); | ||||
#include "llvm/Support/Extension.def" | #include "llvm/Support/Extension.def" | ||||
bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, | bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, | ||||
TargetLibraryInfoImpl *TLII, ToolOutputFile *Out, | TargetLibraryInfoImpl *TLII, ToolOutputFile *Out, | ||||
ToolOutputFile *ThinLTOLinkOut, | ToolOutputFile *ThinLTOLinkOut, | ||||
ToolOutputFile *OptRemarkFile, | ToolOutputFile *OptRemarkFile, | ||||
StringRef PassPipeline, ArrayRef<StringRef> Passes, | StringRef PassPipeline, ArrayRef<StringRef> Passes, | ||||
ArrayRef<PassPlugin> PassPlugins, | |||||
OutputKind OK, VerifierKind VK, | OutputKind OK, VerifierKind VK, | ||||
bool ShouldPreserveAssemblyUseListOrder, | bool ShouldPreserveAssemblyUseListOrder, | ||||
bool ShouldPreserveBitcodeUseListOrder, | bool ShouldPreserveBitcodeUseListOrder, | ||||
bool EmitSummaryIndex, bool EmitModuleHash, | bool EmitSummaryIndex, bool EmitModuleHash, | ||||
bool EnableDebugify, bool VerifyDIPreserve) { | bool EnableDebugify, bool VerifyDIPreserve) { | ||||
bool VerifyEachPass = VK == VK_VerifyEachPass; | bool VerifyEachPass = VK == VK_VerifyEachPass; | ||||
Optional<PGOOptions> P; | Optional<PGOOptions> P; | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, | ||||
// LoopUnrolling defaults on to true and DisableLoopUnrolling is initialized | // LoopUnrolling defaults on to true and DisableLoopUnrolling is initialized | ||||
// to false above so we shouldn't necessarily need to check whether or not the | // to false above so we shouldn't necessarily need to check whether or not the | ||||
// option has been enabled. | // option has been enabled. | ||||
PTO.LoopUnrolling = !DisableLoopUnrolling; | PTO.LoopUnrolling = !DisableLoopUnrolling; | ||||
PassBuilder PB(TM, PTO, P, &PIC); | PassBuilder PB(TM, PTO, P, &PIC); | ||||
registerEPCallbacks(PB); | registerEPCallbacks(PB); | ||||
// For any loaded plugins, let them register pass builder callbacks. | // For any loaded plugins, let them register pass builder callbacks. | ||||
for (auto &PassPlugin : PassPlugins) | for (auto &PassPlugin : PassPluginRegistry::getPlugins()) | ||||
PassPlugin.registerPassBuilderCallbacks(PB); | PassPlugin.registerPassBuilderCallbacks(PB); | ||||
PB.registerPipelineParsingCallback( | PB.registerPipelineParsingCallback( | ||||
[](StringRef Name, ModulePassManager &MPM, | [](StringRef Name, ModulePassManager &MPM, | ||||
ArrayRef<PassBuilder::PipelineElement>) { | ArrayRef<PassBuilder::PipelineElement>) { | ||||
AddressSanitizerOptions Opts; | AddressSanitizerOptions Opts; | ||||
if (Name == "asan-pipeline") { | if (Name == "asan-pipeline") { | ||||
MPM.addPass(ModuleAddressSanitizerPass(Opts)); | MPM.addPass(ModuleAddressSanitizerPass(Opts)); | ||||
▲ Show 20 Lines • Show All 162 Lines • Show Last 20 Lines |