@@ -10,67 +10,82 @@ use crate::matchers::cast::CastInstMatcher;
1010
1111#[ inline( always) ]
1212pub fn register_cast_matchers_function ( map : & mut HashMap < & ' static str , StandardFunction > ) {
13+ map. insert ( "m_trunc" , match_trunc) ;
14+ map. insert ( "m_fp_to_ui" , match_fp_to_ui) ;
15+ map. insert ( "m_fp_to_si" , match_fp_to_si) ;
16+ map. insert ( "m_fp_trunc" , match_fp_trunc) ;
17+ map. insert ( "m_int_to_ptr" , match_int_to_ptr) ;
18+ map. insert ( "m_ptr_to_int" , match_ptr_to_int) ;
1319 map. insert ( "m_zext" , match_zext) ;
1420 map. insert ( "m_sext" , match_sext) ;
15- map. insert ( "m_int_to_ptr" , match_int_to_ptr_inst) ;
16- map. insert ( "m_ptr_to_int" , match_ptr_to_int_inst) ;
17- map. insert ( "m_bit_cast" , match_bit_cast_inst) ;
18- map. insert ( "m_addr_space_cast" , match_addr_space_cast_inst) ;
21+ map. insert ( "m_bit_cast" , match_bit_cast) ;
22+ map. insert ( "m_addr_space_cast" , match_addr_space_cast) ;
1923}
2024
2125#[ inline( always) ]
2226pub fn register_cast_matchers_function_signatures ( map : & mut HashMap < & ' static str , Signature > ) {
23- map. insert ( "m_zext" , Signature :: with_return ( Box :: new ( InstMatcherType ) ) ) ;
24-
25- map. insert ( "m_sext" , Signature :: with_return ( Box :: new ( InstMatcherType ) ) ) ;
26-
27- map. insert (
28- "m_int_to_ptr" ,
29- Signature :: with_return ( Box :: new ( InstMatcherType ) ) ,
30- ) ;
27+ map. insert ( "m_trunc" , cast_function_signature ( ) ) ;
28+ map. insert ( "m_fp_to_ui" , cast_function_signature ( ) ) ;
29+ map. insert ( "m_fp_to_si" , cast_function_signature ( ) ) ;
30+ map. insert ( "m_fp_trunc" , cast_function_signature ( ) ) ;
31+ map. insert ( "m_int_to_ptr" , cast_function_signature ( ) ) ;
32+ map. insert ( "m_ptr_to_int" , cast_function_signature ( ) ) ;
33+ map. insert ( "m_zext" , cast_function_signature ( ) ) ;
34+ map. insert ( "m_sext" , cast_function_signature ( ) ) ;
35+ map. insert ( "m_bit_cast" , cast_function_signature ( ) ) ;
36+ map. insert ( "m_addr_space_cast" , cast_function_signature ( ) ) ;
37+ }
3138
32- map. insert (
33- "m_ptr_to_int" ,
34- Signature :: with_return ( Box :: new ( InstMatcherType ) ) ,
35- ) ;
39+ fn cast_function_signature ( ) -> Signature {
40+ Signature :: with_return ( Box :: new ( InstMatcherType ) )
41+ }
3642
37- map . insert (
38- "m_bit_cast" ,
39- Signature :: with_return ( Box :: new ( InstMatcherType ) ) ,
40- ) ;
43+ fn match_trunc ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
44+ let matcher = Box :: new ( CastInstMatcher :: create_trunc ( ) ) ;
45+ Box :: new ( InstMatcherValue { matcher } )
46+ }
4147
42- map. insert (
43- "m_addr_space_cast" ,
44- Signature :: with_return ( Box :: new ( InstMatcherType ) ) ,
45- ) ;
48+ fn match_fp_to_ui ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
49+ let matcher = Box :: new ( CastInstMatcher :: create_fp_to_ui ( ) ) ;
50+ Box :: new ( InstMatcherValue { matcher } )
4651}
4752
48- fn match_zext ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
49- let matcher = Box :: new ( CastInstMatcher :: create_zext ( ) ) ;
53+ fn match_fp_to_si ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
54+ let matcher = Box :: new ( CastInstMatcher :: create_fp_to_si ( ) ) ;
5055 Box :: new ( InstMatcherValue { matcher } )
5156}
5257
53- fn match_sext ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
54- let matcher = Box :: new ( CastInstMatcher :: create_sext ( ) ) ;
58+ fn match_fp_trunc ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
59+ let matcher = Box :: new ( CastInstMatcher :: create_fp_trunc ( ) ) ;
5560 Box :: new ( InstMatcherValue { matcher } )
5661}
5762
58- fn match_int_to_ptr_inst ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
63+ fn match_int_to_ptr ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
5964 let matcher = Box :: new ( CastInstMatcher :: create_int_to_ptr ( ) ) ;
6065 Box :: new ( InstMatcherValue { matcher } )
6166}
6267
63- fn match_ptr_to_int_inst ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
68+ fn match_ptr_to_int ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
6469 let matcher = Box :: new ( CastInstMatcher :: create_ptr_to_int ( ) ) ;
6570 Box :: new ( InstMatcherValue { matcher } )
6671}
6772
68- fn match_bit_cast_inst ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
73+ fn match_zext ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
74+ let matcher = Box :: new ( CastInstMatcher :: create_zext ( ) ) ;
75+ Box :: new ( InstMatcherValue { matcher } )
76+ }
77+
78+ fn match_sext ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
79+ let matcher = Box :: new ( CastInstMatcher :: create_sext ( ) ) ;
80+ Box :: new ( InstMatcherValue { matcher } )
81+ }
82+
83+ fn match_bit_cast ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
6984 let matcher = Box :: new ( CastInstMatcher :: create_bit_cast ( ) ) ;
7085 Box :: new ( InstMatcherValue { matcher } )
7186}
7287
73- fn match_addr_space_cast_inst ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
88+ fn match_addr_space_cast ( _values : & [ Box < dyn Value > ] ) -> Box < dyn Value > {
7489 let matcher = Box :: new ( CastInstMatcher :: create_addr_space_cast ( ) ) ;
7590 Box :: new ( InstMatcherValue { matcher } )
7691}
0 commit comments