[bazel] Replace gentbl with gentbl_cc_library (#124996)

LLVM has two tablegen generators: one in llvm/tblgen.bzl (`gentbl`,
macro-based) and one in mlir/tblgen.bzl (`gentbl_cc_library`,
rule-based). The `gentbl_cc_library` generator in MLIR has some
advantages to being a rule, and at any rate, it seems better to just use
the same tablegen rule everywhere instead of competing implementations.
This commit is contained in:
Jordan Rupprecht
2025-01-30 11:00:19 -06:00
committed by GitHub
parent a774de807e
commit a643e44974
4 changed files with 1617 additions and 921 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
load("//llvm:tblgen.bzl", "gentbl")
load("//mlir:tblgen.bzl", "gentbl_cc_library")
package(
default_visibility = ["//visibility:public"],
@@ -560,46 +560,34 @@ cc_test(
],
)
gentbl(
gentbl_cc_library(
name = "option_tests_gen",
strip_include_prefix = "Option",
tbl_outs = [(
"-gen-opt-parser-defs",
["-gen-opt-parser-defs"],
"Option/Opts.inc",
)],
tblgen = "//llvm:llvm-tblgen",
td_file = "Option/Opts.td",
td_srcs = [
"//llvm:include/llvm/Option/OptParser.td",
],
deps = ["//llvm:OptParserTdFiles"],
)
gentbl(
name = "automata_automata_gen",
gentbl_cc_library(
name = "automata_gen",
strip_include_prefix = "TableGen",
tbl_outs = [(
"-gen-automata",
"TableGen/AutomataAutomata.inc",
)],
tbl_outs = [
(
["-gen-automata"],
"TableGen/AutomataAutomata.inc",
),
(
["-gen-searchable-tables"],
"TableGen/AutomataTables.inc",
),
],
tblgen = "//llvm:llvm-tblgen",
td_file = "TableGen/Automata.td",
td_srcs = ["//llvm:common_target_td_sources"] + [
"TableGen/Automata.td",
],
)
gentbl(
name = "automata_tables_gen",
strip_include_prefix = "TableGen",
tbl_outs = [(
"-gen-searchable-tables",
"TableGen/AutomataTables.inc",
)],
tblgen = "//llvm:llvm-tblgen",
td_file = "TableGen/Automata.td",
td_srcs = ["//llvm:common_target_td_sources"] + [
"TableGen/Automata.td",
],
deps = ["//llvm:CommonTargetTdFiles"],
)
cc_test(
@@ -743,8 +731,7 @@ cc_test(
allow_empty = False,
),
deps = [
":automata_automata_gen",
":automata_tables_gen",
":automata_gen",
"//llvm:Support",
"//llvm:TableGen",
"//llvm:TableGenGlobalISel",

View File

@@ -10409,7 +10409,7 @@ gentbl_cc_library(
],
tblgen = ":mlir-tblgen",
td_file = "//llvm:include/llvm/Frontend/OpenACC/ACC.td",
deps = ["//llvm:acc_td_files"],
deps = ["//llvm:AccTdFiles"],
)
td_library(
@@ -10656,7 +10656,7 @@ gentbl_cc_library(
td_file = "//llvm:include/llvm/Frontend/OpenMP/OMP.td",
deps = [
":OpBaseTdFiles",
"//llvm:omp_td_files",
"//llvm:OmpTdFiles",
],
)