[llvm] [Bazel] Support opt-driver library, like clang-driver (PR #79205)
William Moses via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 16:29:13 PST 2024
https://github.com/wsmoses updated https://github.com/llvm/llvm-project/pull/79205
>From 12ede4bf83c8300b3d4fba137e95bcf36db7a7ab Mon Sep 17 00:00:00 2001
From: "William S. Moses" <gh at wsmoses.com>
Date: Tue, 23 Jan 2024 15:17:10 -0500
Subject: [PATCH] [Bazel] Support opt-driver library, like clang-driver
---
llvm/tools/opt/CMakeLists.txt | 10 +++++++---
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 11 ++++++++---
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt
index 2cdb99e936287ca..56905eae6aa0986 100644
--- a/llvm/tools/opt/CMakeLists.txt
+++ b/llvm/tools/opt/CMakeLists.txt
@@ -1,3 +1,8 @@
+add_llvm_component_library(OptDriver
+ NewPMDriver.cpp
+ opt.cpp
+)
+
set(LLVM_LINK_COMPONENTS
AllTargetsAsmParsers
AllTargetsCodeGens
@@ -27,14 +32,13 @@ set(LLVM_LINK_COMPONENTS
TransformUtils
Vectorize
Passes
+ LLVMOptDriver
)
add_llvm_tool(opt
- NewPMDriver.cpp
- opt.cpp
-
DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
+ OptDriver
)
export_executable_symbols_for_plugins(opt)
diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index b22ec01376be6d4..21466a79af61b53 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -4808,8 +4808,8 @@ cc_binary(
],
)
-cc_binary(
- name = "opt",
+cc_library(
+ name = "opt-driver",
srcs = glob([
"tools/opt/*.cpp",
"tools/opt/*.h",
@@ -4820,7 +4820,6 @@ cc_binary(
"@platforms//os:macos": [],
"//conditions:default": ["-Wl,--export-dynamic"],
}),
- stamp = 0,
deps = [
":AllTargetsAsmParsers",
":AllTargetsCodeGens",
@@ -4847,6 +4846,12 @@ cc_binary(
],
)
+cc_binary(
+ name = "opt",
+ stamp = 0,
+ deps = [":opt-driver"]
+)
+
gentbl(
name = "SancovOptsTableGen",
strip_include_prefix = "tools/sancov",
More information about the llvm-commits
mailing list