|
1 | 1 | use crate::back::write::create_informational_target_machine;
|
2 | 2 | use crate::llvm;
|
3 | 3 | use libc::c_int;
|
| 4 | +use rustc_codegen_ssa::target_features::supported_target_features; |
4 | 5 | use rustc_data_structures::fx::FxHashSet;
|
5 | 6 | use rustc_feature::UnstableFeatures;
|
6 | 7 | use rustc_middle::bug;
|
7 | 8 | use rustc_session::config::PrintRequest;
|
8 | 9 | use rustc_session::Session;
|
9 |
| -use rustc_span::symbol::sym; |
10 | 10 | use rustc_span::symbol::Symbol;
|
11 | 11 | use rustc_target::spec::{MergeFunctions, PanicStrategy};
|
12 | 12 | use std::ffi::CString;
|
@@ -139,140 +139,6 @@ pub fn time_trace_profiler_finish(file_name: &str) {
|
139 | 139 | // WARNING: the features after applying `to_llvm_feature` must be known
|
140 | 140 | // to LLVM or the feature detection code will walk past the end of the feature
|
141 | 141 | // array, leading to crashes.
|
142 |
| - |
143 |
| -const ARM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[ |
144 |
| - ("aclass", Some(sym::arm_target_feature)), |
145 |
| - ("mclass", Some(sym::arm_target_feature)), |
146 |
| - ("rclass", Some(sym::arm_target_feature)), |
147 |
| - ("dsp", Some(sym::arm_target_feature)), |
148 |
| - ("neon", Some(sym::arm_target_feature)), |
149 |
| - ("crc", Some(sym::arm_target_feature)), |
150 |
| - ("crypto", Some(sym::arm_target_feature)), |
151 |
| - ("v5te", Some(sym::arm_target_feature)), |
152 |
| - ("v6", Some(sym::arm_target_feature)), |
153 |
| - ("v6k", Some(sym::arm_target_feature)), |
154 |
| - ("v6t2", Some(sym::arm_target_feature)), |
155 |
| - ("v7", Some(sym::arm_target_feature)), |
156 |
| - ("v8", Some(sym::arm_target_feature)), |
157 |
| - ("vfp2", Some(sym::arm_target_feature)), |
158 |
| - ("vfp3", Some(sym::arm_target_feature)), |
159 |
| - ("vfp4", Some(sym::arm_target_feature)), |
160 |
| - // This is needed for inline assembly, but shouldn't be stabilized as-is |
161 |
| - // since it should be enabled per-function using #[instruction_set], not |
162 |
| - // #[target_feature]. |
163 |
| - ("thumb-mode", Some(sym::arm_target_feature)), |
164 |
| -]; |
165 |
| - |
166 |
| -const AARCH64_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[ |
167 |
| - ("fp", Some(sym::aarch64_target_feature)), |
168 |
| - ("neon", Some(sym::aarch64_target_feature)), |
169 |
| - ("sve", Some(sym::aarch64_target_feature)), |
170 |
| - ("crc", Some(sym::aarch64_target_feature)), |
171 |
| - ("crypto", Some(sym::aarch64_target_feature)), |
172 |
| - ("ras", Some(sym::aarch64_target_feature)), |
173 |
| - ("lse", Some(sym::aarch64_target_feature)), |
174 |
| - ("rdm", Some(sym::aarch64_target_feature)), |
175 |
| - ("fp16", Some(sym::aarch64_target_feature)), |
176 |
| - ("rcpc", Some(sym::aarch64_target_feature)), |
177 |
| - ("dotprod", Some(sym::aarch64_target_feature)), |
178 |
| - ("tme", Some(sym::aarch64_target_feature)), |
179 |
| - ("v8.1a", Some(sym::aarch64_target_feature)), |
180 |
| - ("v8.2a", Some(sym::aarch64_target_feature)), |
181 |
| - ("v8.3a", Some(sym::aarch64_target_feature)), |
182 |
| -]; |
183 |
| - |
184 |
| -const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[ |
185 |
| - ("adx", Some(sym::adx_target_feature)), |
186 |
| - ("aes", None), |
187 |
| - ("avx", None), |
188 |
| - ("avx2", None), |
189 |
| - ("avx512bw", Some(sym::avx512_target_feature)), |
190 |
| - ("avx512cd", Some(sym::avx512_target_feature)), |
191 |
| - ("avx512dq", Some(sym::avx512_target_feature)), |
192 |
| - ("avx512er", Some(sym::avx512_target_feature)), |
193 |
| - ("avx512f", Some(sym::avx512_target_feature)), |
194 |
| - ("avx512ifma", Some(sym::avx512_target_feature)), |
195 |
| - ("avx512pf", Some(sym::avx512_target_feature)), |
196 |
| - ("avx512vbmi", Some(sym::avx512_target_feature)), |
197 |
| - ("avx512vl", Some(sym::avx512_target_feature)), |
198 |
| - ("avx512vpopcntdq", Some(sym::avx512_target_feature)), |
199 |
| - ("bmi1", None), |
200 |
| - ("bmi2", None), |
201 |
| - ("cmpxchg16b", Some(sym::cmpxchg16b_target_feature)), |
202 |
| - ("f16c", Some(sym::f16c_target_feature)), |
203 |
| - ("fma", None), |
204 |
| - ("fxsr", None), |
205 |
| - ("lzcnt", None), |
206 |
| - ("movbe", Some(sym::movbe_target_feature)), |
207 |
| - ("pclmulqdq", None), |
208 |
| - ("popcnt", None), |
209 |
| - ("rdrand", None), |
210 |
| - ("rdseed", None), |
211 |
| - ("rtm", Some(sym::rtm_target_feature)), |
212 |
| - ("sha", None), |
213 |
| - ("sse", None), |
214 |
| - ("sse2", None), |
215 |
| - ("sse3", None), |
216 |
| - ("sse4.1", None), |
217 |
| - ("sse4.2", None), |
218 |
| - ("sse4a", Some(sym::sse4a_target_feature)), |
219 |
| - ("ssse3", None), |
220 |
| - ("tbm", Some(sym::tbm_target_feature)), |
221 |
| - ("xsave", None), |
222 |
| - ("xsavec", None), |
223 |
| - ("xsaveopt", None), |
224 |
| - ("xsaves", None), |
225 |
| -]; |
226 |
| - |
227 |
| -const HEXAGON_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[ |
228 |
| - ("hvx", Some(sym::hexagon_target_feature)), |
229 |
| - ("hvx-length128b", Some(sym::hexagon_target_feature)), |
230 |
| -]; |
231 |
| - |
232 |
| -const POWERPC_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[ |
233 |
| - ("altivec", Some(sym::powerpc_target_feature)), |
234 |
| - ("power8-altivec", Some(sym::powerpc_target_feature)), |
235 |
| - ("power9-altivec", Some(sym::powerpc_target_feature)), |
236 |
| - ("power8-vector", Some(sym::powerpc_target_feature)), |
237 |
| - ("power9-vector", Some(sym::powerpc_target_feature)), |
238 |
| - ("vsx", Some(sym::powerpc_target_feature)), |
239 |
| -]; |
240 |
| - |
241 |
| -const MIPS_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = |
242 |
| - &[("fp64", Some(sym::mips_target_feature)), ("msa", Some(sym::mips_target_feature))]; |
243 |
| - |
244 |
| -const RISCV_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[ |
245 |
| - ("m", Some(sym::riscv_target_feature)), |
246 |
| - ("a", Some(sym::riscv_target_feature)), |
247 |
| - ("c", Some(sym::riscv_target_feature)), |
248 |
| - ("f", Some(sym::riscv_target_feature)), |
249 |
| - ("d", Some(sym::riscv_target_feature)), |
250 |
| - ("e", Some(sym::riscv_target_feature)), |
251 |
| -]; |
252 |
| - |
253 |
| -const WASM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[ |
254 |
| - ("simd128", Some(sym::wasm_target_feature)), |
255 |
| - ("atomics", Some(sym::wasm_target_feature)), |
256 |
| - ("nontrapping-fptoint", Some(sym::wasm_target_feature)), |
257 |
| -]; |
258 |
| - |
259 |
| -/// When rustdoc is running, provide a list of all known features so that all their respective |
260 |
| -/// primitives may be documented. |
261 |
| -/// |
262 |
| -/// IMPORTANT: If you're adding another feature list above, make sure to add it to this iterator! |
263 |
| -pub fn all_known_features() -> impl Iterator<Item = (&'static str, Option<Symbol>)> { |
264 |
| - std::iter::empty() |
265 |
| - .chain(ARM_ALLOWED_FEATURES.iter()) |
266 |
| - .chain(AARCH64_ALLOWED_FEATURES.iter()) |
267 |
| - .chain(X86_ALLOWED_FEATURES.iter()) |
268 |
| - .chain(HEXAGON_ALLOWED_FEATURES.iter()) |
269 |
| - .chain(POWERPC_ALLOWED_FEATURES.iter()) |
270 |
| - .chain(MIPS_ALLOWED_FEATURES.iter()) |
271 |
| - .chain(RISCV_ALLOWED_FEATURES.iter()) |
272 |
| - .chain(WASM_ALLOWED_FEATURES.iter()) |
273 |
| - .cloned() |
274 |
| -} |
275 |
| - |
276 | 142 | pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str {
|
277 | 143 | let arch = if sess.target.target.arch == "x86_64" { "x86" } else { &*sess.target.target.arch };
|
278 | 144 | match (arch, s) {
|
@@ -306,20 +172,6 @@ pub fn target_features(sess: &Session) -> Vec<Symbol> {
|
306 | 172 | .collect()
|
307 | 173 | }
|
308 | 174 |
|
309 |
| -pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Option<Symbol>)] { |
310 |
| - match &*sess.target.target.arch { |
311 |
| - "arm" => ARM_ALLOWED_FEATURES, |
312 |
| - "aarch64" => AARCH64_ALLOWED_FEATURES, |
313 |
| - "x86" | "x86_64" => X86_ALLOWED_FEATURES, |
314 |
| - "hexagon" => HEXAGON_ALLOWED_FEATURES, |
315 |
| - "mips" | "mips64" => MIPS_ALLOWED_FEATURES, |
316 |
| - "powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES, |
317 |
| - "riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES, |
318 |
| - "wasm32" => WASM_ALLOWED_FEATURES, |
319 |
| - _ => &[], |
320 |
| - } |
321 |
| -} |
322 |
| - |
323 | 175 | pub fn print_version() {
|
324 | 176 | // Can be called without initializing LLVM
|
325 | 177 | unsafe {
|
|
0 commit comments