xref: /aosp_15_r20/external/bazelbuild-platforms/cpu/BUILD (revision ef3a692c0746f7dadd4fb3b5728d17696f151f9c)
1# Standard cpu name constraint_setting and constraint_values
2licenses(["notice"])
3
4package(
5    default_visibility = ["//visibility:public"],
6)
7
8filegroup(
9    name = "srcs",
10    srcs = glob(["**"]),
11)
12
13# To add a new constraint_value see https://github.com/bazelbuild/platforms.
14constraint_setting(name = "cpu")
15
16# New cpu values should refer to specific, highly available CPU implementations,
17# not broad architectures.  It should be possible to select the right compiler
18# options by just by knowing the cpu. This can be a difficult evaluation for
19# ARM variations, where there are many possibilities for customization within
20# an architecture.
21#
22# 1. No private names are be allowed. If you build your own custom ARM chips,
23#    then define them locally within your organization.
24# 2. All CPU values must be clear that they are for a 32 or a 64 bit
25#    implementation. For example, cortex-r52 is a 32 bit processor, and
26#    cortex-r82 is a 64 bit processor, but both are armv8-r architecture.
27#    We use the specific processor names because armv8-r is insufficient to
28#    select proper compiler options.
29#
30# Many of the name here are legacy values and probably violate these conditions.
31# We'll try to clean those up over time.
32
33# Special case: Architecture-independent outputs only
34#
35# Some builds are expected to only produce architecture-independent data files,
36# such as configuration files, database seed data, composited images, or even
37# some kinds of interpreted scripts (Shell, Python, Perl, etc).
38#
39# When such a build is being performed, this constraint value may be used to
40# ensure that architecture-dependent builds cannot be performed (except by way
41# of another transition).
42#
43# As a final example, consider building a package of NIC firmware images for
44# many different NIC models.  The package overall is architecture-independent,
45# and should be built with `//cpu:all`, then each individual image rule has a
46# transition to the suitable architecture for that specific NIC model.
47constraint_value(
48    name = "all",
49    constraint_setting = ":cpu",
50)
51
52constraint_value(
53    name = "aarch32",
54    constraint_setting = ":cpu",
55)
56
57constraint_value(
58    name = "aarch64",
59    constraint_setting = ":cpu",
60)
61
62alias(
63    name = "arm",
64    actual = ":aarch32",
65)
66
67# Cortex-M0, Cortex-M0+, Cortex-M1
68constraint_value(
69    name = "armv6-m",  # Commonly known as thumbv6
70    constraint_setting = ":cpu",
71)
72
73# Cortex-M3
74constraint_value(
75    name = "armv7-m",
76    constraint_setting = ":cpu",
77)
78
79# Cortex-M4, Cortex-M7
80constraint_value(
81    name = "armv7e-m",
82    constraint_setting = ":cpu",
83)
84
85# Cortex-M4, Cortex-M7 with fpu
86constraint_value(
87    name = "armv7e-mf",  # armv7e-m with fpu
88    constraint_setting = ":cpu",
89)
90
91# Cortex-M23, Cortex-M33, Cortex-M35P
92constraint_value(
93    name = "armv8-m",
94    constraint_setting = ":cpu",
95)
96
97alias(
98    name = "arm64",
99    actual = ":aarch64",
100)
101
102constraint_value(
103    name = "arm64_32",
104    constraint_setting = ":cpu",
105)
106
107constraint_value(
108    name = "arm64e",
109    constraint_setting = ":cpu",
110)
111
112constraint_value(
113    name = "armv7",
114    constraint_setting = ":cpu",
115)
116
117constraint_value(
118    name = "armv7k",
119    constraint_setting = ":cpu",
120)
121
122constraint_value(
123    name = "cortex-r52",
124    constraint_setting = ":cpu",
125)
126
127constraint_value(
128    name = "cortex-r82",
129    constraint_setting = ":cpu",
130)
131
132constraint_value(
133    name = "i386",
134    constraint_setting = ":cpu",
135)
136
137constraint_value(
138    name = "ppc",
139    constraint_setting = ":cpu",
140)
141
142constraint_value(
143    name = "ppc32",
144    constraint_setting = ":cpu",
145)
146
147constraint_value(
148    name = "ppc64le",
149    constraint_setting = ":cpu",
150)
151
152constraint_value(
153    name = "s390x",
154    constraint_setting = ":cpu",
155)
156
157constraint_value(
158    name = "x86_32",
159    constraint_setting = ":cpu",
160)
161
162constraint_value(
163    name = "x86_64",
164    constraint_setting = ":cpu",
165)
166
167constraint_value(
168    name = "wasm32",
169    constraint_setting = ":cpu",
170)
171
172constraint_value(
173    name = "wasm64",
174    constraint_setting = ":cpu",
175)
176
177constraint_value(
178    name = "mips64",
179    constraint_setting = ":cpu",
180)
181
182constraint_value(
183    name = "riscv32",
184    constraint_setting = ":cpu",
185)
186
187constraint_value(
188    name = "riscv64",
189    constraint_setting = ":cpu",
190)
191