static fp_attr ResultToReg( instruction *ins, temp_entry *temp, fp_attr attr ){ /******************************************************************************/ if( ins == temp->first && !temp->whole_block ) { DoNothing( ins ); temp->actual_locn = InsLoc( ins, VIRTUAL_0 ); PopVirtualStack( ins ); attr &= ~POPS; } else { GetToTopOfStack( ins, VIRTUAL_0 ); if( ins->u.gen_table->generate == G_MFST ) { ins->u.gen_table = &RFST; } else { ins->u.gen_table = &RFSTNP; } ins->result = ST( temp->actual_locn ); } return( attr ); }
static instruction *OpToReg( instruction *ins, temp_entry *temp, fp_attr attr ) { /*****************************************************************************/ if( ins == temp->last && !temp->whole_block ) { switch( ins->u.gen_table->generate ) { case G_MFLD: PushVirtualStack( ins ); InsLoc( ins, VIRTUAL_0 ) = temp->actual_locn; DoNothing( ins ); break; case G_MCOMP: // if( temp->actual_locn != ACTUAL_1 ) _Zoiks( ZOIKS_076 ); ins->operands[ 0 ] = ST( ACTUAL_1 ); ins->operands[ 1 ] = ST( 0 ); if( temp->actual_locn != ACTUAL_1 ) { byte *actual_owner; actual_owner = ActualStackOwner( ACTUAL_1 ); *actual_owner = temp->actual_locn; PrefFXCH( ins, ACTUAL_1 ); PrefFXCH( ins, temp->actual_locn ); RevCond( ins ); } ins->u.gen_table = &FCOMPP; PopStack( ins ); PopStack( ins ); break; case G_MNFBIN: case G_MRFBIN: if( ins->u.gen_table->generate == G_MRFBIN ) { ins->u.gen_table = &RNFBINP; } else { ins->u.gen_table = &RRFBINP; } ins->operands[ 0 ] = ST( temp->actual_locn ); ins->result = ins->operands[ 0 ]; ins->operands[ 1 ] = ST( 0 ); InsLoc( ins, VIRTUAL_0 ) = temp->actual_locn; DecrementAll(); break; } temp->actual_locn = ACTUAL_NONE; } else { if( ( ins == temp->first ) && !temp->defined && !temp->whole_block ) { PrefFLDOp( ins, OP_MEM, temp->actual_op ); IncrementAll(); temp->actual_locn = ACTUAL_0; if( ins->u.gen_table->generate == G_MFLD ) { // PushStack( ins ); ins->operands[ 0 ] = ST( ACTUAL_0 ); } else { GetToTopOfStack( ins, VIRTUAL_0 ); ins->operands[ 0 ] = ST( temp->actual_locn ); } } else { ins->operands[ 0 ] = ST( temp->actual_locn ); // if( attr & PUSHES ) { // PushStack( ins ); // } } if( attr & PUSHES ) { PushStack( ins ); } else if( attr & POPS2 ) { PopStack( ins ); PopStack( ins ); } else if( attr & POPS ) { PopStack( ins ); } ins->u.gen_table = RegAction( ins ); } return( ins ); }