Exemplo n.º 1
0
extern  an      BGStopInline( call_handle handle, type_def *tipe ) {
/******************************************************************/

    // works if we're in the middle of a conditional???

    label_handle    lbl;
    inline_stack    *junk;
    an              retv;

    if( HaveCurrBlock == FALSE ) {
        EnLink( AskForNewLabel(), TRUE );
        HaveCurrBlock = TRUE;
    }
    lbl = AskForNewLabel();
    GenBlock( JUMP, 1 );
    AddTarget( lbl, FALSE );
    EnLink( lbl, TRUE );
    InlineStack->tipe = tipe;
    FEGenProc( InlineStack->proc_sym, handle );
    retv = InlineStack->addr;
    junk = InlineStack;
    InlineStack = InlineStack->next;
    CGFree( junk );
    return( retv );
}
Exemplo n.º 2
0
static  an      FlowOut( an node, type_def *tipe ) {
/**************************************************/

    name                *temp;
    label_handle        lbl;

    lbl = AskForNewLabel();
    temp = BGGlobalTemp( tipe );
    AddIns( MakeMove( AllocIntConst( FETrue() ), temp, temp->n.type_class ) );
    *(node->u.b.t) = CurrBlock->label;
    GenBlock( BLK_JUMP, 1 );
    AddTarget( lbl, false );
    EnLink( AskForNewLabel(), true );
    AddIns( MakeMove( AllocIntConst( 0 ), temp, temp->n.type_class ) );
    *(node->u.b.f) = CurrBlock->label;
    GenBlock( BLK_JUMP, 1 );
    AddTarget( lbl, false );
    EnLink( lbl, true );
    NamesCrossBlocks();
    AddrFree( node );
    return( AddrName( temp, tipe ) );
}
Exemplo n.º 3
0
void GoRegionBoard::UpdateBlock(int move, SgBlackWhite moveColor)
{
    SgPoint anchor = Board().Anchor(move); // board is already up to date.
    bool done = false;
    const int size = Board().Size();
    if (! Board().IsSingleStone(move)) // find old neighbor blocks
    {
        SgVectorOf<GoBlock> old;
        for (GoNbIterator it(Board(), move); it; ++it)
        {
            if (IsColor(*it, moveColor))
                old.Include(BlockAt(*it));
        }
        if (old.IsLength(1)) // append to single neighbor block
        {
            GoBlock* b = old.Front();
            AppendStone(b, move);
            done = true;
        }
        else // delete old, recompute
        {
            for (SgVectorIteratorOf<GoBlock> it(old); it; ++it)
                RemoveBlock(*it, true, true);
        }
    }

    if (! done) // create new block.
    {
        GoBlock* b = GenBlock(anchor, moveColor);
        SgPointSet area(b->Stones().Border(size));
        // link it to neighbor regions
        SgVectorOf<GoRegion> regions;
        RegionsAt(area, moveColor, &regions);
        for (SgVectorIteratorOf<GoRegion> it(regions); it; ++it)
            (*it)->BlocksNonConst().PushBack(b);
    }
}
Exemplo n.º 4
0
void GoRegionBoard::GenBlocks()
{
    for (GoBlockIterator it(Board()); it; ++it)
        GenBlock(*it, Board().GetStone(*it));
}