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 } ;
@@ -40,7 +42,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
40
42
bit_len : Some ( bl) ,
41
43
simd_len,
42
44
vec_len,
43
- target ,
45
+ metadata ,
44
46
..
45
47
} = & self . 0
46
48
{
@@ -50,7 +52,11 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
50
52
""
51
53
} ;
52
54
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 ( ) ;
54
60
format ! (
55
61
"vld{len}{quad}_{type}{size}" ,
56
62
type = match k {
@@ -102,15 +108,17 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
102
108
}
103
109
}
104
110
105
- fn from_c ( s : & str , target : & str ) -> Result < Self , String > {
111
+ fn from_c ( s : & str ) -> Result < Self , String > {
106
112
const CONST_STR : & str = "const" ;
113
+ let mut metadata: HashMap < String , String > = HashMap :: new ( ) ;
114
+ metadata. insert ( "type" . to_string ( ) , s. to_string ( ) ) ;
107
115
if let Some ( s) = s. strip_suffix ( '*' ) {
108
116
let ( s, constant) = match s. trim ( ) . strip_suffix ( CONST_STR ) {
109
117
Some ( stripped) => ( stripped, true ) ,
110
118
None => ( s, false ) ,
111
119
} ;
112
120
let s = s. trim_end ( ) ;
113
- let temp_return = ArmIntrinsicType :: from_c ( s, target ) ;
121
+ let temp_return = ArmIntrinsicType :: from_c ( s) ;
114
122
temp_return. map ( |mut op| {
115
123
op. ptr = true ;
116
124
op. ptr_constant = constant;
@@ -151,7 +159,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
151
159
bit_len : Some ( bit_len) ,
152
160
simd_len,
153
161
vec_len,
154
- target : target . to_string ( ) ,
162
+ metadata ,
155
163
} ) )
156
164
} else {
157
165
let kind = start. parse :: < TypeKind > ( ) ?;
@@ -167,7 +175,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
167
175
bit_len,
168
176
simd_len : None ,
169
177
vec_len : None ,
170
- target : target . to_string ( ) ,
178
+ metadata ,
171
179
} ) )
172
180
}
173
181
}
0 commit comments