1+ use std:: collections:: HashMap ;
2+
13use super :: intrinsic:: ArmIntrinsicType ;
24use crate :: common:: cli:: Language ;
35use crate :: common:: intrinsic_helpers:: { IntrinsicType , IntrinsicTypeDefinition , Sign , TypeKind } ;
@@ -40,7 +42,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
4042 bit_len : Some ( bl) ,
4143 simd_len,
4244 vec_len,
43- target ,
45+ metadata ,
4446 ..
4547 } = & self . 0
4648 {
@@ -50,7 +52,11 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
5052 ""
5153 } ;
5254
53- let choose_workaround = language == Language :: C && target. contains ( "v7" ) ;
55+ let choose_workaround = language == Language :: C
56+ && metadata
57+ . get ( "target" )
58+ . filter ( |value| value. contains ( "v7" ) )
59+ . is_some ( ) ;
5460 format ! (
5561 "vld{len}{quad}_{type}{size}" ,
5662 type = match k {
@@ -102,15 +108,17 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
102108 }
103109 }
104110
105- fn from_c ( s : & str , target : & str ) -> Result < Self , String > {
111+ fn from_c ( s : & str ) -> Result < Self , String > {
106112 const CONST_STR : & str = "const" ;
113+ let mut metadata: HashMap < String , String > = HashMap :: new ( ) ;
114+ metadata. insert ( "type" . to_string ( ) , s. to_string ( ) ) ;
107115 if let Some ( s) = s. strip_suffix ( '*' ) {
108116 let ( s, constant) = match s. trim ( ) . strip_suffix ( CONST_STR ) {
109117 Some ( stripped) => ( stripped, true ) ,
110118 None => ( s, false ) ,
111119 } ;
112120 let s = s. trim_end ( ) ;
113- let temp_return = ArmIntrinsicType :: from_c ( s, target ) ;
121+ let temp_return = ArmIntrinsicType :: from_c ( s) ;
114122 temp_return. map ( |mut op| {
115123 op. ptr = true ;
116124 op. ptr_constant = constant;
@@ -151,7 +159,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
151159 bit_len : Some ( bit_len) ,
152160 simd_len,
153161 vec_len,
154- target : target . to_string ( ) ,
162+ metadata ,
155163 } ) )
156164 } else {
157165 let kind = start. parse :: < TypeKind > ( ) ?;
@@ -167,7 +175,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
167175 bit_len,
168176 simd_len : None ,
169177 vec_len : None ,
170- target : target . to_string ( ) ,
178+ metadata ,
171179 } ) )
172180 }
173181 }
0 commit comments