1use std::fmt;
2
3use rustc_data_structures::fx::FxIndexSet;
4use rustc_span::{Symbol, sym};
5
6use super::{InlineAsmArch, InlineAsmType, ModifierInfo};
7use crate::spec::{Env, Os, RelocModel, Target};
8
9#[allow(non_camel_case_types)]
pub enum AArch64InlineAsmRegClass { reg, vreg, vreg_low16, preg, }
#[automatically_derived]
#[allow(non_camel_case_types)]
impl ::core::marker::Copy for AArch64InlineAsmRegClass { }
#[automatically_derived]
#[doc(hidden)]
#[allow(non_camel_case_types)]
unsafe impl ::core::clone::TrivialClone for AArch64InlineAsmRegClass { }
#[automatically_derived]
#[allow(non_camel_case_types)]
impl ::core::clone::Clone for AArch64InlineAsmRegClass {
#[inline]
fn clone(&self) -> AArch64InlineAsmRegClass { *self }
}
const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for AArch64InlineAsmRegClass {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
AArch64InlineAsmRegClass::reg => { 0usize }
AArch64InlineAsmRegClass::vreg => { 1usize }
AArch64InlineAsmRegClass::vreg_low16 => { 2usize }
AArch64InlineAsmRegClass::preg => { 3usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
AArch64InlineAsmRegClass::reg => {}
AArch64InlineAsmRegClass::vreg => {}
AArch64InlineAsmRegClass::vreg_low16 => {}
AArch64InlineAsmRegClass::preg => {}
}
}
}
};
const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for AArch64InlineAsmRegClass {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { AArch64InlineAsmRegClass::reg }
1usize => { AArch64InlineAsmRegClass::vreg }
2usize => { AArch64InlineAsmRegClass::vreg_low16 }
3usize => { AArch64InlineAsmRegClass::preg }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `AArch64InlineAsmRegClass`, expected 0..4, actual {0}",
n));
}
}
}
}
};
#[automatically_derived]
#[allow(non_camel_case_types)]
impl ::core::fmt::Debug for AArch64InlineAsmRegClass {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
AArch64InlineAsmRegClass::reg => "reg",
AArch64InlineAsmRegClass::vreg => "vreg",
AArch64InlineAsmRegClass::vreg_low16 => "vreg_low16",
AArch64InlineAsmRegClass::preg => "preg",
})
}
}
#[automatically_derived]
#[allow(non_camel_case_types)]
impl ::core::cmp::Eq for AArch64InlineAsmRegClass {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
#[allow(non_camel_case_types)]
impl ::core::marker::StructuralPartialEq for AArch64InlineAsmRegClass { }
#[automatically_derived]
#[allow(non_camel_case_types)]
impl ::core::cmp::PartialEq for AArch64InlineAsmRegClass {
#[inline]
fn eq(&self, other: &AArch64InlineAsmRegClass) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}
#[automatically_derived]
#[allow(non_camel_case_types)]
impl ::core::cmp::PartialOrd for AArch64InlineAsmRegClass {
#[inline]
fn partial_cmp(&self, other: &AArch64InlineAsmRegClass)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
}
}
#[automatically_derived]
#[allow(non_camel_case_types)]
impl ::core::hash::Hash for AArch64InlineAsmRegClass {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state)
}
}
const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for AArch64InlineAsmRegClass where __CTX: crate::HashStableContext
{
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
AArch64InlineAsmRegClass::reg => {}
AArch64InlineAsmRegClass::vreg => {}
AArch64InlineAsmRegClass::vreg_low16 => {}
AArch64InlineAsmRegClass::preg => {}
}
}
}
};
impl AArch64InlineAsmRegClass {
pub fn name(self) -> rustc_span::Symbol {
match self {
Self::reg => rustc_span::sym::reg,
Self::vreg => rustc_span::sym::vreg,
Self::vreg_low16 => rustc_span::sym::vreg_low16,
Self::preg => rustc_span::sym::preg,
}
}
pub fn parse(name: rustc_span::Symbol)
-> Result<Self, &'static [rustc_span::Symbol]> {
match name {
rustc_span::sym::reg => Ok(Self::reg),
rustc_span::sym::vreg => Ok(Self::vreg),
rustc_span::sym::vreg_low16 => Ok(Self::vreg_low16),
rustc_span::sym::preg => Ok(Self::preg),
_ =>
Err(&[rustc_span::sym::reg, rustc_span::sym::vreg,
rustc_span::sym::vreg_low16, rustc_span::sym::preg]),
}
}
}
pub(super) fn regclass_map()
->
rustc_data_structures::fx::FxHashMap<super::InlineAsmRegClass,
rustc_data_structures::fx::FxIndexSet<super::InlineAsmReg>> {
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::FxIndexSet;
use super::InlineAsmRegClass;
let mut map = FxHashMap::default();
map.insert(InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg),
FxIndexSet::default());
map.insert(InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg),
FxIndexSet::default());
map.insert(InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16),
FxIndexSet::default());
map.insert(InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg),
FxIndexSet::default());
map
}def_reg_class! {
10 AArch64 AArch64InlineAsmRegClass {
11 reg,
12 vreg,
13 vreg_low16,
14 preg,
15 }
16}
17
18impl AArch64InlineAsmRegClass {
19 pub fn valid_modifiers(self, _arch: super::InlineAsmArch) -> &'static [char] {
20 match self {
21 Self::reg => &['w', 'x'],
22 Self::vreg | Self::vreg_low16 => &['b', 'h', 's', 'd', 'q', 'v'],
23 Self::preg => &[],
24 }
25 }
26
27 pub fn suggest_class(self, _arch: InlineAsmArch, _ty: InlineAsmType) -> Option<Self> {
28 None
29 }
30
31 pub fn suggest_modifier(self, _arch: InlineAsmArch, ty: InlineAsmType) -> Option<ModifierInfo> {
32 match self {
33 Self::reg => match ty.size().bits() {
34 64 => None,
35 _ => Some(('w', "w0", 32).into()),
36 },
37 Self::vreg | Self::vreg_low16 => match ty.size().bits() {
38 8 => Some(('b', "b0", 8).into()),
39 16 => Some(('h', "h0", 16).into()),
40 32 => Some(('s', "s0", 32).into()),
41 64 => Some(('d', "d0", 64).into()),
42 128 => Some(('q', "q0", 128).into()),
43 _ => None,
44 },
45 Self::preg => None,
46 }
47 }
48
49 pub fn default_modifier(self, _arch: InlineAsmArch) -> Option<ModifierInfo> {
50 match self {
51 Self::reg => Some(('x', "x0", 64).into()),
52 Self::vreg | Self::vreg_low16 => Some(('v', "v0", 128).into()),
53 Self::preg => None,
54 }
55 }
56
57 pub fn supported_types(
58 self,
59 _arch: InlineAsmArch,
60 ) -> &'static [(InlineAsmType, Option<Symbol>)] {
61 match self {
62 Self::reg => {
use super::InlineAsmType::*;
&[(I8, None), (I16, None), (I32, None), (I64, None), (F16, None),
(F32, None), (F64, None)]
}types! { _: I8, I16, I32, I64, F16, F32, F64; },
63 Self::vreg | Self::vreg_low16 => {
use super::InlineAsmType::*;
&[(I8, Some(rustc_span::sym::neon)), (I16, Some(rustc_span::sym::neon)),
(I32, Some(rustc_span::sym::neon)),
(I64, Some(rustc_span::sym::neon)),
(F16, Some(rustc_span::sym::neon)),
(F32, Some(rustc_span::sym::neon)),
(F64, Some(rustc_span::sym::neon)),
(F128, Some(rustc_span::sym::neon)),
(VecI8(8), Some(rustc_span::sym::neon)),
(VecI16(4), Some(rustc_span::sym::neon)),
(VecI32(2), Some(rustc_span::sym::neon)),
(VecI64(1), Some(rustc_span::sym::neon)),
(VecF16(4), Some(rustc_span::sym::neon)),
(VecF32(2), Some(rustc_span::sym::neon)),
(VecF64(1), Some(rustc_span::sym::neon)),
(VecI8(16), Some(rustc_span::sym::neon)),
(VecI16(8), Some(rustc_span::sym::neon)),
(VecI32(4), Some(rustc_span::sym::neon)),
(VecI64(2), Some(rustc_span::sym::neon)),
(VecF16(8), Some(rustc_span::sym::neon)),
(VecF32(4), Some(rustc_span::sym::neon)),
(VecF64(2), Some(rustc_span::sym::neon))]
}types! {
64 neon: I8, I16, I32, I64, F16, F32, F64, F128,
65 VecI8(8), VecI16(4), VecI32(2), VecI64(1), VecF16(4), VecF32(2), VecF64(1),
66 VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF16(8), VecF32(4), VecF64(2);
67 },
69 Self::preg => &[],
70 }
71 }
72}
73
74pub(crate) fn target_reserves_x18(target: &Target, target_features: &FxIndexSet<Symbol>) -> bool {
75 target.os == Os::Android
79 || target.os == Os::Fuchsia
80 || target.env == Env::Ohos
81 || target.is_like_darwin
82 || target.is_like_windows
83 || target_features.contains(&sym::reserve_x18)
84}
85
86fn reserved_x18(
87 _arch: InlineAsmArch,
88 _reloc_model: RelocModel,
89 target_features: &FxIndexSet<Symbol>,
90 target: &Target,
91 _is_clobber: bool,
92) -> Result<(), &'static str> {
93 if target_reserves_x18(target, target_features) {
94 Err("x18 is a reserved register on this target")
95 } else {
96 Ok(())
97 }
98}
99
100fn restricted_for_arm64ec(
101 arch: InlineAsmArch,
102 _reloc_model: RelocModel,
103 _target_features: &FxIndexSet<Symbol>,
104 _target: &Target,
105 _is_clobber: bool,
106) -> Result<(), &'static str> {
107 if arch == InlineAsmArch::Arm64EC {
108 Err("x13, x14, x23, x24, x28, v16-v31, p*, ffr cannot be used for Arm64EC")
109 } else {
110 Ok(())
111 }
112}
113
114#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
pub enum AArch64InlineAsmReg {
x0,
x1,
x2,
x3,
x4,
x5,
x6,
x7,
x8,
x9,
x10,
x11,
x12,
x13,
x14,
x15,
x16,
x17,
x18,
x20,
x21,
x22,
x23,
x24,
x25,
x26,
x27,
x28,
x30,
v0,
v1,
v2,
v3,
v4,
v5,
v6,
v7,
v8,
v9,
v10,
v11,
v12,
v13,
v14,
v15,
v16,
v17,
v18,
v19,
v20,
v21,
v22,
v23,
v24,
v25,
v26,
v27,
v28,
v29,
v30,
v31,
p0,
p1,
p2,
p3,
p4,
p5,
p6,
p7,
p8,
p9,
p10,
p11,
p12,
p13,
p14,
p15,
ffr,
}
#[automatically_derived]
#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
impl ::core::marker::Copy for AArch64InlineAsmReg { }
#[automatically_derived]
#[doc(hidden)]
#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
unsafe impl ::core::clone::TrivialClone for AArch64InlineAsmReg { }
#[automatically_derived]
#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
impl ::core::clone::Clone for AArch64InlineAsmReg {
#[inline]
fn clone(&self) -> AArch64InlineAsmReg { *self }
}
const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for AArch64InlineAsmReg {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
AArch64InlineAsmReg::x0 => { 0usize }
AArch64InlineAsmReg::x1 => { 1usize }
AArch64InlineAsmReg::x2 => { 2usize }
AArch64InlineAsmReg::x3 => { 3usize }
AArch64InlineAsmReg::x4 => { 4usize }
AArch64InlineAsmReg::x5 => { 5usize }
AArch64InlineAsmReg::x6 => { 6usize }
AArch64InlineAsmReg::x7 => { 7usize }
AArch64InlineAsmReg::x8 => { 8usize }
AArch64InlineAsmReg::x9 => { 9usize }
AArch64InlineAsmReg::x10 => { 10usize }
AArch64InlineAsmReg::x11 => { 11usize }
AArch64InlineAsmReg::x12 => { 12usize }
AArch64InlineAsmReg::x13 => { 13usize }
AArch64InlineAsmReg::x14 => { 14usize }
AArch64InlineAsmReg::x15 => { 15usize }
AArch64InlineAsmReg::x16 => { 16usize }
AArch64InlineAsmReg::x17 => { 17usize }
AArch64InlineAsmReg::x18 => { 18usize }
AArch64InlineAsmReg::x20 => { 19usize }
AArch64InlineAsmReg::x21 => { 20usize }
AArch64InlineAsmReg::x22 => { 21usize }
AArch64InlineAsmReg::x23 => { 22usize }
AArch64InlineAsmReg::x24 => { 23usize }
AArch64InlineAsmReg::x25 => { 24usize }
AArch64InlineAsmReg::x26 => { 25usize }
AArch64InlineAsmReg::x27 => { 26usize }
AArch64InlineAsmReg::x28 => { 27usize }
AArch64InlineAsmReg::x30 => { 28usize }
AArch64InlineAsmReg::v0 => { 29usize }
AArch64InlineAsmReg::v1 => { 30usize }
AArch64InlineAsmReg::v2 => { 31usize }
AArch64InlineAsmReg::v3 => { 32usize }
AArch64InlineAsmReg::v4 => { 33usize }
AArch64InlineAsmReg::v5 => { 34usize }
AArch64InlineAsmReg::v6 => { 35usize }
AArch64InlineAsmReg::v7 => { 36usize }
AArch64InlineAsmReg::v8 => { 37usize }
AArch64InlineAsmReg::v9 => { 38usize }
AArch64InlineAsmReg::v10 => { 39usize }
AArch64InlineAsmReg::v11 => { 40usize }
AArch64InlineAsmReg::v12 => { 41usize }
AArch64InlineAsmReg::v13 => { 42usize }
AArch64InlineAsmReg::v14 => { 43usize }
AArch64InlineAsmReg::v15 => { 44usize }
AArch64InlineAsmReg::v16 => { 45usize }
AArch64InlineAsmReg::v17 => { 46usize }
AArch64InlineAsmReg::v18 => { 47usize }
AArch64InlineAsmReg::v19 => { 48usize }
AArch64InlineAsmReg::v20 => { 49usize }
AArch64InlineAsmReg::v21 => { 50usize }
AArch64InlineAsmReg::v22 => { 51usize }
AArch64InlineAsmReg::v23 => { 52usize }
AArch64InlineAsmReg::v24 => { 53usize }
AArch64InlineAsmReg::v25 => { 54usize }
AArch64InlineAsmReg::v26 => { 55usize }
AArch64InlineAsmReg::v27 => { 56usize }
AArch64InlineAsmReg::v28 => { 57usize }
AArch64InlineAsmReg::v29 => { 58usize }
AArch64InlineAsmReg::v30 => { 59usize }
AArch64InlineAsmReg::v31 => { 60usize }
AArch64InlineAsmReg::p0 => { 61usize }
AArch64InlineAsmReg::p1 => { 62usize }
AArch64InlineAsmReg::p2 => { 63usize }
AArch64InlineAsmReg::p3 => { 64usize }
AArch64InlineAsmReg::p4 => { 65usize }
AArch64InlineAsmReg::p5 => { 66usize }
AArch64InlineAsmReg::p6 => { 67usize }
AArch64InlineAsmReg::p7 => { 68usize }
AArch64InlineAsmReg::p8 => { 69usize }
AArch64InlineAsmReg::p9 => { 70usize }
AArch64InlineAsmReg::p10 => { 71usize }
AArch64InlineAsmReg::p11 => { 72usize }
AArch64InlineAsmReg::p12 => { 73usize }
AArch64InlineAsmReg::p13 => { 74usize }
AArch64InlineAsmReg::p14 => { 75usize }
AArch64InlineAsmReg::p15 => { 76usize }
AArch64InlineAsmReg::ffr => { 77usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
AArch64InlineAsmReg::x0 => {}
AArch64InlineAsmReg::x1 => {}
AArch64InlineAsmReg::x2 => {}
AArch64InlineAsmReg::x3 => {}
AArch64InlineAsmReg::x4 => {}
AArch64InlineAsmReg::x5 => {}
AArch64InlineAsmReg::x6 => {}
AArch64InlineAsmReg::x7 => {}
AArch64InlineAsmReg::x8 => {}
AArch64InlineAsmReg::x9 => {}
AArch64InlineAsmReg::x10 => {}
AArch64InlineAsmReg::x11 => {}
AArch64InlineAsmReg::x12 => {}
AArch64InlineAsmReg::x13 => {}
AArch64InlineAsmReg::x14 => {}
AArch64InlineAsmReg::x15 => {}
AArch64InlineAsmReg::x16 => {}
AArch64InlineAsmReg::x17 => {}
AArch64InlineAsmReg::x18 => {}
AArch64InlineAsmReg::x20 => {}
AArch64InlineAsmReg::x21 => {}
AArch64InlineAsmReg::x22 => {}
AArch64InlineAsmReg::x23 => {}
AArch64InlineAsmReg::x24 => {}
AArch64InlineAsmReg::x25 => {}
AArch64InlineAsmReg::x26 => {}
AArch64InlineAsmReg::x27 => {}
AArch64InlineAsmReg::x28 => {}
AArch64InlineAsmReg::x30 => {}
AArch64InlineAsmReg::v0 => {}
AArch64InlineAsmReg::v1 => {}
AArch64InlineAsmReg::v2 => {}
AArch64InlineAsmReg::v3 => {}
AArch64InlineAsmReg::v4 => {}
AArch64InlineAsmReg::v5 => {}
AArch64InlineAsmReg::v6 => {}
AArch64InlineAsmReg::v7 => {}
AArch64InlineAsmReg::v8 => {}
AArch64InlineAsmReg::v9 => {}
AArch64InlineAsmReg::v10 => {}
AArch64InlineAsmReg::v11 => {}
AArch64InlineAsmReg::v12 => {}
AArch64InlineAsmReg::v13 => {}
AArch64InlineAsmReg::v14 => {}
AArch64InlineAsmReg::v15 => {}
AArch64InlineAsmReg::v16 => {}
AArch64InlineAsmReg::v17 => {}
AArch64InlineAsmReg::v18 => {}
AArch64InlineAsmReg::v19 => {}
AArch64InlineAsmReg::v20 => {}
AArch64InlineAsmReg::v21 => {}
AArch64InlineAsmReg::v22 => {}
AArch64InlineAsmReg::v23 => {}
AArch64InlineAsmReg::v24 => {}
AArch64InlineAsmReg::v25 => {}
AArch64InlineAsmReg::v26 => {}
AArch64InlineAsmReg::v27 => {}
AArch64InlineAsmReg::v28 => {}
AArch64InlineAsmReg::v29 => {}
AArch64InlineAsmReg::v30 => {}
AArch64InlineAsmReg::v31 => {}
AArch64InlineAsmReg::p0 => {}
AArch64InlineAsmReg::p1 => {}
AArch64InlineAsmReg::p2 => {}
AArch64InlineAsmReg::p3 => {}
AArch64InlineAsmReg::p4 => {}
AArch64InlineAsmReg::p5 => {}
AArch64InlineAsmReg::p6 => {}
AArch64InlineAsmReg::p7 => {}
AArch64InlineAsmReg::p8 => {}
AArch64InlineAsmReg::p9 => {}
AArch64InlineAsmReg::p10 => {}
AArch64InlineAsmReg::p11 => {}
AArch64InlineAsmReg::p12 => {}
AArch64InlineAsmReg::p13 => {}
AArch64InlineAsmReg::p14 => {}
AArch64InlineAsmReg::p15 => {}
AArch64InlineAsmReg::ffr => {}
}
}
}
};
const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for AArch64InlineAsmReg {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { AArch64InlineAsmReg::x0 }
1usize => { AArch64InlineAsmReg::x1 }
2usize => { AArch64InlineAsmReg::x2 }
3usize => { AArch64InlineAsmReg::x3 }
4usize => { AArch64InlineAsmReg::x4 }
5usize => { AArch64InlineAsmReg::x5 }
6usize => { AArch64InlineAsmReg::x6 }
7usize => { AArch64InlineAsmReg::x7 }
8usize => { AArch64InlineAsmReg::x8 }
9usize => { AArch64InlineAsmReg::x9 }
10usize => { AArch64InlineAsmReg::x10 }
11usize => { AArch64InlineAsmReg::x11 }
12usize => { AArch64InlineAsmReg::x12 }
13usize => { AArch64InlineAsmReg::x13 }
14usize => { AArch64InlineAsmReg::x14 }
15usize => { AArch64InlineAsmReg::x15 }
16usize => { AArch64InlineAsmReg::x16 }
17usize => { AArch64InlineAsmReg::x17 }
18usize => { AArch64InlineAsmReg::x18 }
19usize => { AArch64InlineAsmReg::x20 }
20usize => { AArch64InlineAsmReg::x21 }
21usize => { AArch64InlineAsmReg::x22 }
22usize => { AArch64InlineAsmReg::x23 }
23usize => { AArch64InlineAsmReg::x24 }
24usize => { AArch64InlineAsmReg::x25 }
25usize => { AArch64InlineAsmReg::x26 }
26usize => { AArch64InlineAsmReg::x27 }
27usize => { AArch64InlineAsmReg::x28 }
28usize => { AArch64InlineAsmReg::x30 }
29usize => { AArch64InlineAsmReg::v0 }
30usize => { AArch64InlineAsmReg::v1 }
31usize => { AArch64InlineAsmReg::v2 }
32usize => { AArch64InlineAsmReg::v3 }
33usize => { AArch64InlineAsmReg::v4 }
34usize => { AArch64InlineAsmReg::v5 }
35usize => { AArch64InlineAsmReg::v6 }
36usize => { AArch64InlineAsmReg::v7 }
37usize => { AArch64InlineAsmReg::v8 }
38usize => { AArch64InlineAsmReg::v9 }
39usize => { AArch64InlineAsmReg::v10 }
40usize => { AArch64InlineAsmReg::v11 }
41usize => { AArch64InlineAsmReg::v12 }
42usize => { AArch64InlineAsmReg::v13 }
43usize => { AArch64InlineAsmReg::v14 }
44usize => { AArch64InlineAsmReg::v15 }
45usize => { AArch64InlineAsmReg::v16 }
46usize => { AArch64InlineAsmReg::v17 }
47usize => { AArch64InlineAsmReg::v18 }
48usize => { AArch64InlineAsmReg::v19 }
49usize => { AArch64InlineAsmReg::v20 }
50usize => { AArch64InlineAsmReg::v21 }
51usize => { AArch64InlineAsmReg::v22 }
52usize => { AArch64InlineAsmReg::v23 }
53usize => { AArch64InlineAsmReg::v24 }
54usize => { AArch64InlineAsmReg::v25 }
55usize => { AArch64InlineAsmReg::v26 }
56usize => { AArch64InlineAsmReg::v27 }
57usize => { AArch64InlineAsmReg::v28 }
58usize => { AArch64InlineAsmReg::v29 }
59usize => { AArch64InlineAsmReg::v30 }
60usize => { AArch64InlineAsmReg::v31 }
61usize => { AArch64InlineAsmReg::p0 }
62usize => { AArch64InlineAsmReg::p1 }
63usize => { AArch64InlineAsmReg::p2 }
64usize => { AArch64InlineAsmReg::p3 }
65usize => { AArch64InlineAsmReg::p4 }
66usize => { AArch64InlineAsmReg::p5 }
67usize => { AArch64InlineAsmReg::p6 }
68usize => { AArch64InlineAsmReg::p7 }
69usize => { AArch64InlineAsmReg::p8 }
70usize => { AArch64InlineAsmReg::p9 }
71usize => { AArch64InlineAsmReg::p10 }
72usize => { AArch64InlineAsmReg::p11 }
73usize => { AArch64InlineAsmReg::p12 }
74usize => { AArch64InlineAsmReg::p13 }
75usize => { AArch64InlineAsmReg::p14 }
76usize => { AArch64InlineAsmReg::p15 }
77usize => { AArch64InlineAsmReg::ffr }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `AArch64InlineAsmReg`, expected 0..78, actual {0}",
n));
}
}
}
}
};
#[automatically_derived]
#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
impl ::core::fmt::Debug for AArch64InlineAsmReg {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
AArch64InlineAsmReg::x0 => "x0",
AArch64InlineAsmReg::x1 => "x1",
AArch64InlineAsmReg::x2 => "x2",
AArch64InlineAsmReg::x3 => "x3",
AArch64InlineAsmReg::x4 => "x4",
AArch64InlineAsmReg::x5 => "x5",
AArch64InlineAsmReg::x6 => "x6",
AArch64InlineAsmReg::x7 => "x7",
AArch64InlineAsmReg::x8 => "x8",
AArch64InlineAsmReg::x9 => "x9",
AArch64InlineAsmReg::x10 => "x10",
AArch64InlineAsmReg::x11 => "x11",
AArch64InlineAsmReg::x12 => "x12",
AArch64InlineAsmReg::x13 => "x13",
AArch64InlineAsmReg::x14 => "x14",
AArch64InlineAsmReg::x15 => "x15",
AArch64InlineAsmReg::x16 => "x16",
AArch64InlineAsmReg::x17 => "x17",
AArch64InlineAsmReg::x18 => "x18",
AArch64InlineAsmReg::x20 => "x20",
AArch64InlineAsmReg::x21 => "x21",
AArch64InlineAsmReg::x22 => "x22",
AArch64InlineAsmReg::x23 => "x23",
AArch64InlineAsmReg::x24 => "x24",
AArch64InlineAsmReg::x25 => "x25",
AArch64InlineAsmReg::x26 => "x26",
AArch64InlineAsmReg::x27 => "x27",
AArch64InlineAsmReg::x28 => "x28",
AArch64InlineAsmReg::x30 => "x30",
AArch64InlineAsmReg::v0 => "v0",
AArch64InlineAsmReg::v1 => "v1",
AArch64InlineAsmReg::v2 => "v2",
AArch64InlineAsmReg::v3 => "v3",
AArch64InlineAsmReg::v4 => "v4",
AArch64InlineAsmReg::v5 => "v5",
AArch64InlineAsmReg::v6 => "v6",
AArch64InlineAsmReg::v7 => "v7",
AArch64InlineAsmReg::v8 => "v8",
AArch64InlineAsmReg::v9 => "v9",
AArch64InlineAsmReg::v10 => "v10",
AArch64InlineAsmReg::v11 => "v11",
AArch64InlineAsmReg::v12 => "v12",
AArch64InlineAsmReg::v13 => "v13",
AArch64InlineAsmReg::v14 => "v14",
AArch64InlineAsmReg::v15 => "v15",
AArch64InlineAsmReg::v16 => "v16",
AArch64InlineAsmReg::v17 => "v17",
AArch64InlineAsmReg::v18 => "v18",
AArch64InlineAsmReg::v19 => "v19",
AArch64InlineAsmReg::v20 => "v20",
AArch64InlineAsmReg::v21 => "v21",
AArch64InlineAsmReg::v22 => "v22",
AArch64InlineAsmReg::v23 => "v23",
AArch64InlineAsmReg::v24 => "v24",
AArch64InlineAsmReg::v25 => "v25",
AArch64InlineAsmReg::v26 => "v26",
AArch64InlineAsmReg::v27 => "v27",
AArch64InlineAsmReg::v28 => "v28",
AArch64InlineAsmReg::v29 => "v29",
AArch64InlineAsmReg::v30 => "v30",
AArch64InlineAsmReg::v31 => "v31",
AArch64InlineAsmReg::p0 => "p0",
AArch64InlineAsmReg::p1 => "p1",
AArch64InlineAsmReg::p2 => "p2",
AArch64InlineAsmReg::p3 => "p3",
AArch64InlineAsmReg::p4 => "p4",
AArch64InlineAsmReg::p5 => "p5",
AArch64InlineAsmReg::p6 => "p6",
AArch64InlineAsmReg::p7 => "p7",
AArch64InlineAsmReg::p8 => "p8",
AArch64InlineAsmReg::p9 => "p9",
AArch64InlineAsmReg::p10 => "p10",
AArch64InlineAsmReg::p11 => "p11",
AArch64InlineAsmReg::p12 => "p12",
AArch64InlineAsmReg::p13 => "p13",
AArch64InlineAsmReg::p14 => "p14",
AArch64InlineAsmReg::p15 => "p15",
AArch64InlineAsmReg::ffr => "ffr",
})
}
}
#[automatically_derived]
#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
impl ::core::cmp::Eq for AArch64InlineAsmReg {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
impl ::core::marker::StructuralPartialEq for AArch64InlineAsmReg { }
#[automatically_derived]
#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
impl ::core::cmp::PartialEq for AArch64InlineAsmReg {
#[inline]
fn eq(&self, other: &AArch64InlineAsmReg) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}
#[automatically_derived]
#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
impl ::core::cmp::PartialOrd for AArch64InlineAsmReg {
#[inline]
fn partial_cmp(&self, other: &AArch64InlineAsmReg)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
}
}
#[automatically_derived]
#[allow(unreachable_code)]
#[allow(non_camel_case_types)]
impl ::core::hash::Hash for AArch64InlineAsmReg {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state)
}
}
const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for AArch64InlineAsmReg where __CTX: crate::HashStableContext {
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
AArch64InlineAsmReg::x0 => {}
AArch64InlineAsmReg::x1 => {}
AArch64InlineAsmReg::x2 => {}
AArch64InlineAsmReg::x3 => {}
AArch64InlineAsmReg::x4 => {}
AArch64InlineAsmReg::x5 => {}
AArch64InlineAsmReg::x6 => {}
AArch64InlineAsmReg::x7 => {}
AArch64InlineAsmReg::x8 => {}
AArch64InlineAsmReg::x9 => {}
AArch64InlineAsmReg::x10 => {}
AArch64InlineAsmReg::x11 => {}
AArch64InlineAsmReg::x12 => {}
AArch64InlineAsmReg::x13 => {}
AArch64InlineAsmReg::x14 => {}
AArch64InlineAsmReg::x15 => {}
AArch64InlineAsmReg::x16 => {}
AArch64InlineAsmReg::x17 => {}
AArch64InlineAsmReg::x18 => {}
AArch64InlineAsmReg::x20 => {}
AArch64InlineAsmReg::x21 => {}
AArch64InlineAsmReg::x22 => {}
AArch64InlineAsmReg::x23 => {}
AArch64InlineAsmReg::x24 => {}
AArch64InlineAsmReg::x25 => {}
AArch64InlineAsmReg::x26 => {}
AArch64InlineAsmReg::x27 => {}
AArch64InlineAsmReg::x28 => {}
AArch64InlineAsmReg::x30 => {}
AArch64InlineAsmReg::v0 => {}
AArch64InlineAsmReg::v1 => {}
AArch64InlineAsmReg::v2 => {}
AArch64InlineAsmReg::v3 => {}
AArch64InlineAsmReg::v4 => {}
AArch64InlineAsmReg::v5 => {}
AArch64InlineAsmReg::v6 => {}
AArch64InlineAsmReg::v7 => {}
AArch64InlineAsmReg::v8 => {}
AArch64InlineAsmReg::v9 => {}
AArch64InlineAsmReg::v10 => {}
AArch64InlineAsmReg::v11 => {}
AArch64InlineAsmReg::v12 => {}
AArch64InlineAsmReg::v13 => {}
AArch64InlineAsmReg::v14 => {}
AArch64InlineAsmReg::v15 => {}
AArch64InlineAsmReg::v16 => {}
AArch64InlineAsmReg::v17 => {}
AArch64InlineAsmReg::v18 => {}
AArch64InlineAsmReg::v19 => {}
AArch64InlineAsmReg::v20 => {}
AArch64InlineAsmReg::v21 => {}
AArch64InlineAsmReg::v22 => {}
AArch64InlineAsmReg::v23 => {}
AArch64InlineAsmReg::v24 => {}
AArch64InlineAsmReg::v25 => {}
AArch64InlineAsmReg::v26 => {}
AArch64InlineAsmReg::v27 => {}
AArch64InlineAsmReg::v28 => {}
AArch64InlineAsmReg::v29 => {}
AArch64InlineAsmReg::v30 => {}
AArch64InlineAsmReg::v31 => {}
AArch64InlineAsmReg::p0 => {}
AArch64InlineAsmReg::p1 => {}
AArch64InlineAsmReg::p2 => {}
AArch64InlineAsmReg::p3 => {}
AArch64InlineAsmReg::p4 => {}
AArch64InlineAsmReg::p5 => {}
AArch64InlineAsmReg::p6 => {}
AArch64InlineAsmReg::p7 => {}
AArch64InlineAsmReg::p8 => {}
AArch64InlineAsmReg::p9 => {}
AArch64InlineAsmReg::p10 => {}
AArch64InlineAsmReg::p11 => {}
AArch64InlineAsmReg::p12 => {}
AArch64InlineAsmReg::p13 => {}
AArch64InlineAsmReg::p14 => {}
AArch64InlineAsmReg::p15 => {}
AArch64InlineAsmReg::ffr => {}
}
}
}
};
impl AArch64InlineAsmReg {
pub fn name(self) -> &'static str {
match self {
Self::x0 => "x0",
Self::x1 => "x1",
Self::x2 => "x2",
Self::x3 => "x3",
Self::x4 => "x4",
Self::x5 => "x5",
Self::x6 => "x6",
Self::x7 => "x7",
Self::x8 => "x8",
Self::x9 => "x9",
Self::x10 => "x10",
Self::x11 => "x11",
Self::x12 => "x12",
Self::x13 => "x13",
Self::x14 => "x14",
Self::x15 => "x15",
Self::x16 => "x16",
Self::x17 => "x17",
Self::x18 => "x18",
Self::x20 => "x20",
Self::x21 => "x21",
Self::x22 => "x22",
Self::x23 => "x23",
Self::x24 => "x24",
Self::x25 => "x25",
Self::x26 => "x26",
Self::x27 => "x27",
Self::x28 => "x28",
Self::x30 => "x30",
Self::v0 => "v0",
Self::v1 => "v1",
Self::v2 => "v2",
Self::v3 => "v3",
Self::v4 => "v4",
Self::v5 => "v5",
Self::v6 => "v6",
Self::v7 => "v7",
Self::v8 => "v8",
Self::v9 => "v9",
Self::v10 => "v10",
Self::v11 => "v11",
Self::v12 => "v12",
Self::v13 => "v13",
Self::v14 => "v14",
Self::v15 => "v15",
Self::v16 => "v16",
Self::v17 => "v17",
Self::v18 => "v18",
Self::v19 => "v19",
Self::v20 => "v20",
Self::v21 => "v21",
Self::v22 => "v22",
Self::v23 => "v23",
Self::v24 => "v24",
Self::v25 => "v25",
Self::v26 => "v26",
Self::v27 => "v27",
Self::v28 => "v28",
Self::v29 => "v29",
Self::v30 => "v30",
Self::v31 => "v31",
Self::p0 => "p0",
Self::p1 => "p1",
Self::p2 => "p2",
Self::p3 => "p3",
Self::p4 => "p4",
Self::p5 => "p5",
Self::p6 => "p6",
Self::p7 => "p7",
Self::p8 => "p8",
Self::p9 => "p9",
Self::p10 => "p10",
Self::p11 => "p11",
Self::p12 => "p12",
Self::p13 => "p13",
Self::p14 => "p14",
Self::p15 => "p15",
Self::ffr => "ffr",
}
}
pub fn reg_class(self) -> AArch64InlineAsmRegClass {
match self {
Self::x0 => AArch64InlineAsmRegClass::reg,
Self::x1 => AArch64InlineAsmRegClass::reg,
Self::x2 => AArch64InlineAsmRegClass::reg,
Self::x3 => AArch64InlineAsmRegClass::reg,
Self::x4 => AArch64InlineAsmRegClass::reg,
Self::x5 => AArch64InlineAsmRegClass::reg,
Self::x6 => AArch64InlineAsmRegClass::reg,
Self::x7 => AArch64InlineAsmRegClass::reg,
Self::x8 => AArch64InlineAsmRegClass::reg,
Self::x9 => AArch64InlineAsmRegClass::reg,
Self::x10 => AArch64InlineAsmRegClass::reg,
Self::x11 => AArch64InlineAsmRegClass::reg,
Self::x12 => AArch64InlineAsmRegClass::reg,
Self::x13 => AArch64InlineAsmRegClass::reg,
Self::x14 => AArch64InlineAsmRegClass::reg,
Self::x15 => AArch64InlineAsmRegClass::reg,
Self::x16 => AArch64InlineAsmRegClass::reg,
Self::x17 => AArch64InlineAsmRegClass::reg,
Self::x18 => AArch64InlineAsmRegClass::reg,
Self::x20 => AArch64InlineAsmRegClass::reg,
Self::x21 => AArch64InlineAsmRegClass::reg,
Self::x22 => AArch64InlineAsmRegClass::reg,
Self::x23 => AArch64InlineAsmRegClass::reg,
Self::x24 => AArch64InlineAsmRegClass::reg,
Self::x25 => AArch64InlineAsmRegClass::reg,
Self::x26 => AArch64InlineAsmRegClass::reg,
Self::x27 => AArch64InlineAsmRegClass::reg,
Self::x28 => AArch64InlineAsmRegClass::reg,
Self::x30 => AArch64InlineAsmRegClass::reg,
Self::v0 => AArch64InlineAsmRegClass::vreg,
Self::v1 => AArch64InlineAsmRegClass::vreg,
Self::v2 => AArch64InlineAsmRegClass::vreg,
Self::v3 => AArch64InlineAsmRegClass::vreg,
Self::v4 => AArch64InlineAsmRegClass::vreg,
Self::v5 => AArch64InlineAsmRegClass::vreg,
Self::v6 => AArch64InlineAsmRegClass::vreg,
Self::v7 => AArch64InlineAsmRegClass::vreg,
Self::v8 => AArch64InlineAsmRegClass::vreg,
Self::v9 => AArch64InlineAsmRegClass::vreg,
Self::v10 => AArch64InlineAsmRegClass::vreg,
Self::v11 => AArch64InlineAsmRegClass::vreg,
Self::v12 => AArch64InlineAsmRegClass::vreg,
Self::v13 => AArch64InlineAsmRegClass::vreg,
Self::v14 => AArch64InlineAsmRegClass::vreg,
Self::v15 => AArch64InlineAsmRegClass::vreg,
Self::v16 => AArch64InlineAsmRegClass::vreg,
Self::v17 => AArch64InlineAsmRegClass::vreg,
Self::v18 => AArch64InlineAsmRegClass::vreg,
Self::v19 => AArch64InlineAsmRegClass::vreg,
Self::v20 => AArch64InlineAsmRegClass::vreg,
Self::v21 => AArch64InlineAsmRegClass::vreg,
Self::v22 => AArch64InlineAsmRegClass::vreg,
Self::v23 => AArch64InlineAsmRegClass::vreg,
Self::v24 => AArch64InlineAsmRegClass::vreg,
Self::v25 => AArch64InlineAsmRegClass::vreg,
Self::v26 => AArch64InlineAsmRegClass::vreg,
Self::v27 => AArch64InlineAsmRegClass::vreg,
Self::v28 => AArch64InlineAsmRegClass::vreg,
Self::v29 => AArch64InlineAsmRegClass::vreg,
Self::v30 => AArch64InlineAsmRegClass::vreg,
Self::v31 => AArch64InlineAsmRegClass::vreg,
Self::p0 => AArch64InlineAsmRegClass::preg,
Self::p1 => AArch64InlineAsmRegClass::preg,
Self::p2 => AArch64InlineAsmRegClass::preg,
Self::p3 => AArch64InlineAsmRegClass::preg,
Self::p4 => AArch64InlineAsmRegClass::preg,
Self::p5 => AArch64InlineAsmRegClass::preg,
Self::p6 => AArch64InlineAsmRegClass::preg,
Self::p7 => AArch64InlineAsmRegClass::preg,
Self::p8 => AArch64InlineAsmRegClass::preg,
Self::p9 => AArch64InlineAsmRegClass::preg,
Self::p10 => AArch64InlineAsmRegClass::preg,
Self::p11 => AArch64InlineAsmRegClass::preg,
Self::p12 => AArch64InlineAsmRegClass::preg,
Self::p13 => AArch64InlineAsmRegClass::preg,
Self::p14 => AArch64InlineAsmRegClass::preg,
Self::p15 => AArch64InlineAsmRegClass::preg,
Self::ffr => AArch64InlineAsmRegClass::preg,
}
}
pub fn parse(name: &str) -> Result<Self, &'static str> {
match name {
"w0" | "x0" => Ok(Self::x0),
"w1" | "x1" => Ok(Self::x1),
"w2" | "x2" => Ok(Self::x2),
"w3" | "x3" => Ok(Self::x3),
"w4" | "x4" => Ok(Self::x4),
"w5" | "x5" => Ok(Self::x5),
"w6" | "x6" => Ok(Self::x6),
"w7" | "x7" => Ok(Self::x7),
"w8" | "x8" => Ok(Self::x8),
"w9" | "x9" => Ok(Self::x9),
"w10" | "x10" => Ok(Self::x10),
"w11" | "x11" => Ok(Self::x11),
"w12" | "x12" => Ok(Self::x12),
"w13" | "x13" => Ok(Self::x13),
"w14" | "x14" => Ok(Self::x14),
"w15" | "x15" => Ok(Self::x15),
"w16" | "x16" => Ok(Self::x16),
"w17" | "x17" => Ok(Self::x17),
"w18" | "x18" => Ok(Self::x18),
"w20" | "x20" => Ok(Self::x20),
"w21" | "x21" => Ok(Self::x21),
"w22" | "x22" => Ok(Self::x22),
"w23" | "x23" => Ok(Self::x23),
"w24" | "x24" => Ok(Self::x24),
"w25" | "x25" => Ok(Self::x25),
"w26" | "x26" => Ok(Self::x26),
"w27" | "x27" => Ok(Self::x27),
"w28" | "x28" => Ok(Self::x28),
"w30" | "lr" | "wlr" | "x30" => Ok(Self::x30),
"b0" | "h0" | "s0" | "d0" | "q0" | "z0" | "v0" => Ok(Self::v0),
"b1" | "h1" | "s1" | "d1" | "q1" | "z1" | "v1" => Ok(Self::v1),
"b2" | "h2" | "s2" | "d2" | "q2" | "z2" | "v2" => Ok(Self::v2),
"b3" | "h3" | "s3" | "d3" | "q3" | "z3" | "v3" => Ok(Self::v3),
"b4" | "h4" | "s4" | "d4" | "q4" | "z4" | "v4" => Ok(Self::v4),
"b5" | "h5" | "s5" | "d5" | "q5" | "z5" | "v5" => Ok(Self::v5),
"b6" | "h6" | "s6" | "d6" | "q6" | "z6" | "v6" => Ok(Self::v6),
"b7" | "h7" | "s7" | "d7" | "q7" | "z7" | "v7" => Ok(Self::v7),
"b8" | "h8" | "s8" | "d8" | "q8" | "z8" | "v8" => Ok(Self::v8),
"b9" | "h9" | "s9" | "d9" | "q9" | "z9" | "v9" => Ok(Self::v9),
"b10" | "h10" | "s10" | "d10" | "q10" | "z10" | "v10" =>
Ok(Self::v10),
"b11" | "h11" | "s11" | "d11" | "q11" | "z11" | "v11" =>
Ok(Self::v11),
"b12" | "h12" | "s12" | "d12" | "q12" | "z12" | "v12" =>
Ok(Self::v12),
"b13" | "h13" | "s13" | "d13" | "q13" | "z13" | "v13" =>
Ok(Self::v13),
"b14" | "h14" | "s14" | "d14" | "q14" | "z14" | "v14" =>
Ok(Self::v14),
"b15" | "h15" | "s15" | "d15" | "q15" | "z15" | "v15" =>
Ok(Self::v15),
"b16" | "h16" | "s16" | "d16" | "q16" | "z16" | "v16" =>
Ok(Self::v16),
"b17" | "h17" | "s17" | "d17" | "q17" | "z17" | "v17" =>
Ok(Self::v17),
"b18" | "h18" | "s18" | "d18" | "q18" | "z18" | "v18" =>
Ok(Self::v18),
"b19" | "h19" | "s19" | "d19" | "q19" | "z19" | "v19" =>
Ok(Self::v19),
"b20" | "h20" | "s20" | "d20" | "q20" | "z20" | "v20" =>
Ok(Self::v20),
"b21" | "h21" | "s21" | "d21" | "q21" | "z21" | "v21" =>
Ok(Self::v21),
"b22" | "h22" | "s22" | "d22" | "q22" | "z22" | "v22" =>
Ok(Self::v22),
"b23" | "h23" | "s23" | "d23" | "q23" | "z23" | "v23" =>
Ok(Self::v23),
"b24" | "h24" | "s24" | "d24" | "q24" | "z24" | "v24" =>
Ok(Self::v24),
"b25" | "h25" | "s25" | "d25" | "q25" | "z25" | "v25" =>
Ok(Self::v25),
"b26" | "h26" | "s26" | "d26" | "q26" | "z26" | "v26" =>
Ok(Self::v26),
"b27" | "h27" | "s27" | "d27" | "q27" | "z27" | "v27" =>
Ok(Self::v27),
"b28" | "h28" | "s28" | "d28" | "q28" | "z28" | "v28" =>
Ok(Self::v28),
"b29" | "h29" | "s29" | "d29" | "q29" | "z29" | "v29" =>
Ok(Self::v29),
"b30" | "h30" | "s30" | "d30" | "q30" | "z30" | "v30" =>
Ok(Self::v30),
"b31" | "h31" | "s31" | "d31" | "q31" | "z31" | "v31" =>
Ok(Self::v31),
"p0" => Ok(Self::p0),
"p1" => Ok(Self::p1),
"p2" => Ok(Self::p2),
"p3" => Ok(Self::p3),
"p4" => Ok(Self::p4),
"p5" => Ok(Self::p5),
"p6" => Ok(Self::p6),
"p7" => Ok(Self::p7),
"p8" => Ok(Self::p8),
"p9" => Ok(Self::p9),
"p10" => Ok(Self::p10),
"p11" => Ok(Self::p11),
"p12" => Ok(Self::p12),
"p13" => Ok(Self::p13),
"p14" => Ok(Self::p14),
"p15" => Ok(Self::p15),
"ffr" => Ok(Self::ffr),
"x19" | "w19" =>
Err("x19 is used internally by LLVM and cannot be used as an operand for inline asm"),
"x29" | "w29" | "fp" | "wfp" =>
Err("the frame pointer cannot be used as an operand for inline asm"),
"sp" | "wsp" =>
Err("the stack pointer cannot be used as an operand for inline asm"),
"xzr" | "wzr" =>
Err("the zero register cannot be used as an operand for inline asm"),
_ => Err("unknown register"),
}
}
pub fn validate(self, _arch: super::InlineAsmArch,
_reloc_model: crate::spec::RelocModel,
_target_features: &rustc_data_structures::fx::FxIndexSet<Symbol>,
_target: &crate::spec::Target, _is_clobber: bool)
-> Result<(), &'static str> {
match self {
Self::x0 => { Ok(()) }
Self::x1 => { Ok(()) }
Self::x2 => { Ok(()) }
Self::x3 => { Ok(()) }
Self::x4 => { Ok(()) }
Self::x5 => { Ok(()) }
Self::x6 => { Ok(()) }
Self::x7 => { Ok(()) }
Self::x8 => { Ok(()) }
Self::x9 => { Ok(()) }
Self::x10 => { Ok(()) }
Self::x11 => { Ok(()) }
Self::x12 => { Ok(()) }
Self::x13 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::x14 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::x15 => { Ok(()) }
Self::x16 => { Ok(()) }
Self::x17 => { Ok(()) }
Self::x18 => {
reserved_x18(_arch, _reloc_model, _target_features, _target,
_is_clobber)?;
Ok(())
}
Self::x20 => { Ok(()) }
Self::x21 => { Ok(()) }
Self::x22 => { Ok(()) }
Self::x23 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::x24 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::x25 => { Ok(()) }
Self::x26 => { Ok(()) }
Self::x27 => { Ok(()) }
Self::x28 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::x30 => { Ok(()) }
Self::v0 => { Ok(()) }
Self::v1 => { Ok(()) }
Self::v2 => { Ok(()) }
Self::v3 => { Ok(()) }
Self::v4 => { Ok(()) }
Self::v5 => { Ok(()) }
Self::v6 => { Ok(()) }
Self::v7 => { Ok(()) }
Self::v8 => { Ok(()) }
Self::v9 => { Ok(()) }
Self::v10 => { Ok(()) }
Self::v11 => { Ok(()) }
Self::v12 => { Ok(()) }
Self::v13 => { Ok(()) }
Self::v14 => { Ok(()) }
Self::v15 => { Ok(()) }
Self::v16 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v17 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v18 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v19 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v20 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v21 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v22 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v23 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v24 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v25 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v26 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v27 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v28 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v29 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v30 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::v31 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p0 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p1 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p2 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p3 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p4 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p5 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p6 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p7 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p8 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p9 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p10 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p11 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p12 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p13 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p14 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::p15 => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
Self::ffr => {
restricted_for_arm64ec(_arch, _reloc_model, _target_features,
_target, _is_clobber)?;
Ok(())
}
}
}
}
pub(super) fn fill_reg_map(_arch: super::InlineAsmArch,
_reloc_model: crate::spec::RelocModel,
_target_features: &rustc_data_structures::fx::FxIndexSet<Symbol>,
_target: &crate::spec::Target,
_map:
&mut rustc_data_structures::fx::FxHashMap<super::InlineAsmRegClass,
rustc_data_structures::fx::FxIndexSet<super::InlineAsmReg>>) {
#[allow(unused_imports)]
use super::{InlineAsmReg, InlineAsmRegClass};
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x0));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x1));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x2));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x3));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x4));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x5));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x6));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x7));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x8));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x9));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x10));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x11));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x12));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x13));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x14));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x15));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x16));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x17));
}
}
if reserved_x18(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x18));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x20));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x21));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x22));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x23));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x24));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x25));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x26));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x27));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x28));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::x30));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v0));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v0));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v1));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v1));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v2));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v2));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v3));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v3));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v4));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v4));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v5));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v5));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v6));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v6));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v7));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v7));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v8));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v8));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v9));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v9));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v10));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v10));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v11));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v11));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v12));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v12));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v13));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v13));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v14));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v14));
}
}
if true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v15));
}
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v15));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v16));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v17));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v18));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v19));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v20));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v21));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v22));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v23));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v24));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v25));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v26));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v27));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v28));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v29));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v30));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::v31));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p0));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p1));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p2));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p3));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p4));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p5));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p6));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p7));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p8));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p9));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p10));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p11));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p12));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p13));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p14));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::p15));
}
}
if restricted_for_arm64ec(_arch, _reloc_model, _target_features, _target,
false).is_ok() && true {
if let Some(set) =
_map.get_mut(&InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg))
{
set.insert(InlineAsmReg::AArch64(AArch64InlineAsmReg::ffr));
}
}
}def_regs! {
115 AArch64 AArch64InlineAsmReg AArch64InlineAsmRegClass {
116 x0: reg = ["x0", "w0"],
117 x1: reg = ["x1", "w1"],
118 x2: reg = ["x2", "w2"],
119 x3: reg = ["x3", "w3"],
120 x4: reg = ["x4", "w4"],
121 x5: reg = ["x5", "w5"],
122 x6: reg = ["x6", "w6"],
123 x7: reg = ["x7", "w7"],
124 x8: reg = ["x8", "w8"],
125 x9: reg = ["x9", "w9"],
126 x10: reg = ["x10", "w10"],
127 x11: reg = ["x11", "w11"],
128 x12: reg = ["x12", "w12"],
129 x13: reg = ["x13", "w13"] % restricted_for_arm64ec,
130 x14: reg = ["x14", "w14"] % restricted_for_arm64ec,
131 x15: reg = ["x15", "w15"],
132 x16: reg = ["x16", "w16"],
133 x17: reg = ["x17", "w17"],
134 x18: reg = ["x18", "w18"] % reserved_x18,
135 x20: reg = ["x20", "w20"],
136 x21: reg = ["x21", "w21"],
137 x22: reg = ["x22", "w22"],
138 x23: reg = ["x23", "w23"] % restricted_for_arm64ec,
139 x24: reg = ["x24", "w24"] % restricted_for_arm64ec,
140 x25: reg = ["x25", "w25"],
141 x26: reg = ["x26", "w26"],
142 x27: reg = ["x27", "w27"],
143 x28: reg = ["x28", "w28"] % restricted_for_arm64ec,
144 x30: reg = ["x30", "w30", "lr", "wlr"],
145 v0: vreg, vreg_low16 = ["v0", "b0", "h0", "s0", "d0", "q0", "z0"],
146 v1: vreg, vreg_low16 = ["v1", "b1", "h1", "s1", "d1", "q1", "z1"],
147 v2: vreg, vreg_low16 = ["v2", "b2", "h2", "s2", "d2", "q2", "z2"],
148 v3: vreg, vreg_low16 = ["v3", "b3", "h3", "s3", "d3", "q3", "z3"],
149 v4: vreg, vreg_low16 = ["v4", "b4", "h4", "s4", "d4", "q4", "z4"],
150 v5: vreg, vreg_low16 = ["v5", "b5", "h5", "s5", "d5", "q5", "z5"],
151 v6: vreg, vreg_low16 = ["v6", "b6", "h6", "s6", "d6", "q6", "z6"],
152 v7: vreg, vreg_low16 = ["v7", "b7", "h7", "s7", "d7", "q7", "z7"],
153 v8: vreg, vreg_low16 = ["v8", "b8", "h8", "s8", "d8", "q8", "z8"],
154 v9: vreg, vreg_low16 = ["v9", "b9", "h9", "s9", "d9", "q9", "z9"],
155 v10: vreg, vreg_low16 = ["v10", "b10", "h10", "s10", "d10", "q10", "z10"],
156 v11: vreg, vreg_low16 = ["v11", "b11", "h11", "s11", "d11", "q11", "z11"],
157 v12: vreg, vreg_low16 = ["v12", "b12", "h12", "s12", "d12", "q12", "z12"],
158 v13: vreg, vreg_low16 = ["v13", "b13", "h13", "s13", "d13", "q13", "z13"],
159 v14: vreg, vreg_low16 = ["v14", "b14", "h14", "s14", "d14", "q14", "z14"],
160 v15: vreg, vreg_low16 = ["v15", "b15", "h15", "s15", "d15", "q15", "z15"],
161 v16: vreg = ["v16", "b16", "h16", "s16", "d16", "q16", "z16"] % restricted_for_arm64ec,
162 v17: vreg = ["v17", "b17", "h17", "s17", "d17", "q17", "z17"] % restricted_for_arm64ec,
163 v18: vreg = ["v18", "b18", "h18", "s18", "d18", "q18", "z18"] % restricted_for_arm64ec,
164 v19: vreg = ["v19", "b19", "h19", "s19", "d19", "q19", "z19"] % restricted_for_arm64ec,
165 v20: vreg = ["v20", "b20", "h20", "s20", "d20", "q20", "z20"] % restricted_for_arm64ec,
166 v21: vreg = ["v21", "b21", "h21", "s21", "d21", "q21", "z21"] % restricted_for_arm64ec,
167 v22: vreg = ["v22", "b22", "h22", "s22", "d22", "q22", "z22"] % restricted_for_arm64ec,
168 v23: vreg = ["v23", "b23", "h23", "s23", "d23", "q23", "z23"] % restricted_for_arm64ec,
169 v24: vreg = ["v24", "b24", "h24", "s24", "d24", "q24", "z24"] % restricted_for_arm64ec,
170 v25: vreg = ["v25", "b25", "h25", "s25", "d25", "q25", "z25"] % restricted_for_arm64ec,
171 v26: vreg = ["v26", "b26", "h26", "s26", "d26", "q26", "z26"] % restricted_for_arm64ec,
172 v27: vreg = ["v27", "b27", "h27", "s27", "d27", "q27", "z27"] % restricted_for_arm64ec,
173 v28: vreg = ["v28", "b28", "h28", "s28", "d28", "q28", "z28"] % restricted_for_arm64ec,
174 v29: vreg = ["v29", "b29", "h29", "s29", "d29", "q29", "z29"] % restricted_for_arm64ec,
175 v30: vreg = ["v30", "b30", "h30", "s30", "d30", "q30", "z30"] % restricted_for_arm64ec,
176 v31: vreg = ["v31", "b31", "h31", "s31", "d31", "q31", "z31"] % restricted_for_arm64ec,
177 p0: preg = ["p0"] % restricted_for_arm64ec,
178 p1: preg = ["p1"] % restricted_for_arm64ec,
179 p2: preg = ["p2"] % restricted_for_arm64ec,
180 p3: preg = ["p3"] % restricted_for_arm64ec,
181 p4: preg = ["p4"] % restricted_for_arm64ec,
182 p5: preg = ["p5"] % restricted_for_arm64ec,
183 p6: preg = ["p6"] % restricted_for_arm64ec,
184 p7: preg = ["p7"] % restricted_for_arm64ec,
185 p8: preg = ["p8"] % restricted_for_arm64ec,
186 p9: preg = ["p9"] % restricted_for_arm64ec,
187 p10: preg = ["p10"] % restricted_for_arm64ec,
188 p11: preg = ["p11"] % restricted_for_arm64ec,
189 p12: preg = ["p12"] % restricted_for_arm64ec,
190 p13: preg = ["p13"] % restricted_for_arm64ec,
191 p14: preg = ["p14"] % restricted_for_arm64ec,
192 p15: preg = ["p15"] % restricted_for_arm64ec,
193 ffr: preg = ["ffr"] % restricted_for_arm64ec,
194 #error = ["x19", "w19"] =>
195 "x19 is used internally by LLVM and cannot be used as an operand for inline asm",
196 #error = ["x29", "w29", "fp", "wfp"] =>
197 "the frame pointer cannot be used as an operand for inline asm",
198 #error = ["sp", "wsp"] =>
199 "the stack pointer cannot be used as an operand for inline asm",
200 #error = ["xzr", "wzr"] =>
201 "the zero register cannot be used as an operand for inline asm",
202 }
203}
204
205impl AArch64InlineAsmReg {
206 pub fn emit(
207 self,
208 out: &mut dyn fmt::Write,
209 _arch: InlineAsmArch,
210 modifier: Option<char>,
211 ) -> fmt::Result {
212 let (prefix, index) = if let Some(index) = self.reg_index() {
213 (modifier.unwrap_or('x'), index)
214 } else if let Some(index) = self.vreg_index() {
215 (modifier.unwrap_or('v'), index)
216 } else {
217 return out.write_str(self.name());
218 };
219 if !(index < 32) { ::core::panicking::panic("assertion failed: index < 32") };assert!(index < 32);
220 out.write_fmt(format_args!("{0}{1}", prefix, index))write!(out, "{prefix}{index}")
221 }
222
223 pub fn reg_index(self) -> Option<u32> {
225 use AArch64InlineAsmReg::*;
230 Some(match self {
231 x0 => 0,
232 x1 => 1,
233 x2 => 2,
234 x3 => 3,
235 x4 => 4,
236 x5 => 5,
237 x6 => 6,
238 x7 => 7,
239 x8 => 8,
240 x9 => 9,
241 x10 => 10,
242 x11 => 11,
243 x12 => 12,
244 x13 => 13,
245 x14 => 14,
246 x15 => 15,
247 x16 => 16,
248 x17 => 17,
249 x18 => 18,
250 x20 => 20,
252 x21 => 21,
253 x22 => 22,
254 x23 => 23,
255 x24 => 24,
256 x25 => 25,
257 x26 => 26,
258 x27 => 27,
259 x28 => 28,
260 x30 => 30,
262 _ => return None,
263 })
264 }
265
266 pub fn vreg_index(self) -> Option<u32> {
268 use AArch64InlineAsmReg::*;
269 if self as u32 >= v0 as u32 && self as u32 <= v31 as u32 {
270 return Some(self as u32 - v0 as u32);
271 }
272 None
273 }
274}