Пример #1
0
void CondInfoSetFlag(           // SET FLAG FOR CONDITIONAL DTOR BLOCK
    FN_CTL* fctl,               // - function control
    bool set_flag )             // - true ==> set the flag; false ==> clear
{
    COND_STK* stk;              // - conditional entry
    cg_name op_flg;             // - expression for flag setting
    cg_name op_mask;            // - mask operand
    COND_INFO cond;             // - conditional information
    patch_handle patch;         // - handle for patch
    cg_op opcode;               // - opcode for set/clr

    stk = PstkTopElement( &stack_cond_blks );
    CondInfoSetup( stk->offset, &cond, fctl );
    patch = BEPatch();
    op_mask = CGPatchNode( patch, TY_UINT_1 );
    if( set_flag ) {
        stk->mask_set = cond.mask;
        stk->handle_set = patch;
        opcode = O_OR;
    } else {
        stk->mask_clr = NOT_BITARR_MASK( cond.mask );
        stk->handle_clr = patch;
        opcode = O_AND;
    }
    op_flg = CgSymbolPlusOffset( cond.sym, cond.offset );
    op_flg = CGLVPreGets( opcode, op_flg, op_mask, TY_UINT_1 );
    CgExprPush( op_flg, TY_POINTER );
}
Пример #2
0
static cg_name condSet(         // SET/RESET FLAG
    unsigned index,             // - index of flag
    bool set_flag,              // - true ==> set the flag; false ==> clear
    FN_CTL* fctl )              // - function information
{
    cg_name op_flg;             // - expression for flag setting
    cg_name op_mask;            // - mask operand
    COND_INFO cond;             // - conditional information

    CondInfoSetup( index, &cond, fctl );
    op_flg = CgSymbolPlusOffset( cond.sym, cond.offset );
    if( set_flag ) {
        op_mask = CGInteger( cond.mask, TY_UINT_1 );
        op_flg = CGLVPreGets( O_OR, op_flg, op_mask, TY_UINT_1 );
    } else {
        op_mask = CGInteger( NOT_BITARR_MASK( cond.mask ), TY_UINT_1 );
        op_flg = CGLVPreGets( O_AND, op_flg, op_mask, TY_UINT_1 );
    }
    return( op_flg );
}
Пример #3
0
static cg_name ctorFlagSet(     // SET/RESET CTOR FLAG
    FN_CTL* fctl,               // - function info
    cg_op opcode,               // - set/reset opcode
    patch_handle* a_ph )        // - addr[ patch_handle ]
{
    unsigned offset;            // - offset of flag byte
    unsigned mask;              // - mask for byte
    cg_name op_flg;             // - expression for code-gen

    mask = FnCtlCondFlagCtor( fctl );
    offset = mask / 8;
    mask &= 7;
    op_flg = CgSymbolPlusOffset( FstabRw(), offset + CgbkInfo.size_rw_base );
    *a_ph = BEPatch();
    op_flg = CGLVPreGets( opcode
                        , op_flg
                        , CGPatchNode( *a_ph, TY_UINT_1 )
                        , TY_UINT_1 );
    return op_flg;
}