[llvm] [bazel] Add CGData targets/deps (PR #108070)
Jordan Rupprecht via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 11:37:06 PDT 2024
https://github.com/rupprecht created https://github.com/llvm/llvm-project/pull/108070
This is newly used as of 0f525452896771cc8c579eb362dc7645e38fd0b9.
The bulk of the targets were added earlier in 9bb555688caf6ae4ba89fee5baa3dc29fec6a9b1.
>From f4dff4034c9b28708fb59d81c5dd2487b607a1c6 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht <rupprecht at google.com>
Date: Tue, 10 Sep 2024 11:35:22 -0700
Subject: [PATCH] [bazel] Add CGData targets/deps
This is newly used as of 0f525452896771cc8c579eb362dc7645e38fd0b9.
The bulk of the targets were added earlier in 9bb555688caf6ae4ba89fee5baa3dc29fec6a9b1.
---
.../llvm-project-overlay/llvm/BUILD.bazel | 53 +++++++++++++++++++
.../llvm-project-overlay/llvm/driver.bzl | 1 +
.../llvm/unittests/BUILD.bazel | 18 +++++++
3 files changed, 72 insertions(+)
diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index 46d9a67f3eb7ff..4df7954ea34403 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -1871,6 +1871,25 @@ cc_library(
],
)
+cc_library(
+ name = "CGData",
+ srcs = glob(["lib/CGData/**/*.cpp"]),
+ hdrs = glob([
+ "include/llvm/CGData/**/*.h",
+ "include/llvm/CGData/**/*.inc",
+ ]),
+ copts = llvm_copts,
+ deps = [
+ ":BitReader",
+ ":BitWriter",
+ ":Core",
+ ":Object",
+ ":ObjectYAML",
+ ":Support",
+ ":TargetParser",
+ ],
+)
+
cc_library(
name = "CodeGen",
srcs = glob(
@@ -1900,6 +1919,7 @@ cc_library(
":BitReader",
":BitWriter",
":CFGuard",
+ ":CGData",
":CodeGenTypes",
":Core",
":DebugInfoCodeView",
@@ -3488,6 +3508,39 @@ cc_binary(
],
)
+gentbl(
+ name = "CGDataOptsTableGen",
+ strip_include_prefix = "tools/llvm-cgdata",
+ tbl_outs = [(
+ "-gen-opt-parser-defs",
+ "tools/llvm-cgdata/Opts.inc",
+ )],
+ tblgen = ":llvm-tblgen",
+ td_file = "tools/llvm-cgdata/Opts.td",
+ td_srcs = ["include/llvm/Option/OptParser.td"],
+)
+
+cc_library(
+ name = "llvm-cgdata-lib",
+ srcs = glob(["tools/llvm-cgdata/*.cpp"]),
+ copts = llvm_copts,
+ deps = [
+ ":CGData",
+ ":CGDataOptsTableGen",
+ ":CodeGen",
+ ":Core",
+ ":Object",
+ ":Option",
+ ":Support",
+ ],
+)
+
+llvm_driver_cc_binary(
+ name = "llvm-cgdata",
+ stamp = 0,
+ deps = [":llvm-cgdata-lib"],
+)
+
cc_binary(
name = "llvm-cfi-verify",
srcs = glob([
diff --git a/utils/bazel/llvm-project-overlay/llvm/driver.bzl b/utils/bazel/llvm-project-overlay/llvm/driver.bzl
index a57a14ebd5f8c2..b3d3b2eed9f061 100644
--- a/utils/bazel/llvm-project-overlay/llvm/driver.bzl
+++ b/utils/bazel/llvm-project-overlay/llvm/driver.bzl
@@ -14,6 +14,7 @@ _TOOLS = {
"dsymutil": "//llvm:dsymutil-lib",
"lld": "//lld:lld-lib",
"llvm-ar": "//llvm:llvm-ar-lib",
+ "llvm-cgdata": "//llvm:llvm-cgdata-lib",
"llvm-cxxfilt": "//llvm:llvm-cxxfilt-lib",
"llvm-dwp": "//llvm:llvm-dwp-lib",
"llvm-gsymutil": "//llvm:llvm-gsymutil-lib",
diff --git a/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
index 641ac97348eb4d..1170458664250b 100644
--- a/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
@@ -121,6 +121,24 @@ cc_test(
],
)
+cc_test(
+ name = "cgdata_tests",
+ size = "small",
+ srcs = glob(
+ ["CGData/*.cpp"],
+ allow_empty = False,
+ ),
+ deps = [
+ "//llvm:CGData",
+ "//llvm:CodeGen",
+ "//llvm:Core",
+ "//llvm:Support",
+ "//third-party/unittest:gmock",
+ "//third-party/unittest:gtest",
+ "//third-party/unittest:gtest_main",
+ ],
+)
+
cc_library(
name = "codegen_tests_includes",
textual_hdrs = glob(
More information about the llvm-commits
mailing list