1
+ use std:: collections:: HashMap ;
2
+
1
3
use super :: intrinsic:: ArmIntrinsicType ;
2
4
use crate :: common:: cli:: Language ;
3
5
use crate :: common:: intrinsic_helpers:: { IntrinsicType , IntrinsicTypeDefinition , Sign , TypeKind } ;
@@ -59,7 +61,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
59
61
bit_len : Some ( bl) ,
60
62
simd_len,
61
63
vec_len,
62
- target ,
64
+ metadata ,
63
65
..
64
66
} = & self . 0
65
67
{
@@ -69,7 +71,11 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
69
71
""
70
72
} ;
71
73
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 ( ) ;
73
79
format ! (
74
80
"vld{len}{quad}_{type}{size}" ,
75
81
type = match k {
@@ -121,15 +127,17 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
121
127
}
122
128
}
123
129
124
- fn from_c ( s : & str , target : & str ) -> Result < Self , String > {
130
+ fn from_c ( s : & str ) -> Result < Self , String > {
125
131
const CONST_STR : & str = "const" ;
132
+ let mut metadata: HashMap < String , String > = HashMap :: new ( ) ;
133
+ metadata. insert ( "type" . to_string ( ) , s. to_string ( ) ) ;
126
134
if let Some ( s) = s. strip_suffix ( '*' ) {
127
135
let ( s, constant) = match s. trim ( ) . strip_suffix ( CONST_STR ) {
128
136
Some ( stripped) => ( stripped, true ) ,
129
137
None => ( s, false ) ,
130
138
} ;
131
139
let s = s. trim_end ( ) ;
132
- let temp_return = ArmIntrinsicType :: from_c ( s, target ) ;
140
+ let temp_return = ArmIntrinsicType :: from_c ( s) ;
133
141
temp_return. map ( |mut op| {
134
142
op. ptr = true ;
135
143
op. ptr_constant = constant;
@@ -170,7 +178,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
170
178
bit_len : Some ( bit_len) ,
171
179
simd_len,
172
180
vec_len,
173
- target : target . to_string ( ) ,
181
+ metadata ,
174
182
} ) )
175
183
} else {
176
184
let kind = start. parse :: < TypeKind > ( ) ?;
@@ -186,7 +194,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
186
194
bit_len,
187
195
simd_len : None ,
188
196
vec_len : None ,
189
- target : target . to_string ( ) ,
197
+ metadata ,
190
198
} ) )
191
199
}
192
200
}
0 commit comments