|
| 1 | +use super::intrinsic::LoongArchIntrinsicType; |
| 2 | +use crate::common::cli::Language; |
| 3 | +use crate::common::intrinsic_helpers::IntrinsicTypeDefinition; |
| 4 | + |
| 5 | +impl IntrinsicTypeDefinition for LoongArchIntrinsicType { |
| 6 | + /// Gets a string containing the type in C format. |
| 7 | + /// This function assumes that this value is present in the metadata hashmap. |
| 8 | + fn c_type(&self) -> String { |
| 9 | + unimplemented!("c_type for LoongArchIntrinsicType is not implemented!") |
| 10 | + } |
| 11 | + |
| 12 | + fn c_single_vector_type(&self) -> String { |
| 13 | + unimplemented!("c_single_vector_type for LoongArchIntrinsicType is not implemented!") |
| 14 | + } |
| 15 | + |
| 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 | + |
| 80 | + /// Determines the load function for this type. |
| 81 | + fn get_load_function(&self, _language: Language) -> String { |
| 82 | + unimplemented!("get_load_function for LoongArchIntrinsicType is not implemented!") |
| 83 | + } |
| 84 | + |
| 85 | + /// Determines the get lane function for this type. |
| 86 | + fn get_lane_function(&self) -> String { |
| 87 | + todo!("get_lane_function for LoongArchIntrinsicType needs to be implemented!"); |
| 88 | + } |
| 89 | + |
| 90 | + fn from_c(s: &str, target: &str) -> Result<Self, String> { |
| 91 | + todo!("from_c for LoongArchIntrinsicType needs to be implemented!"); |
| 92 | + } |
| 93 | +} |
0 commit comments