<s> static int mn10300_register_move_cost ( machine_mode mode ATTRIBUTE_UNUSED , reg_class_t ifrom , reg_class_t ito ) { enum reg_class from = ( enum reg_class ) ifrom ; enum reg_class to = ( enum reg_class ) ito ; enum reg_class scratch , test ; if ( to == FP_ACC_REGS ) to = FP_REGS ; if ( from == FP_ACC_REGS ) from = FP_REGS ; scratch = NO_REGS ; test = from ; if ( to == SP_REGS ) scratch = ( TARGET_AM33 ? GENERAL_REGS : ADDRESS_REGS ) ; else if ( to == MDR_REGS ) scratch = DATA_REGS ; else if ( to == FP_REGS && to != from ) scratch = GENERAL_REGS ; else { test = to ; if ( from == SP_REGS ) scratch = ( TARGET_AM33 ? GENERAL_REGS : ADDRESS_REGS ) ; else if ( from == MDR_REGS ) scratch = DATA_REGS ; else if ( from == FP_REGS && to != from ) scratch = GENERAL_REGS ; } if ( scratch != NO_REGS && ! reg_class_subset_p ( test , scratch ) ) return ( mn10300_register_move_cost ( VOIDmode , from , scratch ) + mn10300_register_move_cost ( VOIDmode , scratch , to ) ) ; if ( optimize_size ) { if ( from == to && ( to == ADDRESS_REGS || to == DATA_REGS ) ) return 2 ; if ( from == SP_REGS ) return ( to == ADDRESS_REGS ? 2 : 6 ) ; if ( TARGET_AM33 ) return 4 ; if ( to == SP_REGS ) return ( from == ADDRESS_REGS ? 4 : 6 ) ; if ( ( from == ADDRESS_REGS || from == DATA_REGS ) && ( to == ADDRESS_REGS || to == DATA_REGS ) ) return 4 ; if ( to == EXTENDED_REGS ) return ( to == from ? 6 : 4 ) ; return 6 ; } else { if ( to == FP_REGS ) return 8 ; if ( from == FP_REGS ) return 4 ; return 2 ; } } </s>

Implement the TARGET_REGISTER_MOVE_COST hook . Recall that the base value of 2 is required by assumptions elsewhere in the body of the compiler , and that cost 2 is special-cased as an early exit from reload meaning no work is required .


<s> void PPCInstrInfo :: insertNoop ( MachineBasicBlock & MBB , MachineBasicBlock :: iterator MI ) const { unsigned Directive = TM . getSubtarget < PPCSubtarget > ( ) . getDarwinDirective ( ) ; unsigned Opcode ; switch ( Directive ) { default : Opcode = PPC :: NOP ; break ; case PPC :: DIR_PWR6 : Opcode = PPC :: NOP_GT_PWR6 ; break ; case PPC :: DIR_PWR7 : Opcode = PPC :: NOP_GT_PWR7 ; break ; } DebugLoc DL ; BuildMI ( MBB , MI , DL , get ( Opcode ) ) ; } </s>

Insert a noop into the instruction stream at the specified point .