Skip to content

Commit be08be5

Browse files
committed
Revert "[CMake/Bazel] Support usage of opt driver as a library (#79205)"
This reverts commit 32f7922. Doesn't build, see #79205 (comment)
1 parent 048041f commit be08be5

File tree

6 files changed

+922
-972
lines changed

6 files changed

+922
-972
lines changed

llvm/tools/opt/CMakeLists.txt

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,12 @@ set(LLVM_LINK_COMPONENTS
2929
Passes
3030
)
3131

32-
# We don't want to link this into libLLVM
33-
add_llvm_library(LLVMOptDriver
34-
STATIC
32+
add_llvm_tool(opt
3533
NewPMDriver.cpp
36-
optdriver.cpp
37-
PARTIAL_SOURCES_INTENDED
38-
DEPENDS
39-
intrinsics_gen
40-
)
34+
opt.cpp
4135

42-
add_llvm_tool(opt
43-
PARTIAL_SOURCES_INTENDED
44-
opt.cpp
4536
DEPENDS
4637
intrinsics_gen
4738
SUPPORT_PLUGINS
48-
4939
)
50-
target_link_libraries(opt PRIVATE LLVMOptDriver)
51-
5240
export_executable_symbols_for_plugins(opt)

llvm/tools/opt/NewPMDriver.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,8 @@ bool llvm::runPassPipeline(
328328
StringRef Arg0, Module &M, TargetMachine *TM, TargetLibraryInfoImpl *TLII,
329329
ToolOutputFile *Out, ToolOutputFile *ThinLTOLinkOut,
330330
ToolOutputFile *OptRemarkFile, StringRef PassPipeline,
331-
ArrayRef<PassPlugin> PassPlugins,
332-
ArrayRef<std::function<void(llvm::PassBuilder &)>> PassBuilderCallbacks,
333-
OutputKind OK, VerifierKind VK, bool ShouldPreserveAssemblyUseListOrder,
331+
ArrayRef<PassPlugin> PassPlugins, OutputKind OK, VerifierKind VK,
332+
bool ShouldPreserveAssemblyUseListOrder,
334333
bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex,
335334
bool EmitModuleHash, bool EnableDebugify, bool VerifyDIPreserve,
336335
bool UnifiedLTO) {
@@ -429,10 +428,6 @@ bool llvm::runPassPipeline(
429428
for (auto &PassPlugin : PassPlugins)
430429
PassPlugin.registerPassBuilderCallbacks(PB);
431430

432-
// Load any explicitly specified plugins.
433-
for (auto &PassCallback : PassBuilderCallbacks)
434-
PassCallback(PB);
435-
436431
#define HANDLE_EXTENSION(Ext) \
437432
get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB);
438433
#include "llvm/Support/Extension.def"

llvm/tools/opt/NewPMDriver.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "llvm/Support/CommandLine.h"
2424

2525
namespace llvm {
26-
class PassBuilder;
2726
class StringRef;
2827
class Module;
2928
class PassPlugin;
@@ -65,17 +64,16 @@ void printPasses(raw_ostream &OS);
6564
///
6665
/// ThinLTOLinkOut is only used when OK is OK_OutputThinLTOBitcode, and can be
6766
/// nullptr.
68-
bool runPassPipeline(
69-
StringRef Arg0, Module &M, TargetMachine *TM, TargetLibraryInfoImpl *TLII,
70-
ToolOutputFile *Out, ToolOutputFile *ThinLinkOut,
71-
ToolOutputFile *OptRemarkFile, StringRef PassPipeline,
72-
ArrayRef<PassPlugin> PassPlugins,
73-
ArrayRef<std::function<void(llvm::PassBuilder &)>> PassBuilderCallbacks,
74-
opt_tool::OutputKind OK, opt_tool::VerifierKind VK,
75-
bool ShouldPreserveAssemblyUseListOrder,
76-
bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex,
77-
bool EmitModuleHash, bool EnableDebugify, bool VerifyDIPreserve,
78-
bool UnifiedLTO = false);
67+
bool runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
68+
TargetLibraryInfoImpl *TLII, ToolOutputFile *Out,
69+
ToolOutputFile *ThinLinkOut, ToolOutputFile *OptRemarkFile,
70+
StringRef PassPipeline, ArrayRef<PassPlugin> PassPlugins,
71+
opt_tool::OutputKind OK, opt_tool::VerifierKind VK,
72+
bool ShouldPreserveAssemblyUseListOrder,
73+
bool ShouldPreserveBitcodeUseListOrder,
74+
bool EmitSummaryIndex, bool EmitModuleHash,
75+
bool EnableDebugify, bool VerifyDIPreserve,
76+
bool UnifiedLTO = false);
7977
} // namespace llvm
8078

8179
#endif

0 commit comments

Comments
 (0)