Esempio n. 1
0
static  void    MergeUp( score *sc, int dst_idx, int src_idx ) {
    /**************************************************************/

    int dst_hi;
    int src_hi;
    int dst_lo;
    int src_lo;

    dst_hi = ScoreList[ dst_idx ]->high_of;
    src_hi = ScoreList[ src_idx ]->high_of;
    dst_lo = ScoreList[ dst_idx ]->low_of;
    src_lo = ScoreList[ src_idx ]->low_of;
    if( dst_hi != NO_INDEX && src_hi != NO_INDEX ) {
        dst_lo = ScoreList[ dst_hi ]->low;
        src_lo = ScoreList[ src_hi ]->low;
        if( dst_lo != NO_INDEX && src_lo != NO_INDEX
                && RegsEqual( sc, dst_lo, src_lo )
                && !RegsEqual( sc, dst_hi, src_hi ) ) {
            RegInsert( sc, dst_hi, src_hi );
            MergeUp( sc, dst_hi, src_hi );
        }
    } else if( dst_lo != NO_INDEX && src_lo != NO_INDEX ) {
        dst_hi = ScoreList[ dst_lo ]->high;
        src_hi = ScoreList[ src_lo ]->high;
        if( dst_hi != NO_INDEX && src_hi != NO_INDEX
                && RegsEqual( sc, dst_hi, src_hi )
                && !RegsEqual( sc, dst_lo, src_lo ) ) {
            RegInsert( sc, dst_lo, src_lo );
            MergeUp( sc, dst_lo, src_lo );
        }
    }
}
Esempio n. 2
0
static  void    MergeDown( score *sc, int dst_idx, int src_idx ) {
    /****************************************************************/

    int dst_hi;
    int src_hi;
    int dst_lo;
    int src_lo;

    dst_hi = ScoreList[ dst_idx ]->high;
    src_hi = ScoreList[ src_idx ]->high;
    if( dst_hi != NO_INDEX && src_hi != NO_INDEX ) {
        if( !RegsEqual( sc, src_hi, dst_hi ) ) {
            RegInsert( sc, dst_hi, src_hi );
            MergeDown( sc, dst_hi, src_hi );
        }
    }
    src_lo = ScoreList[ src_idx ]->low;
    dst_lo = ScoreList[ dst_idx ]->low;
    if( dst_lo != NO_INDEX && src_lo != NO_INDEX ) {
        if( !RegsEqual( sc, src_lo, dst_lo ) ) {
            RegInsert( sc, dst_lo, src_lo );
            MergeDown( sc, dst_lo, src_lo );
        }
    }
}
Esempio n. 3
0
void    ScoreSegments( score *sc )
/*****************************************
    Do special scoreboarding on segment registers.  Given that BX = DI,
    for example, we know that SS:BX = SS:DI, and DS:BX = DS:DI.
*/
{
    score       *ds;
    score       *xs;
    int         i;
    name        *dst;
    name        *src;

    ds = &sc[DS->r.reg_index];
    for( xs = ds->next_reg; xs != ds; xs = xs->next_reg ) {
        if( xs->index == SS->r.reg_index ) {
            for( i = I_MAX; i-- > 0; ) {
                dst = PtrRegs[S_SS][i];
                src = PtrRegs[S_DS][i];
                if( dst != NULL && src != NULL ) {
                    if( !RegsEqual( sc, dst->r.reg_index, src->r.reg_index ) ) {
                        RegInsert( sc, dst->r.reg_index, src->r.reg_index );
                    }
                }
            }
        } else if( xs->index == ES->r.reg_index ) {
            for( i = I_MAX; i-- > 0; ) {
                dst = PtrRegs[S_ES][i];
                src = PtrRegs[S_DS][i];
                if( dst != NULL && src != NULL ) {
                    if( !RegsEqual( sc, dst->r.reg_index, src->r.reg_index ) ) {
                        RegInsert( sc, dst->r.reg_index, src->r.reg_index );
                    }
                }
            }
        }
    }
}
Esempio n. 4
0
void    ScInitRegs( score *scoreboard )
/**************************************
    Add some register equality "truths" to the scoreboard "sc"
*/
{
    int xs;
    int ds;

    ds = AllocRegName( HW_DS )->r.reg_index;
    if( _IsntTargetModel( FLOATING_DS ) ) {
        if( _IsntTargetModel( FLOATING_ES ) ) {
            xs = AllocRegName( HW_ES )->r.reg_index;
            if( !RegsEqual( scoreboard, xs, ds ) ) {
                RegInsert( scoreboard, xs, ds );
            }
        }
        if( _IsntTargetModel( FLOATING_SS ) ) {
            xs = AllocRegName( HW_SS )->r.reg_index;
            if( !RegsEqual( scoreboard, xs, ds ) ) {
                RegInsert( scoreboard, xs, ds );
            }
        }
    }
}
Esempio n. 5
0
extern  void    RegAdd( score *sc, int dst_idx, int src_idx ) {
    /*************************************************************/

    /* NB: it is important that dst_idx has just become equal to src_idx*/
    /*     NOT vice-versa. Ie: we just did a  MOV R(src_idx) ==> R(dst_idx)*/
    /*     or equivalent*/

    if( ScoreList[ dst_idx ]->size != ScoreList[ src_idx ]->size ) return;
    if( !ScAddOk( ScoreList[ dst_idx ]->reg, ScoreList[ src_idx ]->reg ) )
        return;
    if( RegsEqual( sc, dst_idx, src_idx ) ) return;
    MergeDown( sc, dst_idx, src_idx );
    MergeUp( sc, dst_idx, src_idx );
    RegInsert( sc, dst_idx, src_idx );
}
Esempio n. 6
0
void    ScInitRegs( score *sc )
/**************************************
    Add some register equality "truths" to the scoreboard "sc"
*/
{
    int     ss;
    int     ds;

    if( _IsntTargetModel( FLOATING_DS | FLOATING_SS ) ) {
        ss = AllocRegName(HW_SS)->r.reg_index;
        ds = AllocRegName(HW_DS)->r.reg_index;
        if( RegsEqual( sc, ss, ds ) == false ) {
            RegInsert( sc, ss, ds );
        }
    }
}