blob: bbc2ec06b63e1d76518e5d9035f097afec83be06 [file] [log] [blame]
Ben Olmsteadc0d77842019-07-31 17:34:05 -07001# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Shared utilities for Emboss back ends.
16
Ted Pudlik4a044db2024-04-10 15:56:42 -070017load("@rules_python//python:py_library.bzl", "py_library")
18load("@rules_python//python:py_test.bzl", "py_test")
19
Ben Olmsteadc0d77842019-07-31 17:34:05 -070020package(
reventlov6731fc42019-10-03 15:23:13 -070021 default_visibility = ["//compiler:__subpackages__"],
22)
23
24py_library(
Eric Rahm12c5e842024-03-22 09:37:24 -070025 name = "ir_data",
reventlov6731fc42019-10-03 15:23:13 -070026 srcs = [
Eric Rahm12c5e842024-03-22 09:37:24 -070027 "ir_data.py",
reventlov6731fc42019-10-03 15:23:13 -070028 ],
Ben Olmsteadc0d77842019-07-31 17:34:05 -070029)
30
31py_library(
32 name = "expression_parser",
33 srcs = ["expression_parser.py"],
34 deps = [
reventlov6731fc42019-10-03 15:23:13 -070035 "//compiler/front_end:module_ir",
36 "//compiler/front_end:parser",
37 "//compiler/front_end:tokenizer",
Ben Olmsteadc0d77842019-07-31 17:34:05 -070038 ],
39)
40
41py_library(
42 name = "ir_util",
43 srcs = ["ir_util.py"],
Eric Rahm12c5e842024-03-22 09:37:24 -070044 deps = [":ir_data"],
Ben Olmsteadc0d77842019-07-31 17:34:05 -070045)
46
47py_test(
48 name = "ir_util_test",
49 srcs = ["ir_util_test.py"],
50 python_version = "PY3",
51 deps = [
52 ":expression_parser",
Eric Rahm12c5e842024-03-22 09:37:24 -070053 ":ir_data",
Dmitri Prime5b381262023-05-01 23:55:07 -070054 ":ir_util",
55 ],
56)
57
58py_library(
59 name = "attribute_util",
60 srcs = ["attribute_util.py"],
61 deps = [
62 ":error",
Eric Rahm12c5e842024-03-22 09:37:24 -070063 ":ir_data",
Dmitri Prime5b381262023-05-01 23:55:07 -070064 ":ir_util",
65 ":traverse_ir",
Ben Olmsteadc0d77842019-07-31 17:34:05 -070066 ],
67)
68
69py_library(
70 name = "simple_memoizer",
71 srcs = ["simple_memoizer.py"],
72 deps = [],
73)
74
75py_test(
76 name = "simple_memoizer_test",
77 srcs = ["simple_memoizer_test.py"],
78 python_version = "PY3",
79 deps = [
80 ":simple_memoizer",
81 ],
82)
83
84py_library(
Jason Graffius91910772023-05-18 12:43:52 -040085 name = "test_util",
86 testonly = 1,
87 srcs = ["test_util.py"],
88 deps = [],
89)
90
91py_test(
92 name = "test_util_test",
93 srcs = ["test_util_test.py"],
94 python_version = "PY3",
95 deps = [
96 ":test_util",
Eric Rahm12c5e842024-03-22 09:37:24 -070097 "//compiler/util:ir_data",
Jason Graffius91910772023-05-18 12:43:52 -040098 "//compiler/util:parser_types",
99 ],
100)
101
102py_library(
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700103 name = "traverse_ir",
104 srcs = ["traverse_ir.py"],
105 deps = [
Ted Pudlik4a044db2024-04-10 15:56:42 -0700106 ":simple_memoizer",
Eric Rahm12c5e842024-03-22 09:37:24 -0700107 ":ir_data",
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700108 ],
109)
110
111py_test(
112 name = "traverse_ir_test",
113 srcs = ["traverse_ir_test.py"],
114 python_version = "PY3",
115 deps = [
Ted Pudlik4a044db2024-04-10 15:56:42 -0700116 ":traverse_ir",
Eric Rahm12c5e842024-03-22 09:37:24 -0700117 ":ir_data",
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700118 ],
119)
120
121py_library(
122 name = "parser_types",
123 srcs = ["parser_types.py"],
124 deps = [
Eric Rahm12c5e842024-03-22 09:37:24 -0700125 ":ir_data",
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700126 ],
127)
128
129py_test(
130 name = "parser_types_test",
131 srcs = ["parser_types_test.py"],
132 python_version = "PY3",
133 deps = [
Ted Pudlik4a044db2024-04-10 15:56:42 -0700134 ":parser_types",
Eric Rahm12c5e842024-03-22 09:37:24 -0700135 ":ir_data",
Ben Olmsteadc0d77842019-07-31 17:34:05 -0700136 ],
137)
138
139py_library(
140 name = "error",
141 srcs = [
142 "error.py",
143 ],
144 deps = [
145 ":parser_types",
146 ],
147)
148
149py_test(
150 name = "error_test",
151 srcs = ["error_test.py"],
152 python_version = "PY3",
153 deps = [
154 ":error",
155 ":parser_types",
156 ],
157)
158
159py_library(
160 name = "name_conversion",
161 srcs = ["name_conversion.py"],
162 deps = [],
163)
164
165py_test(
166 name = "name_conversion_test",
167 srcs = ["name_conversion_test.py"],
168 python_version = "PY3",
169 deps = [
170 ":name_conversion",
171 ],
172)
Ben Olmsteadb9b93c32024-02-20 21:47:41 +0000173
174py_library(
175 name = "resources",
176 srcs = ["resources.py"],
177 deps = [],
178)