@@ -45,20 +45,21 @@ impl<'a, F: Function> Env<'a, F> {
4545 prio : InsertMovePrio ,
4646 from_alloc : Allocation ,
4747 to_alloc : Allocation ,
48- to_vreg : Option < VReg > ,
48+ to_vreg : VReg ,
4949 ) {
5050 trace ! (
51- "insert_move: pos {:?} prio {:?} from_alloc {:?} to_alloc {:?}" ,
51+ "insert_move: pos {:?} prio {:?} from_alloc {:?} to_alloc {:?} to_vreg {:?} " ,
5252 pos,
5353 prio,
5454 from_alloc,
55- to_alloc
55+ to_alloc,
56+ to_vreg
5657 ) ;
57- match ( from_alloc . as_reg ( ) , to_alloc . as_reg ( ) ) {
58- ( Some ( from) , Some ( to ) ) => {
59- debug_assert_eq ! ( from . class ( ) , to . class ( ) ) ;
60- }
61- _ => { }
58+ if let Some ( from ) = from_alloc . as_reg ( ) {
59+ debug_assert_eq ! ( from. class ( ) , to_vreg . class ( ) ) ;
60+ }
61+ if let Some ( to ) = to_alloc . as_reg ( ) {
62+ debug_assert_eq ! ( to . class ( ) , to_vreg . class ( ) ) ;
6263 }
6364 self . inserted_moves . push ( InsertedMove {
6465 pos_prio : PosWithPrio {
@@ -280,7 +281,7 @@ impl<'a, F: Function> Env<'a, F> {
280281 InsertMovePrio :: Regular ,
281282 prev_alloc,
282283 alloc,
283- Some ( self . vreg ( vreg) ) ,
284+ self . vreg ( vreg) ,
284285 ) ;
285286 }
286287 }
@@ -720,7 +721,7 @@ impl<'a, F: Function> Env<'a, F> {
720721 prio,
721722 src. alloc ,
722723 dest. alloc ,
723- Some ( self . vreg ( dest. to_vreg ( ) ) ) ,
724+ self . vreg ( dest. to_vreg ( ) ) ,
724725 ) ;
725726 last = Some ( dest. alloc ) ;
726727 }
@@ -741,13 +742,7 @@ impl<'a, F: Function> Env<'a, F> {
741742 FixedRegFixupLevel :: Initial => InsertMovePrio :: MultiFixedRegInitial ,
742743 FixedRegFixupLevel :: Secondary => InsertMovePrio :: MultiFixedRegSecondary ,
743744 } ;
744- self . insert_move (
745- fixup. pos ,
746- prio,
747- from_alloc,
748- to_alloc,
749- Some ( self . vreg ( fixup. vreg ) ) ,
750- ) ;
745+ self . insert_move ( fixup. pos , prio, from_alloc, to_alloc, self . vreg ( fixup. vreg ) ) ;
751746 self . set_alloc (
752747 fixup. pos . inst ( ) ,
753748 fixup. to_slot as usize ,
@@ -831,7 +826,7 @@ impl<'a, F: Function> Env<'a, F> {
831826 InsertMovePrio :: ReusedInput ,
832827 input_alloc,
833828 output_alloc,
834- Some ( input_operand. vreg ( ) ) ,
829+ input_operand. vreg ( ) ,
835830 ) ;
836831 self . set_alloc ( inst, input_idx, output_alloc) ;
837832 }
@@ -871,7 +866,7 @@ impl<'a, F: Function> Env<'a, F> {
871866 InsertMovePrio :: Regular ,
872867 from_alloc,
873868 to_alloc,
874- Some ( self . vreg ( to_vreg) ) ,
869+ self . vreg ( to_vreg) ,
875870 ) ;
876871 }
877872
@@ -961,13 +956,10 @@ impl<'a, F: Function> Env<'a, F> {
961956 let mut float_moves: SmallVec < [ InsertedMove ; 8 ] > = smallvec ! [ ] ;
962957
963958 for m in moves {
964- if m. from_alloc . is_reg ( ) && m. to_alloc . is_reg ( ) {
965- debug_assert_eq ! ( m. from_alloc. class( ) , m. to_alloc. class( ) ) ;
966- }
967959 if m. from_alloc == m. to_alloc {
968960 continue ;
969961 }
970- match m. from_alloc . class ( ) {
962+ match m. to_vreg . class ( ) {
971963 RegClass :: Int => {
972964 int_moves. push ( m. clone ( ) ) ;
973965 }
@@ -990,10 +982,8 @@ impl<'a, F: Function> Env<'a, F> {
990982 pos_prio. prio
991983 ) ;
992984 for m in moves {
993- if ( m. from_alloc != m. to_alloc ) || m. to_vreg . is_some ( ) {
994- trace ! ( " {} -> {}" , m. from_alloc, m. to_alloc, ) ;
995- parallel_moves. add ( m. from_alloc , m. to_alloc , m. to_vreg ) ;
996- }
985+ trace ! ( " {} -> {}" , m. from_alloc, m. to_alloc) ;
986+ parallel_moves. add ( m. from_alloc , m. to_alloc , Some ( m. to_vreg ) ) ;
997987 }
998988
999989 let resolved = parallel_moves. resolve ( ) ;
@@ -1042,7 +1032,7 @@ impl<'a, F: Function> Env<'a, F> {
10421032 // these placeholders then allocate the actual
10431033 // slots if needed with `self.allocate_spillslot`
10441034 // below.
1045- Allocation :: stack ( SpillSlot :: new ( SpillSlot :: MAX - idx, regclass ) )
1035+ Allocation :: stack ( SpillSlot :: new ( SpillSlot :: MAX - idx) )
10461036 } ;
10471037 let is_stack_alloc = |alloc : Allocation | {
10481038 if let Some ( preg) = alloc. as_reg ( ) {
@@ -1065,11 +1055,12 @@ impl<'a, F: Function> Env<'a, F> {
10651055 let mut rewrites = FxHashMap :: default ( ) ;
10661056 for i in 0 ..stackslot_idx {
10671057 if i >= self . extra_spillslots_by_class [ regclass as usize ] . len ( ) {
1068- let slot = self . allocate_spillslot ( regclass) ;
1058+ let slot =
1059+ self . allocate_spillslot ( self . func . spillslot_size ( regclass) as u32 ) ;
10691060 self . extra_spillslots_by_class [ regclass as usize ] . push ( slot) ;
10701061 }
10711062 rewrites. insert (
1072- Allocation :: stack ( SpillSlot :: new ( SpillSlot :: MAX - i, regclass ) ) ,
1063+ Allocation :: stack ( SpillSlot :: new ( SpillSlot :: MAX - i) ) ,
10731064 self . extra_spillslots_by_class [ regclass as usize ] [ i] ,
10741065 ) ;
10751066 }
0 commit comments