@@ -5,11 +5,11 @@ use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, S
55impl IntrinsicTypeDefinition for ArmIntrinsicType {
66 /// Gets a string containing the typename for this type in C format.
77 fn c_type ( & self ) -> String {
8- let prefix = self . 0 . kind . c_prefix ( ) ;
9- let const_prefix = if self . 0 . constant { "const " } else { "" } ;
8+ let prefix = self . kind . c_prefix ( ) ;
9+ let const_prefix = if self . constant { "const " } else { "" } ;
1010
1111 if let ( Some ( bit_len) , simd_len, vec_len) =
12- ( self . 0 . bit_len , self . 0 . simd_len , self . 0 . vec_len )
12+ ( self . bit_len , self . simd_len , self . vec_len )
1313 {
1414 match ( simd_len, vec_len) {
1515 ( None , None ) => format ! ( "{const_prefix}{prefix}{bit_len}_t" ) ,
@@ -23,10 +23,10 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
2323 }
2424
2525 fn c_single_vector_type ( & self ) -> String {
26- if let ( Some ( bit_len) , Some ( simd_len) ) = ( self . 0 . bit_len , self . 0 . simd_len ) {
26+ if let ( Some ( bit_len) , Some ( simd_len) ) = ( self . bit_len , self . simd_len ) {
2727 format ! (
2828 "{prefix}{bit_len}x{simd_len}_t" ,
29- prefix = self . 0 . kind. c_prefix( )
29+ prefix = self . kind. c_prefix( )
3030 )
3131 } else {
3232 unreachable ! ( "Shouldn't be called on this type" )
@@ -40,17 +40,16 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
4040 bit_len : Some ( bl) ,
4141 simd_len,
4242 vec_len,
43- target,
4443 ..
45- } = & self . 0
44+ } = & self . data
4645 {
4746 let quad = if simd_len. unwrap_or ( 1 ) * bl > 64 {
4847 "q"
4948 } else {
5049 ""
5150 } ;
5251
53- let choose_workaround = language == Language :: C && target. contains ( "v7" ) ;
52+ let choose_workaround = language == Language :: C && self . target . contains ( "v7" ) ;
5453 format ! (
5554 "vld{len}{quad}_{type}{size}" ,
5655 type = match k {
@@ -78,7 +77,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
7877 bit_len : Some ( bl) ,
7978 simd_len,
8079 ..
81- } = & self . 0
80+ } = & self . data
8281 {
8382 let quad = if ( simd_len. unwrap_or ( 1 ) * bl) > 64 {
8483 "q"
@@ -101,8 +100,10 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
101100 todo ! ( "get_lane_function IntrinsicType: {:#?}" , self )
102101 }
103102 }
103+ }
104104
105- fn from_c ( s : & str , target : & str ) -> Result < Self , String > {
105+ impl ArmIntrinsicType {
106+ pub fn from_c ( s : & str , target : & str ) -> Result < Self , String > {
106107 const CONST_STR : & str = "const" ;
107108 if let Some ( s) = s. strip_suffix ( '*' ) {
108109 let ( s, constant) = match s. trim ( ) . strip_suffix ( CONST_STR ) {
@@ -143,32 +144,34 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
143144 ) ,
144145 None => None ,
145146 } ;
146- Ok ( ArmIntrinsicType ( IntrinsicType {
147+ Ok ( ArmIntrinsicType {
148+ data : IntrinsicType {
147149 ptr : false ,
148150 ptr_constant : false ,
149151 constant,
150152 kind : arg_kind,
151153 bit_len : Some ( bit_len) ,
152154 simd_len,
153155 vec_len,
154- target : target . to_string ( ) ,
155- } ) )
156+ } ,
157+ target : target . to_string ( ) } )
156158 } else {
157159 let kind = start. parse :: < TypeKind > ( ) ?;
158160 let bit_len = match kind {
159161 TypeKind :: Int ( _) => Some ( 32 ) ,
160162 _ => None ,
161163 } ;
162- Ok ( ArmIntrinsicType ( IntrinsicType {
164+ Ok ( ArmIntrinsicType {
165+ data : IntrinsicType {
163166 ptr : false ,
164167 ptr_constant : false ,
165168 constant,
166169 kind : start. parse :: < TypeKind > ( ) ?,
167170 bit_len,
168171 simd_len : None ,
169172 vec_len : None ,
170- target : target . to_string ( ) ,
171- } ) )
173+ } ,
174+ target : target . to_string ( ) } )
172175 }
173176 }
174177 }
0 commit comments