Example #1
0
extern  void    RegInsert( score *sc, int dst_idx, int src_idx ) {
    /****************************************************************/

    score       *dst;
    score       *src;
    score       *next;
    byte        gen_num;
    list_head   **free_heads;

    src = &sc[ src_idx ];
    dst = &sc[ dst_idx ];
    ScoreFreeList( dst );
    free_heads = (list_head **)&sc[ ScoreCount ];
    *dst->list = (list_head)*free_heads;
    *free_heads = dst->list;
    next = dst;
    for(;;) {
        next->list = src->list;
        next = next->next_reg;
        if( next == dst ) break;
    }
    next = src;
    gen_num = 0;
    for(;;) {
        next = next->next_reg;
        ++gen_num;
        if( next == src ) break;
    }
    dst->generation = gen_num;
    src->prev_reg->next_reg = dst;
    dst->prev_reg->next_reg = src;
    next = src->prev_reg;
    src->prev_reg = dst->prev_reg;
    dst->prev_reg = next;
}
Example #2
0
void    FreeScoreBoard( score *p )
/********************************/
{
    int         i;
    list_head   *list_heads;
    score       *q;

    if( p != NULL ) {
        q = p;
        for( i = ScoreCount; i > 0; --i ) {
            ScoreFreeList( q );
            ++q;
        }
        list_heads = (list_head *)&p[ScoreCount];
        *list_heads = NULL;  /* initialize free list*/
        for( i = ScoreCount; i > 0; --i ) {
            ++list_heads;
            p->list = list_heads;
            *list_heads = NULL;
            p->next_reg = p;
            p->prev_reg = p;
            p->generation = 0;
            ++p;
        }
    }
}
Example #3
0
extern  void    RegKill( score *scoreboard, hw_reg_set regs ) {
    /*************************************************************/

    score_reg   *entry;
    score_list  *curr_list;
    score_list  **owner;
    int         i;
    list_head   **free_heads;

    if( !HW_CEqual( regs, HW_EMPTY ) ) {
        entry = *ScoreList;
        free_heads = (list_head **)&scoreboard[ ScoreCount ];
        for( i = ScoreCount; i > 0; --i ) {
            if( HW_Ovlap( entry->reg, regs ) ) {
                if( scoreboard->list != NULL ) {
                    if( scoreboard->next_reg == scoreboard ) {
                        ScoreFreeList( scoreboard );
                    } else {
                        scoreboard->list = *free_heads;
                        *free_heads = (list_head *)**free_heads;
                        *scoreboard->list = NULL;
                    }
                }
                scoreboard->prev_reg->next_reg = scoreboard->next_reg;
                scoreboard->next_reg->prev_reg = scoreboard->prev_reg;
                scoreboard->next_reg = scoreboard;
                scoreboard->prev_reg = scoreboard;
                scoreboard->generation = 0;
            } else {
                owner = scoreboard->list;
                for( ; ; ) {
                    curr_list = *owner;
                    if( curr_list == NULL ) break;
                    if( curr_list->info.index_reg != NO_INDEX
                            && HW_Ovlap( ScoreList[ curr_list->info.index_reg ]->reg, regs ) ) {
                        *owner = curr_list->next;
                        FreeScListEntry( curr_list );
                    } else {
                        owner = &curr_list->next;
                    }
                }
            }
            ++entry;
            ++scoreboard;
        }
    }
}