1+ use std:: collections:: HashMap ;
2+
13use super :: intrinsic:: ArmIntrinsicType ;
24use crate :: common:: cli:: Language ;
35use crate :: common:: intrinsic_helpers:: { IntrinsicType , IntrinsicTypeDefinition , Sign , TypeKind } ;
@@ -59,7 +61,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
5961 bit_len : Some ( bl) ,
6062 simd_len,
6163 vec_len,
62- target ,
64+ metadata ,
6365 ..
6466 } = & self . 0
6567 {
@@ -69,7 +71,11 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
6971 ""
7072 } ;
7173
72- let choose_workaround = language == Language :: C && target. contains ( "v7" ) ;
74+ let choose_workaround = language == Language :: C
75+ && metadata
76+ . get ( "target" )
77+ . filter ( |value| value. contains ( "v7" ) )
78+ . is_some ( ) ;
7379 format ! (
7480 "vld{len}{quad}_{type}{size}" ,
7581 type = match k {
@@ -121,15 +127,17 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
121127 }
122128 }
123129
124- fn from_c ( s : & str , target : & str ) -> Result < Self , String > {
130+ fn from_c ( s : & str ) -> Result < Self , String > {
125131 const CONST_STR : & str = "const" ;
132+ let mut metadata: HashMap < String , String > = HashMap :: new ( ) ;
133+ metadata. insert ( "type" . to_string ( ) , s. to_string ( ) ) ;
126134 if let Some ( s) = s. strip_suffix ( '*' ) {
127135 let ( s, constant) = match s. trim ( ) . strip_suffix ( CONST_STR ) {
128136 Some ( stripped) => ( stripped, true ) ,
129137 None => ( s, false ) ,
130138 } ;
131139 let s = s. trim_end ( ) ;
132- let temp_return = ArmIntrinsicType :: from_c ( s, target ) ;
140+ let temp_return = ArmIntrinsicType :: from_c ( s) ;
133141 temp_return. map ( |mut op| {
134142 op. ptr = true ;
135143 op. ptr_constant = constant;
@@ -170,7 +178,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
170178 bit_len : Some ( bit_len) ,
171179 simd_len,
172180 vec_len,
173- target : target . to_string ( ) ,
181+ metadata ,
174182 } ) )
175183 } else {
176184 let kind = start. parse :: < TypeKind > ( ) ?;
@@ -186,7 +194,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
186194 bit_len,
187195 simd_len : None ,
188196 vec_len : None ,
189- target : target . to_string ( ) ,
197+ metadata ,
190198 } ) )
191199 }
192200 }
0 commit comments