File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
llvm-project-overlay/bolt Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -172,10 +172,19 @@ def _llvm_configure_impl(repository_ctx):
172172 )
173173
174174 # Create a starlark file with the requested LLVM targets.
175- targets = repository_ctx .attr .targets
175+ llvm_targets = repository_ctx .attr .targets
176176 repository_ctx .file (
177177 "llvm/targets.bzl" ,
178- content = "llvm_targets = " + str (targets ),
178+ content = "llvm_targets = " + str (llvm_targets ),
179+ executable = False ,
180+ )
181+
182+ # Create a starlark file with the requested BOLT targets.
183+ bolt_targets = ["AArch64" ,"X86" ,"RISCV" ] # Supported targets.
184+ bolt_targets = [t for t in llvm_targets if t in bolt_targets ]
185+ repository_ctx .file (
186+ "bolt/targets.bzl" ,
187+ content = "bolt_targets = " + str (bolt_targets ),
179188 executable = False ,
180189 )
181190
Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
55load ("@bazel_skylib//rules:expand_template.bzl" , "expand_template" )
6+ load (":targets.bzl" , "bolt_targets" )
67
78package (
89 default_visibility = ["//visibility:public" ],
@@ -16,6 +17,20 @@ genrule(
1617 cmd = "echo '#undef BOLT_REVISION' >> $@\n " ,
1718)
1819
20+ expand_template (
21+ name = "target_config_def_gen" ,
22+ out = "include/bolt/Core/TargetConfig.def" ,
23+ substitutions = {"@BOLT_ENUM_TARGETS@" : "\n " .join (
24+ ["BOLT_TARGET({})" .format (target ) for target in bolt_targets ],
25+ )},
26+ template = "include/bolt/Core/TargetConfig.def.in" ,
27+ )
28+
29+ cc_library (
30+ name = "TargetConfig" ,
31+ textual_hdrs = [":target_config_def_gen" ],
32+ )
33+
1934cc_binary (
2035 name = "llvm-bolt-heatmap" ,
2136 srcs = glob ([
@@ -24,6 +39,7 @@ cc_binary(
2439 deps = [
2540 ":Profile" ,
2641 ":Rewrite" ,
42+ ":TargetConfig" ,
2743 ":Utils" ,
2844 "//llvm:AllTargetsAsmParsers" ,
2945 "//llvm:AllTargetsDisassemblers" ,
@@ -54,6 +70,7 @@ cc_binary(
5470 ":Profile" ,
5571 ":Rewrite" ,
5672 ":RuntimeLibs" ,
73+ ":TargetConfig" ,
5774 ":TargetAArch64" ,
5875 ":TargetX86" ,
5976 ":Utils" ,
You can’t perform that action at this time.
0 commit comments