Skip to content

Commit 960e993

Browse files
feat(arm): add legacy Armv4 and Armv4T support
- Added Armv4 and Armv4T variants to Arch enum with proper doc comments - Updated Arch::get, Arch::values, and Display to include new variants - Updated Arch::profile mapping to include Armv4/Armv4T - Updated Isa::get to assign correct instruction set to legacy architectures - Ensured TargetInfo populates arch, isa, and profile for all supported targets
1 parent d599edc commit 960e993

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

arm-targets/src/lib.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ impl Isa {
7777
pub fn get(target: &str) -> Option<Isa> {
7878
let arch = Arch::get(target)?;
7979
Some(match arch {
80+
Arch::Armv4 | Arch::Armv4T => Isa::A32,
8081
Arch::Armv6M => Isa::T32,
8182
Arch::Armv7M => Isa::T32,
8283
Arch::Armv7EM => Isa::T32,
@@ -118,6 +119,10 @@ impl core::fmt::Display for Isa {
118119
/// As defined by a particular revision of the Arm Architecture Reference Manual (ARM).
119120
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
120121
pub enum Arch {
122+
/// Armv4 (legacy, also known as ARMv4)
123+
Armv4,
124+
/// Armv4T (legacy, also known as ARMv4T)
125+
Armv4T,
121126
/// Armv6-M (also known as ARMv6-M)
122127
Armv6M,
123128
/// Armv7-M (also known as ARMv7-M)
@@ -141,7 +146,11 @@ pub enum Arch {
141146
impl Arch {
142147
/// Decode a target string
143148
pub fn get(target: &str) -> Option<Arch> {
144-
if target.starts_with("thumbv6m-") {
149+
if target.starts_with("armv4-") {
150+
Some(Arch::Armv4)
151+
} else if target.starts_with("armv4t-") {
152+
Some(Arch::Armv4T)
153+
} else if target.starts_with("thumbv6m-") {
145154
Some(Arch::Armv6M)
146155
} else if target.starts_with("thumbv7m-") {
147156
Some(Arch::Armv7M)
@@ -170,14 +179,16 @@ impl Arch {
170179
Arch::Armv6M | Arch::Armv7M | Arch::Armv7EM | Arch::Armv8MBase | Arch::Armv8MMain => {
171180
Profile::M
172181
}
173-
Arch::Armv7R | Arch::Armv8R => Profile::R,
182+
Arch::Armv4 | Arch::Armv4T | Arch::Armv7R | Arch::Armv8R => Profile::R,
174183
Arch::Armv7A | Arch::Armv8A => Profile::A,
175184
}
176185
}
177186

178187
/// Get a comma-separated list of values, suitable for cfg-check
179188
pub fn values() -> String {
180189
let string_versions: Vec<String> = [
190+
Arch::Armv4,
191+
Arch::Armv4T,
181192
Arch::Armv6M,
182193
Arch::Armv7M,
183194
Arch::Armv7EM,
@@ -201,6 +212,8 @@ impl core::fmt::Display for Arch {
201212
f,
202213
"{}",
203214
match self {
215+
Arch::Armv4 => "v4",
216+
Arch::Armv4T => "v4t",
204217
Arch::Armv6M => "v6-m",
205218
Arch::Armv7M => "v7-m",
206219
Arch::Armv7EM => "v7e-m",

0 commit comments

Comments
 (0)