Skip to content

Commit ac7200d

Browse files
chore: restructure LoongArchIntrinsicType struct
1 parent e86b274 commit ac7200d

File tree

2 files changed

+7
-71
lines changed

2 files changed

+7
-71
lines changed

crates/intrinsic-test/src/loongarch/intrinsic.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@ use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, S
55
use std::ops::{Deref, DerefMut};
66

77
#[derive(Debug, Clone, PartialEq)]
8-
pub struct LoongArchIntrinsicType(pub IntrinsicType);
8+
pub struct LoongArchIntrinsicType {
9+
pub data: IntrinsicType,
10+
}
911

1012
impl Deref for LoongArchIntrinsicType {
1113
type Target = IntrinsicType;
1214

1315
fn deref(&self) -> &Self::Target {
14-
&self.0
16+
&self.data
1517
}
1618
}
1719

1820
impl DerefMut for LoongArchIntrinsicType {
1921
fn deref_mut(&mut self) -> &mut Self::Target {
20-
&mut self.0
22+
&mut self.data
2123
}
2224
}
2325

crates/intrinsic-test/src/loongarch/types.rs

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,70 +13,6 @@ impl IntrinsicTypeDefinition for LoongArchIntrinsicType {
1313
unimplemented!("c_single_vector_type for LoongArchIntrinsicType is not implemented!")
1414
}
1515

16-
// fn rust_type(&self) -> String {
17-
// // handling edge cases first
18-
// // the general handling is implemented below
19-
// if let Some(val) = self.metadata.get("type") {
20-
// match val.as_str() {
21-
// "__m128 const *" => {
22-
// return "&__m128".to_string();
23-
// }
24-
// "__m128d const *" => {
25-
// return "&__m128d".to_string();
26-
// }
27-
// "const void*" => {
28-
// return "&__m128d".to_string();
29-
// }
30-
// _ => {}
31-
// }
32-
// }
33-
34-
// if self.kind() == TypeKind::Void && self.ptr {
35-
// // this has been handled by default settings in
36-
// // the from_param function of X86IntrinsicType
37-
// unreachable!()
38-
// }
39-
40-
// // general handling cases
41-
// let core_part = if self.kind() == TypeKind::Mask {
42-
// // all types of __mmask<int> are handled here
43-
// format!("__mask{}", self.bit_len.unwrap())
44-
// } else if self.simd_len.is_some() {
45-
// // all types of __m<int> vector types are handled here
46-
// let re = Regex::new(r"\__m\d+[a-z]*").unwrap();
47-
// let rust_type = self
48-
// .metadata
49-
// .get("type")
50-
// .map(|val| re.find(val).unwrap().as_str());
51-
// rust_type.unwrap().to_string()
52-
// } else {
53-
// format!(
54-
// "{}{}",
55-
// self.kind.rust_prefix().to_string(),
56-
// self.bit_len.unwrap()
57-
// )
58-
// };
59-
60-
// // extracting "memsize" so that even vector types can be involved
61-
// let memwidth = self
62-
// .metadata
63-
// .get("memwidth")
64-
// .map(|n| str::parse::<u32>(n).unwrap());
65-
// let prefix_part = if self.ptr && self.constant && self.bit_len.eq(&memwidth) {
66-
// "&"
67-
// } else if self.ptr && self.bit_len.eq(&memwidth) {
68-
// "&mut "
69-
// } else if self.ptr && self.constant {
70-
// "*const "
71-
// } else if self.ptr {
72-
// "*mut "
73-
// } else {
74-
// ""
75-
// };
76-
77-
// return prefix_part.to_string() + core_part.as_str();
78-
// }
79-
8016
/// Determines the load function for this type.
8117
fn get_load_function(&self, _language: Language) -> String {
8218
unimplemented!("get_load_function for LoongArchIntrinsicType is not implemented!")
@@ -86,8 +22,6 @@ impl IntrinsicTypeDefinition for LoongArchIntrinsicType {
8622
fn get_lane_function(&self) -> String {
8723
todo!("get_lane_function for LoongArchIntrinsicType needs to be implemented!");
8824
}
89-
90-
fn from_c(s: &str, target: &str) -> Result<Self, String> {
91-
todo!("from_c for LoongArchIntrinsicType needs to be implemented!");
92-
}
9325
}
26+
27+
impl LoongArchIntrinsicType

0 commit comments

Comments
 (0)