@@ -356,13 +356,6 @@ impl<'a, F: Function> Env<'a, F> {
356356 }
357357
358358 for inst in insns. rev ( ) . iter ( ) {
359- if let Some ( ( src, dst) ) = self . func . is_move ( inst) {
360- live. set ( dst. vreg ( ) . vreg ( ) , false ) ;
361- live. set ( src. vreg ( ) . vreg ( ) , true ) ;
362- self . observe_vreg_class ( src. vreg ( ) ) ;
363- self . observe_vreg_class ( dst. vreg ( ) ) ;
364- }
365-
366359 for pos in & [ OperandPos :: Late , OperandPos :: Early ] {
367360 for op in self . func . inst_operands ( inst) {
368361 if op. as_fixed_nonallocatable ( ) . is_some ( ) {
@@ -519,148 +512,6 @@ impl<'a, F: Function> Env<'a, F> {
519512 }
520513 }
521514
522- // If this is a move, handle specially.
523- if let Some ( ( src, dst) ) = self . func . is_move ( inst) {
524- assert ! (
525- src. vreg( ) != dst. vreg( ) ,
526- "Invalid move: overwriting an SSA value"
527- ) ;
528-
529- trace ! ( " -> move inst{}: src {} -> dst {}" , inst. index( ) , src, dst) ;
530-
531- debug_assert_eq ! ( src. class( ) , dst. class( ) ) ;
532- debug_assert_eq ! ( src. kind( ) , OperandKind :: Use ) ;
533- debug_assert_eq ! ( src. pos( ) , OperandPos :: Early ) ;
534- debug_assert_eq ! ( dst. kind( ) , OperandKind :: Def ) ;
535- debug_assert_eq ! ( dst. pos( ) , OperandPos :: Late ) ;
536-
537- // Redefine src and dst operands to have
538- // positions of After and Before respectively
539- // (see note below), and to have Any
540- // constraints if they were originally Reg.
541- let src_constraint = match src. constraint ( ) {
542- OperandConstraint :: Reg => OperandConstraint :: Any ,
543- x => x,
544- } ;
545- let dst_constraint = match dst. constraint ( ) {
546- OperandConstraint :: Reg => OperandConstraint :: Any ,
547- x => x,
548- } ;
549- let src = Operand :: new (
550- src. vreg ( ) ,
551- src_constraint,
552- OperandKind :: Use ,
553- OperandPos :: Late ,
554- ) ;
555- let dst = Operand :: new (
556- dst. vreg ( ) ,
557- dst_constraint,
558- OperandKind :: Def ,
559- OperandPos :: Early ,
560- ) ;
561-
562- if self . annotations_enabled {
563- self . annotate (
564- ProgPoint :: after ( inst) ,
565- format ! (
566- " prog-move v{} ({:?}) -> v{} ({:?})" ,
567- src. vreg( ) . vreg( ) ,
568- src_constraint,
569- dst. vreg( ) . vreg( ) ,
570- dst_constraint,
571- ) ,
572- ) ;
573- }
574-
575- // N.B.: in order to integrate with the move
576- // resolution that joins LRs in general, we
577- // conceptually treat the move as happening
578- // between the move inst's After and the next
579- // inst's Before. Thus the src LR goes up to
580- // (exclusive) next-inst-pre, and the dst LR
581- // starts at next-inst-pre. We have to take
582- // care in our move insertion to handle this
583- // like other inter-inst moves, i.e., at
584- // `Regular` priority, so it properly happens
585- // in parallel with other inter-LR moves.
586- //
587- // Why the progpoint between move and next
588- // inst, and not the progpoint between prev
589- // inst and move? Because a move can be the
590- // first inst in a block, but cannot be the
591- // last; so the following progpoint is always
592- // within the same block, while the previous
593- // one may be an inter-block point (and the
594- // After of the prev inst in a different
595- // block).
596-
597- // Handle the def w.r.t. liveranges: trim the
598- // start of the range and mark it dead at this
599- // point in our backward scan.
600- let pos = ProgPoint :: before ( inst. next ( ) ) ;
601- let mut dst_lr = vreg_ranges[ dst. vreg ( ) . vreg ( ) ] ;
602- if !live. get ( dst. vreg ( ) . vreg ( ) ) {
603- let from = pos;
604- let to = pos. next ( ) ;
605- dst_lr = self . add_liverange_to_vreg (
606- VRegIndex :: new ( dst. vreg ( ) . vreg ( ) ) ,
607- CodeRange { from, to } ,
608- ) ;
609- trace ! ( " -> invalid LR for def; created {:?}" , dst_lr) ;
610- }
611- trace ! ( " -> has existing LR {:?}" , dst_lr) ;
612- // Trim the LR to start here.
613- if self . ranges [ dst_lr. index ( ) ] . range . from
614- == self . cfginfo . block_entry [ block. index ( ) ]
615- {
616- trace ! ( " -> started at block start; trimming to {:?}" , pos) ;
617- self . ranges [ dst_lr. index ( ) ] . range . from = pos;
618- }
619- self . ranges [ dst_lr. index ( ) ] . set_flag ( LiveRangeFlag :: StartsAtDef ) ;
620- live. set ( dst. vreg ( ) . vreg ( ) , false ) ;
621- vreg_ranges[ dst. vreg ( ) . vreg ( ) ] = LiveRangeIndex :: invalid ( ) ;
622-
623- // Handle the use w.r.t. liveranges: make it live
624- // and create an initial LR back to the start of
625- // the block.
626- let pos = ProgPoint :: after ( inst) ;
627- let src_lr = if !live. get ( src. vreg ( ) . vreg ( ) ) {
628- let range = CodeRange {
629- from : self . cfginfo . block_entry [ block. index ( ) ] ,
630- to : pos. next ( ) ,
631- } ;
632- let src_lr =
633- self . add_liverange_to_vreg ( VRegIndex :: new ( src. vreg ( ) . vreg ( ) ) , range) ;
634- vreg_ranges[ src. vreg ( ) . vreg ( ) ] = src_lr;
635- src_lr
636- } else {
637- vreg_ranges[ src. vreg ( ) . vreg ( ) ]
638- } ;
639-
640- trace ! ( " -> src LR {:?}" , src_lr) ;
641-
642- // Add to live-set.
643- let src_is_dead_after_move = !live. get ( src. vreg ( ) . vreg ( ) ) ;
644- live. set ( src. vreg ( ) . vreg ( ) , true ) ;
645-
646- // Add to program-moves lists.
647- self . prog_move_srcs . push ( (
648- ( VRegIndex :: new ( src. vreg ( ) . vreg ( ) ) , inst) ,
649- Allocation :: none ( ) ,
650- ) ) ;
651- self . prog_move_dsts . push ( (
652- ( VRegIndex :: new ( dst. vreg ( ) . vreg ( ) ) , inst. next ( ) ) ,
653- Allocation :: none ( ) ,
654- ) ) ;
655- self . stats . prog_moves += 1 ;
656- if src_is_dead_after_move {
657- self . stats . prog_moves_dead_src += 1 ;
658- self . prog_move_merges . push ( ( src_lr, dst_lr) ) ;
659- }
660-
661- continue ;
662- }
663-
664515 // Preprocess defs and uses. Specifically, if there
665516 // are any fixed-reg-constrained defs at Late position
666517 // and fixed-reg-constrained uses at Early position
@@ -1016,11 +867,6 @@ impl<'a, F: Function> Env<'a, F> {
1016867
1017868 self . blockparam_ins . sort_unstable_by_key ( |x| x. key ( ) ) ;
1018869 self . blockparam_outs . sort_unstable_by_key ( |x| x. key ( ) ) ;
1019- self . prog_move_srcs . sort_unstable_by_key ( |( pos, _) | * pos) ;
1020- self . prog_move_dsts . sort_unstable_by_key ( |( pos, _) | * pos) ;
1021-
1022- trace ! ( "prog_move_srcs = {:?}" , self . prog_move_srcs) ;
1023- trace ! ( "prog_move_dsts = {:?}" , self . prog_move_dsts) ;
1024870
1025871 self . stats . initial_liverange_count = self . ranges . len ( ) ;
1026872 self . stats . blockparam_ins_count = self . blockparam_ins . len ( ) ;
0 commit comments