aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/llvm
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-01-02 22:19:48 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-01-02 22:27:38 -0800
commit46d2c286045f4d2616d348cbaaea7fd52fadfe8b (patch)
treef8c1b4cd1ea1f17e7a80b6f969555ee3b0b65837 /third_party/llvm
parent143556267343e8f3f352b0ddba5272fc30b80078 (diff)
Merge changes from github.
Change: 143412147
Diffstat (limited to 'third_party/llvm')
-rw-r--r--third_party/llvm/llvm.BUILD21
-rw-r--r--third_party/llvm/llvm.bzl42
2 files changed, 12 insertions, 51 deletions
diff --git a/third_party/llvm/llvm.BUILD b/third_party/llvm/llvm.BUILD
index 711ae38c3a..c6ed697013 100644
--- a/third_party/llvm/llvm.BUILD
+++ b/third_party/llvm/llvm.BUILD
@@ -10,10 +10,13 @@ load(
"@//third_party/llvm:llvm.bzl",
"gentbl",
"expand_cmake_vars",
- "expand_header_template",
"llvm_target_cmake_vars",
"cmake_var_string",
)
+load(
+ "@//third_party:common.bzl",
+ "template_rule",
+)
package(default_visibility = ["@//tensorflow/compiler/xla:internal"])
@@ -176,48 +179,48 @@ expand_cmake_vars(
)
# Performs macro expansions on .def.in files
-expand_header_template(
+template_rule(
name = "targets_def_gen",
+ src = "include/llvm/Config/Targets.def.in",
out = "include/llvm/Config/Targets.def",
substitutions = {
"@LLVM_ENUM_TARGETS@": "\n".join(
["LLVM_TARGET({})".format(t) for t in llvm_targets],
),
},
- template = "include/llvm/Config/Targets.def.in",
)
-expand_header_template(
+template_rule(
name = "asm_parsers_def_gen",
+ src = "include/llvm/Config/AsmParsers.def.in",
out = "include/llvm/Config/AsmParsers.def",
substitutions = {
"@LLVM_ENUM_ASM_PARSERS@": "\n".join(
["LLVM_ASM_PARSER({})".format(t) for t in llvm_target_asm_parsers],
),
},
- template = "include/llvm/Config/AsmParsers.def.in",
)
-expand_header_template(
+template_rule(
name = "asm_printers_def_gen",
+ src = "include/llvm/Config/AsmPrinters.def.in",
out = "include/llvm/Config/AsmPrinters.def",
substitutions = {
"@LLVM_ENUM_ASM_PRINTERS@": "\n".join(
["LLVM_ASM_PRINTER({})".format(t) for t in llvm_target_asm_printers],
),
},
- template = "include/llvm/Config/AsmPrinters.def.in",
)
-expand_header_template(
+template_rule(
name = "disassemblers_def_gen",
+ src = "include/llvm/Config/Disassemblers.def.in",
out = "include/llvm/Config/Disassemblers.def",
substitutions = {
"@LLVM_ENUM_DISASSEMBLERS@": "\n".join(
["LLVM_DISASSEMBLER({})".format(t) for t in llvm_target_disassemblers],
),
},
- template = "include/llvm/Config/Disassemblers.def.in",
)
# A common library that all LLVM targets depend on.
diff --git a/third_party/llvm/llvm.bzl b/third_party/llvm/llvm.bzl
index 1d6bf1c706..4a0814fb7f 100644
--- a/third_party/llvm/llvm.bzl
+++ b/third_party/llvm/llvm.bzl
@@ -46,48 +46,6 @@ def gentbl(name, tblgen, td_file, td_srcs, tbl_outs, library = True, **kwargs):
native.cc_library(name=name, textual_hdrs=[f for (_, f) in tbl_outs],
includes=includes, **kwargs)
-
-# Rule for simple expansion of template files. This performs a simple
-# search over the template file for the keys in substitutions,
-# and replaces them with the corresponding values.
-#
-# Typical usage:
-# load("/tools/build_rules/expand_header_template", "expand_header_template")
-# expand_header_template(
-# name = "ExpandMyTemplate",
-# template = "my.template",
-# out = "my.txt",
-# substitutions = {
-# "$VAR1": "foo",
-# "$VAR2": "bar",
-# }
-# )
-#
-# Args:
-# name: The name of the rule.
-# template: The template file to expand
-# out: The destination of the expanded file
-# substitutions: A dictionary mapping strings to their substitutions
-
-def expand_header_template_impl(ctx):
- ctx.template_action(
- template = ctx.file.template,
- output = ctx.outputs.out,
- substitutions = ctx.attr.substitutions,
- )
-
-expand_header_template = rule(
- implementation = expand_header_template_impl,
- attrs = {
- "template": attr.label(mandatory=True, allow_files=True, single_file=True),
- "substitutions": attr.string_dict(mandatory=True),
- "out": attr.output(mandatory=True),
- },
- # output_to_genfiles is required for header files.
- output_to_genfiles = True,
-)
-
-
def llvm_target_cmake_vars(native_arch, target_triple):
return {
"LLVM_HOST_TRIPLE": target_triple,