/src/wasmtime/target/debug/build/cranelift-codegen-d3be7d5f89248fcc/out/settings-arm64.rs
Line | Count | Source (jump to first uncovered line) |
1 | 3.68k | #[derive(Clone, Hash)] |
2 | | /// Flags group `arm64`. |
3 | | pub struct Flags { |
4 | | bytes: [u8; 1], |
5 | | } |
6 | | impl Flags { |
7 | | /// Create flags arm64 settings group. |
8 | | #[allow(unused_variables)] |
9 | 4.36k | pub fn new(shared: &settings::Flags, builder: &Builder) -> Self { |
10 | 4.36k | let bvec = builder.state_for("arm64"); |
11 | 4.36k | let mut arm64 = Self { bytes: [0; 1] }; |
12 | 0 | debug_assert_eq!(bvec.len(), 1); |
13 | 4.36k | arm64.bytes[0..1].copy_from_slice(&bvec); |
14 | 4.36k | arm64 |
15 | 4.36k | } |
16 | | } |
17 | | impl Flags { |
18 | | /// Iterates the setting values. |
19 | 5.86k | pub fn iter(&self) -> impl Iterator<Item = Value> { |
20 | 5.86k | let mut bytes = [0; 1]; |
21 | 5.86k | bytes.copy_from_slice(&self.bytes[0..1]); |
22 | 35.1k | DESCRIPTORS.iter().filter_map(move |d| { |
23 | 35.1k | let values = match &d.detail { |
24 | 0 | detail::Detail::Preset => return None, |
25 | 0 | detail::Detail::Enum { last, enumerators } => Some(TEMPLATE.enums(*last, *enumerators)), |
26 | 35.1k | _ => None |
27 | | }; |
28 | 35.1k | Some(Value{ name: d.name, detail: d.detail, values, value: bytes[d.offset as usize] }) |
29 | 35.1k | }) |
30 | 5.86k | } |
31 | | } |
32 | | /// User-defined settings. |
33 | | #[allow(dead_code)] |
34 | | impl Flags { |
35 | | /// Get a view of the boolean predicates. |
36 | 0 | pub fn predicate_view(&self) -> crate::settings::PredicateView { |
37 | 0 | crate::settings::PredicateView::new(&self.bytes[0..]) |
38 | 0 | } |
39 | | /// Dynamic numbered predicate getter. |
40 | 21.2k | fn numbered_predicate(&self, p: usize) -> bool { |
41 | 21.2k | self.bytes[0 + p / 8] & (1 << (p % 8)) != 0 |
42 | 21.2k | } |
43 | | /// Has Large System Extensions (FEAT_LSE) support. |
44 | 1.66k | pub fn has_lse(&self) -> bool { |
45 | 1.66k | self.numbered_predicate(0) |
46 | 1.66k | } |
47 | | /// Has Pointer authentication (FEAT_PAuth) support; enables the use of non-HINT instructions, but does not have an effect on code generation by itself. |
48 | 572 | pub fn has_pauth(&self) -> bool { |
49 | 572 | self.numbered_predicate(1) |
50 | 572 | } |
51 | | /// If function return address signing is enabled, then apply it to all functions; does not have an effect on code generation by itself. |
52 | 0 | pub fn sign_return_address_all(&self) -> bool { |
53 | 0 | self.numbered_predicate(2) |
54 | 0 | } |
55 | | /// Use pointer authentication instructions to sign function return addresses; HINT-space instructions using the A key are generated and simple functions that do not use the stack are not affected unless overridden by other settings. |
56 | 11.0k | pub fn sign_return_address(&self) -> bool { |
57 | 11.0k | self.numbered_predicate(3) |
58 | 11.0k | } |
59 | | /// Use the B key with pointer authentication instructions instead of the default A key; does not have an effect on code generation by itself. Some platform ABIs may require this, for example. |
60 | 858 | pub fn sign_return_address_with_bkey(&self) -> bool { |
61 | 858 | self.numbered_predicate(4) |
62 | 858 | } |
63 | | /// Use Branch Target Identification (FEAT_BTI) instructions. |
64 | 7.07k | pub fn use_bti(&self) -> bool { |
65 | 7.07k | self.numbered_predicate(5) |
66 | 7.07k | } |
67 | | } |
68 | | static DESCRIPTORS: [detail::Descriptor; 6] = [ |
69 | | detail::Descriptor { |
70 | | name: "has_lse", |
71 | | description: "Has Large System Extensions (FEAT_LSE) support.", |
72 | | offset: 0, |
73 | | detail: detail::Detail::Bool { bit: 0 }, |
74 | | }, |
75 | | detail::Descriptor { |
76 | | name: "has_pauth", |
77 | | description: "Has Pointer authentication (FEAT_PAuth) support; enables the use of non-HINT instructions, but does not have an effect on code generation by itself.", |
78 | | offset: 0, |
79 | | detail: detail::Detail::Bool { bit: 1 }, |
80 | | }, |
81 | | detail::Descriptor { |
82 | | name: "sign_return_address_all", |
83 | | description: "If function return address signing is enabled, then apply it to all functions; does not have an effect on code generation by itself.", |
84 | | offset: 0, |
85 | | detail: detail::Detail::Bool { bit: 2 }, |
86 | | }, |
87 | | detail::Descriptor { |
88 | | name: "sign_return_address", |
89 | | description: "Use pointer authentication instructions to sign function return addresses; HINT-space instructions using the A key are generated and simple functions that do not use the stack are not affected unless overridden by other settings.", |
90 | | offset: 0, |
91 | | detail: detail::Detail::Bool { bit: 3 }, |
92 | | }, |
93 | | detail::Descriptor { |
94 | | name: "sign_return_address_with_bkey", |
95 | | description: "Use the B key with pointer authentication instructions instead of the default A key; does not have an effect on code generation by itself. Some platform ABIs may require this, for example.", |
96 | | offset: 0, |
97 | | detail: detail::Detail::Bool { bit: 4 }, |
98 | | }, |
99 | | detail::Descriptor { |
100 | | name: "use_bti", |
101 | | description: "Use Branch Target Identification (FEAT_BTI) instructions.", |
102 | | offset: 0, |
103 | | detail: detail::Detail::Bool { bit: 5 }, |
104 | | }, |
105 | | ]; |
106 | | static ENUMERATORS: [&str; 0] = [ |
107 | | ]; |
108 | | static HASH_TABLE: [u16; 8] = [ |
109 | | 5, |
110 | | 0xffff, |
111 | | 0xffff, |
112 | | 1, |
113 | | 3, |
114 | | 4, |
115 | | 2, |
116 | | 0, |
117 | | ]; |
118 | | static PRESETS: [(u8, u8); 0] = [ |
119 | | ]; |
120 | | static TEMPLATE: detail::Template = detail::Template { |
121 | | name: "arm64", |
122 | | descriptors: &DESCRIPTORS, |
123 | | enumerators: &ENUMERATORS, |
124 | | hash_table: &HASH_TABLE, |
125 | | defaults: &[0x00], |
126 | | presets: &PRESETS, |
127 | | }; |
128 | | /// Create a `settings::Builder` for the arm64 settings group. |
129 | 4.36k | pub fn builder() -> Builder { |
130 | 4.36k | Builder::new(&TEMPLATE) |
131 | 4.36k | } |
132 | | impl fmt::Display for Flags { |
133 | | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
134 | 0 | writeln!(f, "[arm64]")?; |
135 | 0 | for d in &DESCRIPTORS { |
136 | 0 | if !d.detail.is_preset() { |
137 | 0 | write!(f, "{} = ", d.name)?; |
138 | 0 | TEMPLATE.format_toml_value(d.detail, self.bytes[d.offset as usize], f)?; |
139 | 0 | writeln!(f)?; |
140 | 0 | } |
141 | | } |
142 | 0 | Ok(()) |
143 | 0 | } |
144 | | } |