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):
172
172
)
173
173
174
174
# Create a starlark file with the requested LLVM targets.
175
- targets = repository_ctx .attr .targets
175
+ llvm_targets = repository_ctx .attr .targets
176
176
repository_ctx .file (
177
177
"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 ),
179
188
executable = False ,
180
189
)
181
190
Original file line number Diff line number Diff line change 3
3
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
4
5
5
load ("@bazel_skylib//rules:expand_template.bzl" , "expand_template" )
6
+ load (":targets.bzl" , "bolt_targets" )
6
7
7
8
package (
8
9
default_visibility = ["//visibility:public" ],
@@ -16,6 +17,20 @@ genrule(
16
17
cmd = "echo '#undef BOLT_REVISION' >> $@\n " ,
17
18
)
18
19
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
+
19
34
cc_binary (
20
35
name = "llvm-bolt-heatmap" ,
21
36
srcs = glob ([
@@ -24,6 +39,7 @@ cc_binary(
24
39
deps = [
25
40
":Profile" ,
26
41
":Rewrite" ,
42
+ ":TargetConfig" ,
27
43
":Utils" ,
28
44
"//llvm:AllTargetsAsmParsers" ,
29
45
"//llvm:AllTargetsDisassemblers" ,
@@ -54,6 +70,7 @@ cc_binary(
54
70
":Profile" ,
55
71
":Rewrite" ,
56
72
":RuntimeLibs" ,
73
+ ":TargetConfig" ,
57
74
":TargetAArch64" ,
58
75
":TargetX86" ,
59
76
":Utils" ,
You can’t perform that action at this time.
0 commit comments