Example #1
0
void CgBackGenLabelInternal(    // GENERATE A LABEL FOR INTERNAL STRUCTURE
    SYMBOL sym )                // - symbol defining label
{
#if _CPU == _AXP
    DgAlignSegment( SEG_CONST, TARGET_POINTER );
#endif
    DGLabel( FEBack( sym ) );
}
Example #2
0
extern  pointer LkAddBack( sym_handle sym, pointer curr_back ) {
/**************************************************************/

    b   *bk;

    NewBackReturn = TO_FAKE_BACK( curr_back );
    bk = FEBack( sym );
    NewBackReturn = NULL;
    return( TO_REAL_BACK( bk ) );
}
Example #3
0
extern  void    FEPtr( cg_sym_handle sym, type_def *tipe, offset plus ) {
/*******************************************************************/

    tipe = tipe;
    assert( tipe->length == 4 );
    TellOptimizerByPassed();
    OutReloc( FEBack( sym )->lbl, OWL_RELOC_WORD, 0 );
    ObjBytes( &plus, 4 );
    TellByPassOver();
}
Example #4
0
extern  void    FEPtrBase( cg_sym_handle sym )
/*****************************************/
{
    segment_id          seg;

    TellOptimizerByPassed();
    seg = FESegID( sym );
    OutSegReloc( FEBack( sym )->lbl, seg );
    ObjBytes( "\0\0", 2 );
    TellByPassOver();
}
Example #5
0
fe_seg_id CgBackGenLabel(       // GENERATE A LABEL
    SYMBOL sym )                // - symbol defining label
{
    segment_id      old_id;     // - old segment
    segment_id      seg_id;     // - new segment

    seg_id = FESegID( sym );
    old_id = BESetSeg( seg_id );
    DGLabel( FEBack( sym ) );
    return old_id;
}
Example #6
0
fe_seg_id CgBackGenLabelInternal(// GENERATE A LABEL FOR INTERNAL STRUCTURE
    SYMBOL sym )                // - symbol defining label
{
    segment_id      old_id;     // - old segment
    segment_id      seg_id;     // - new segment

    seg_id = FESegID( sym );
    old_id = BESetSeg( seg_id );
    DgAlignInternal();
    DGLabel( FEBack( sym ) );
    return old_id;
}
Example #7
0
extern  void    DFSymRange( cg_sym_handle sym, offset size ) {
    /*********************************************************/
    // I don't see what this is good for. The aranges for any
    // comdat symbols will be taken care of by DFSegRange().
    // Running this code may produce overlapping aranges that
    // confuse the hell out of the debugger. However, not running
    // this may cause debug information to be missing... call it
    // a FIXME

    if( !_IsModel( DBG_LOCALS | DBG_TYPES ) )return;
    ARange = FEBack( sym );
    DWAddress( Client, size );
}
Example #8
0
extern  pointer LkAddBack( sym_handle sym, pointer curr_back ) {
/**************************************************************/

    b   *bk;

    if( curr_back == NULL ) {
        NewBackReturn = RETURN_NULL;
    } else {
        NewBackReturn = (pointer)( PTR_INT( curr_back ) | FAKE_BACK );
    }
    bk = FEBack( sym );
    NewBackReturn = RETURN_NORMAL;
    return( (pointer)( PTR_INT( bk ) & ~FAKE_BACK ) );
}
Example #9
0
extern  void    FEPtrBaseOffset( cg_sym_handle sym,  offset plus ) {
/***************************************************************/
    back_handle     bck;
//    segment_id          seg;

    TellOptimizerByPassed();
    bck = FEBack( sym );
//    seg = FESegID( sym );
    OutReloc( bck->lbl, OWL_RELOC_SECTION_INDEX, 0 );
    ObjBytes( &plus, 4 );
//    OutSegReloc( bck->lbl, seg );
    OutReloc( bck->lbl, OWL_RELOC_SECTION_OFFSET, 0 );
    ObjBytes( "\0\0", 2 );
    TellByPassOver();
}
Example #10
0
void DgSymbolDefInit(           // DATA GENERATE SYMBOL (DEFAULT DATA)
    SYMBOL sym )                // - the symbol
{
    segment_id      old_id;     // - old segment
    segment_id      seg_id;     // - symbol segment
    target_size_t   size;       // - size of symbol

    seg_id = FESegID( sym );
    old_id = BESetSeg( seg_id );
    DgAlignSymbol( sym );
    DGLabel( FEBack( sym ) );
    size = CgMemorySize( sym->sym_type );
    if( sym->segid == SEG_BSS ) {
        DgUninitBytes( size );
    } else {
        DgInitBytes( size, 0 );
    }
    BESetSeg( old_id );
}
Example #11
0
static void EmitDQuad( DATA_QUAD *dq )
{
    cg_type             data_type;
    int                 size_of_item;
    unsigned long       amount;
    auto SYM_ENTRY      sym;

    static int          segment;
    static unsigned long size = 0;

    if( dq->flags & Q_NEAR_POINTER ) {
        data_type = T_NEAR_POINTER;
        size_of_item = TARGET_NEAR_POINTER;
    } else if( dq->flags & Q_FAR_POINTER ) {
        data_type = T_LONG_POINTER;
        size_of_item = TARGET_FAR_POINTER;
    } else if( dq->flags & Q_CODE_POINTER ) {
        data_type = T_CODE_PTR;
        size_of_item = TARGET_POINTER;
#if _CPU == 8086
        if( TargetSwitches & BIG_CODE ) {
            size_of_item = TARGET_FAR_POINTER;
        }
#endif
    } else {
        data_type = T_POINTER;
        size_of_item = TARGET_POINTER;
#if _CPU == 8086
        if( TargetSwitches & BIG_DATA ) {
            size_of_item = TARGET_FAR_POINTER;
        }
#endif
    }
#if _CPU == 8086
    if( size >= 0x10000 ) {
        if( segment != SEG_CONST  &&  segment != SEG_DATA ) {
            ++segment;
            BESetSeg( segment );
            size -= 0x10000;
        }
    }
#endif
    switch( dq->type ) {
    case QDT_STATIC:
        SymGet( &sym, dq->u.var.sym_handle );
        segment = sym.u.var.segment;
        BESetSeg( segment );
        AlignIt( sym.sym_type );
        DGLabel( FEBack( dq->u.var.sym_handle ) );
        size = 0;
        break;
    case QDT_CHAR:
    case QDT_UCHAR:
    case QDT_BOOL:
        DGInteger( dq->u.long_values[0], T_UINT_1 );
        size += sizeof( char );
        if( dq->flags & Q_2_INTS_IN_ONE ) {
            DGInteger( dq->u.long_values[1], T_UINT_1 );
            size += sizeof( char );
        }
        break;
    case QDT_SHORT:
    case QDT_USHORT:
        DGInteger( dq->u.long_values[0], T_UINT_2 );
        size += sizeof( target_short );
        if( dq->flags & Q_2_INTS_IN_ONE ) {
            DGInteger( dq->u.long_values[1], T_UINT_2 );
            size += sizeof( target_short );
        }
        break;
    case QDT_INT:
    case QDT_UINT:
        DGInteger( dq->u.long_values[0], T_INTEGER );
        size += sizeof( target_int );
        if( dq->flags & Q_2_INTS_IN_ONE ) {
            DGInteger( dq->u.long_values[1], T_INTEGER );
            size += sizeof( target_int );
        }
        break;
    case QDT_LONG:
    case QDT_ULONG:
        DGInteger( dq->u.long_values[0], T_UINT_4 );
        size += sizeof( target_long );
        if( dq->flags & Q_2_INTS_IN_ONE ) {
            DGInteger( dq->u.long_values[1], T_UINT_4 );
            size += sizeof( target_long );
        }
        break;
    case QDT_LONG64:
    case QDT_ULONG64:
        DGInteger64( dq->u.long64, T_UINT_8 );
        size += sizeof( int64 );
        break;

    case QDT_FLOAT:
    case QDT_FIMAGINARY:
//      ftoa( dq->u.double_value, Buffer );
//      DGFloat( Buffer, T_SINGLE );
        {
            DATA_QUAD   local_dq;
            float       float_value;

            // dq->u.double_value may not have proper alignment on Alpha
            // so copy pieces to local copy on stack which will have
            // proper alignment
            local_dq.u.long_values[0] = dq->u.long_values[0];
            local_dq.u.long_values[1] = dq->u.long_values[1];
            float_value = (float)local_dq.u.double_value;
            DGBytes( sizeof(float), (char *)&float_value );
        }
        size += sizeof( float );
        break;
    case QDT_DOUBLE:
    case QDT_DIMAGINARY:
//      ftoa( dq->u.double_value, Buffer );
//      DGFloat( Buffer, TY_DOUBLE );
        DGBytes( sizeof(double), (char *)&dq->u.double_value );
        size += sizeof( double );
        break;
    case QDT_LONG_DOUBLE:
    case QDT_LDIMAGINARY:
        DGBytes( sizeof(long_double), (char *)&dq->u.long_double_value );
        size += sizeof( long_double );
        break;
    case QDT_STRING:
        EmitStrPtr( dq->u.string_leaf, data_type );
        size += size_of_item;
        break;
    case QDT_POINTER:
    case QDT_ID:
        if( dq->u.var.sym_handle == 0 ) {
            DGInteger( dq->u.var.offset, data_type );
        } else {
            DGFEPtr( dq->u.var.sym_handle, data_type, dq->u.var.offset );
        }
        size += size_of_item;
        break;
    case QDT_CONST:                       /* array of characters */
        size += EmitBytes( dq->u.string_leaf );
        break;
    case QDT_CONSTANT:
#if _CPU == 8086
        for( amount = dq->u.long_values[0]; amount != 0; ) {
            if( amount + size >= 0x00010000 ) {
                EmitZeros( 0x10000 - size );
                amount -= ( 0x10000 - size );
                size = 0;
                if( segment != SEG_CONST  &&  segment != SEG_DATA ) {
                    ++segment;
                    BESetSeg( segment );
                }
            } else {
                EmitZeros( amount );
                size += amount;
                amount = 0;
            }
        }
#else
        amount = dq->u.long_values[0];
        EmitZeros( amount );
        size += amount;
#endif
        break;
    }
}
Example #12
0
void CgBackGenLabel(            // GENERATE A LABEL
    SYMBOL sym )                // - symbol defining label
{
    DGLabel( FEBack( sym ) );
}
Example #13
0
extern  void    DFObjInitDbgInfo( void ) {
/*****************************************************/
/* called by objinit to init segments and dwarf writing library */
    static const dw_funcs cli_funcs = {
        CLIReloc,
        CLIWrite,
        CLISeek,
        CLITell,
        CLIAlloc,
        CLIFree
    };
    dw_init_info    info;
    cg_sym_handle   abbrev_sym;
    cg_sym_handle   debug_pch;
    fe_attr         attr;

    if( _IsntModel( DBG_LOCALS | DBG_TYPES ) ){
        return;
    }
    info.compiler_options = DW_CM_DEBUGGER;
    info.abbrev_sym = 0;
    info.producer_name = SetDwarfProducer();
    info.language = SetLang();
    if( setjmp( info.exception_handler ) == 0 ) {
        info.funcs = cli_funcs;
        InitSegBck(); // start each seg with a ref label
        if( _IsModel( DBG_PREDEF ) ) {
            abbrev_sym = FEAuxInfo( NULL, DBG_PREDEF_SYM );
            info.abbrev_sym = (dw_sym_handle)abbrev_sym;
            attr = FEAttr( abbrev_sym );
            if( (attr & FE_IMPORT) ) {
                info.compiler_options |= DW_CM_ABBREV_PRE;
            }else{
                back_handle bck;
                segment_id  old;

                info.compiler_options |= DW_CM_ABBREV_GEN;
                bck = FEBack( abbrev_sym ); // dump out export label
                bck->seg = DwarfSegs[DW_DEBUG_ABBREV].seg;
                old = SetOP( DwarfSegs[DW_DEBUG_ABBREV].seg );
                DataLabel( bck->lbl );
                SetOP( old );
            }
        }
        debug_pch = FEAuxInfo( NULL, DBG_PCH_SYM );
        if( debug_pch != NULL ){
            attr = FEAttr( debug_pch );
            if( !(attr & FE_IMPORT) ) {
                back_handle bck;
                segment_id  old;

                bck = FEBack( debug_pch );
                bck->seg = DwarfSegs[DW_DEBUG_INFO].seg;
                old = SetOP( DwarfSegs[DW_DEBUG_INFO].seg );
                DataLabel( bck->lbl );
                SetOP( old );
                debug_pch = NULL;
            }
        }
        Client = DWInit( &info );
        if( Client == NULL ) {
            Zoiks( ZOIKS_107 ); /* Bad */
        }
        DFBegCCU( AskCodeSeg(), (dw_sym_handle)debug_pch );
    } else {
        Zoiks( ZOIKS_107 ); /* Big Error */
    }
}