예제 #1
0
type_class_def MapIntReturn( cg_type type )
/******************************************

*/
{
    switch( type ) {
    case TY_INT_1:
        return( I1 );
    case TY_INT_2:
        return( I2 );
    case TY_INT_4:
        return( I4 );
    case TY_INT_8:
        return( I8 );
    case TY_UINT_1:
        return( U1 );
    case TY_UINT_2:
        return( U2 );
    case TY_UINT_4:
        return( U4 );
    case TY_UINT_8:
        return( U8 );
    default:
        _Zoiks( ZOIKS_121 );
        return( XX );
    }
}
예제 #2
0
extern  void    BGProcInline( cg_sym_handle proc_sym, type_def *tipe ) {
/**********************************************************************/

    if( InlineStack->proc_sym != proc_sym || NotEquiv( InlineStack->tipe, tipe ) ) {
        _Zoiks( ZOIKS_072 );
    }
}
예제 #3
0
static  bool  ZapsMemory( name *result, name *op, bool for_index ) {
/*********************************************************************
    Could redefining "result" redefine N_MEMORY name "op"?
*/

    switch( result->n.class ) {
    case N_TEMP:
        return( false );
    case N_MEMORY:
        if( result->v.symbol != op->v.symbol )
            return( false );
        /* can be used for memory ops as well */
        if( for_index )
            return( true );
        return( TempsOverlap( result, op ) );
    case N_INDEXED:
        if( result->i.base == NULL ) {
            if( _IsModel( FORTRAN_ALIASING ) )
                return( false );
            if( op->v.usage & USE_ADDRESS )
                return( true );
            return( _IsntModel( RELAX_ALIAS ) );
        }
        if( result->i.base->n.class == N_TEMP ) {
            return( _IsntModel( RELAX_ALIAS ) );
        } else { /* it must be N_MEMORY*/
            return( ZapsMemory( result->i.base, op, true ) );
        }
    case N_REGISTER:
        return( false );
    default:
        _Zoiks( ZOIKS_023 );
        return( false );
    }
예제 #4
0
파일: optab.c 프로젝트: XVilka/owp4v1copy
extern  opcode_entry    *CodeTable( instruction *ins ) {
/******************************************************/


    int         idx;

    idx = ins->head.opcode;
    idx *= ( XX + 1 );
    idx += ins->type_class;
    idx = OpTable[  idx  ];
    if( idx == BAD ) {
        _Zoiks( ZOIKS_052 );
    }
#if _TARGET & _TARG_RISC
    if( idx == NYI ) {
        _Zoiks( ZOIKS_091 );
    }
#endif
    return( OpcodeTable( idx ) );
}
예제 #5
0
void    BGSelRange( sel_handle s_node, signed_32 lo, signed_32 hi, label_handle label )
/*************************************************************************************/
{
    select_list         *new_entry;

    if( ( hi ^ lo ) < 0 ) _Zoiks( ZOIKS_089 );
    new_entry = NewCase( lo, hi, label );
    new_entry->next = s_node->list;
    s_node->list = new_entry;
    s_node->num_cases += hi - lo + 1;
}
예제 #6
0
extern  void    BGSelRange( select_node *s_node, signed_32 lo,
                            signed_32 hi, code_lbl *label ) {
/*************************************************************/

    select_list         *new_entry;

    if( ( hi ^ lo ) < 0 ) _Zoiks( ZOIKS_089 );
    new_entry = NewCase( lo, hi, label );
    new_entry->next = s_node->list;
    s_node->list = new_entry;
    s_node->num_cases += hi - lo + 1;
}
예제 #7
0
extern  bool    ValidLbl( label_struct *lbl ) {
/*****************************************/

    label_struct        *chk;

    chk = Handles;
    for(;;) {
        if( chk == NULL ) break;
        if( chk == lbl ) return( true );
        chk = chk->link;
    }
    _Zoiks( ZOIKS_042 );
    return( false );
}
예제 #8
0
static  type_def        *UnSignedIntTipe( type_def *tipe )
/********************************************************/
{
    switch( tipe->length ) {
    case 1:
        return( TypeAddress( TY_UINT_1 ) );
    case 2:
        return( TypeAddress( TY_UINT_2 ) );
    case 4:
        return( TypeAddress( TY_UINT_4 ) );
    }
    _Zoiks( ZOIKS_102 );  /* if we get here bug */
    return( NULL );
}
예제 #9
0
static  byte    DoDisp( type_length val, hw_reg_set base_reg, name *op )
/**********************************************************************/
{
    name        *base;

    if( op == NULL ) {
        return( Displacement( val, base_reg ) );
    } else if( op->n.class == N_TEMP ) {
        base = DeAlias( op );
        if( base->t.location == NO_LOCATION ) {
            _Zoiks( ZOIKS_034 );
        }
        val += TmpLoc( base, op );
        return( Displacement( val, base_reg ) );
    } else if( op->n.class == N_MEMORY ) {
예제 #10
0
static void DoFix( block *blk )
/*****************************/
{
    block_num   i;

    if( _IsBlkVisited( blk ) )
        return;
    if( _IsBlkAttr( blk, BLK_RETURN ) )
        _Zoiks( ZOIKS_140 );
    blk->stack_depth += WORD_SIZE;
    _MarkBlkVisited( blk );
    for( i = 0; i < blk->targets; i++ ) {
        DoFix( blk->edge[i].destination.u.blk );
    }
}
예제 #11
0
static  byte    DoIndex( hw_reg_set regs )
/****************************************/
{
    byte i;

    for( i = 0; i < INDICES; ++i ) {
        if( HW_Equal( regs, IndexTab[i] ) ) {
            break;
        }
    }
    if( i >= INDICES ) {
        _Zoiks( ZOIKS_033 );
    }
    i <<= S_RMR_RM;
    return( i );
}
예제 #12
0
extern  void    BGRetInline( an addr, type_def *tipe ) {
/********************************************************/

    an  tempaddr;

    if( NotEquiv( tipe, InlineStack->tipe ) ) {
        _Zoiks( ZOIKS_070 );
    }
    if( addr == NULL ) {
        InlineStack->addr = MakeTempAddr( BGNewTemp(TypeInteger) );
    } else {
        tempaddr = MakeTempAddr( BGNewTemp( tipe ) );
        InlineStack->addr = BGCopy( tempaddr );
        BGDone( BGAssign( tempaddr, addr, tipe ) );
    }
}
예제 #13
0
static  void    GetToTopOfStack( instruction *ins, int virtual_reg ) {
    /*************************************************************/

    byte        actual_locn;
    byte        *actual_top_owner;

    actual_locn = InsLoc( ins, virtual_reg );
    if( actual_locn == ACTUAL_0 ) return;
    actual_top_owner = ActualStackOwner( ACTUAL_0 );
    if( actual_top_owner != NULL ) {
        PrefixExchange( ins, actual_locn );
        InsLoc( ins, virtual_reg ) = ACTUAL_0;
        *actual_top_owner = actual_locn;
        return;
    }
    _Zoiks( ZOIKS_076 );
}
예제 #14
0
void    CGMemFini( void )
/***********************/
{
#if _MEMORY_TRACKING & _FULL_TRACKING
    char        buff[80];

    if( !GetEnvVar( "TRQUIET", buff, 7 ) ) {
        _trmem_prt_list( Handle );
    }
    _trmem_close( Handle );
#elif _MEMORY_TRACKING & _CHUNK_TRACKING
    if( Chunks != 0 ) {
        _Zoiks( ZOIKS_002 );
    }
#endif
    MemFini();
}
예제 #15
0
type_class_def MapPointer( cg_type type )
/*************************************************
    return the internal type associated with
    pointer type given. This varies depending upon
    the archtecture
*/
{
    switch( type ) {
    case TY_NEAR_POINTER:
    case TY_NEAR_CODE_PTR:
    case TY_HUGE_POINTER:
    case TY_LONG_POINTER:
    case TY_LONG_CODE_PTR:
        return( U4 );
    default:
        _Zoiks( ZOIKS_121 );
        return( XX );
    }
}
예제 #16
0
axp_regn RegTransN( name *reg_name )
/***** Translate reg name to enum name ****/
{
    hw_reg_set reg;
    int       i;
    reg = reg_name->r.reg;

    for( i = 0; i < sizeof( QWordRegs ) / sizeof( QWordRegs[0] ); i++ ) {
        if( HW_Subset( QWordRegs[i], reg ) ) {
            return( i+AXP_REGN_r0 );
        }
    }
    for( i = 0; i < sizeof( FloatRegs ) / sizeof( FloatRegs[0] ); i++ ) {
        if( HW_Equal( reg, FloatRegs[i] ) ) {
            return( i+AXP_REGN_f0 );
        }
    }
    _Zoiks( ZOIKS_031 );
    return( AXP_REGN_END );
}
예제 #17
0
static  byte    DoDisp( name *op, hw_reg_set regs )
/*************************************************/
{
    name        *base;
    int         val;
    byte        dmod;
    name        *temp_base;

    val = op->i.constant;              /* use integer value*/
    base = op->i.base;
    if( !HasTrueBase( op ) ) {
        dmod = Displacement( val, regs );
    } else if( base->n.class == N_TEMP ) {
        temp_base = DeAlias( base );
        if( temp_base->t.location == NO_LOCATION ) {
            _Zoiks( ZOIKS_034 );
        }
        val += NewBase( temp_base ) + base->v.offset - temp_base->v.offset;
        dmod = Displacement( val, regs );
    } else {
예제 #18
0
hw_reg_set  *ParmChoices( type_class_def type_class )
/***************************************************/
{
    switch( type_class ) {
    case I4:
    case U4:
    case CP:
    case PT:
        return( RegSets[RL_PARM_4] );
    case I8:
    case U8:
    case XX:
        return( RegSets[RL_PARM_8] );
    case FS:
    case FD:
    case FL:
        return( RegSets[RL_PARM_F] );
    default:
        _Zoiks( ZOIKS_124 );
        return( NULL );
    }
}
예제 #19
0
extern  void    InitBlip() {
    /**************************/

#if 0
    char        *src_name;

    BlipsOn = FALSE;
    blipHandle = OpenFileMapping( FILE_MAP_WRITE, FALSE, SHMEM_NAME );
    if( blipHandle != NULL ) {
        fileMapping = MapViewOfFile( blipHandle, FILE_MAP_WRITE, 0, 0, 0 );
        if( fileMapping == NULL ) {
            _Zoiks( ZOIKS_110 );
            return;
        }
        BlipsOn = TRUE;
        src_name = FEAuxInfo( NULL, SOURCE_NAME );
        strncpy( &fileMapping->file_name[ 0 ], src_name, _MAX_PATH );
        strcpy( &fileMapping->rtn_name[ 0 ], "" );
        fileMapping->debug.debug_info = FALSE;
    }
#endif
}
예제 #20
0
extern  void    LookupRoutine( instruction *ins ) {
/*************************************************/

    rtn_info    *rtn;
    rt_class    rtindex;
    opcode_defs opcode;

    opcode = ins->head.opcode;
    if( opcode >= FIRST_CONDITION ) {
        opcode = OP_CMP;
    }
    rtn = RTInfo;
    for( rtindex = 0; rtn->op != opcode || rtn->operand_class != ins->type_class; ++rtindex ) {
        ++rtn;
        if( rtn->op == OP_NOP ) {
            ++rtindex;
            _Zoiks( ZOIKS_021 );
            break;
        }
    }
    RoutineNum = rtindex;
}
예제 #21
0
extern  bool    ValidLbl( label_handle lbl )
/******************************************/
{
    lbl=lbl;
    return( TRUE );
#if 0
    label_handle    chk;
    static label_handle last = 0;

    chk = Handles;
    if( last != NULL && last == lbl ) return( TRUE );
    for(;;) {
        if( chk == NULL ) break;
        if( chk == lbl ) {
            last = lbl;
            return( TRUE );
        }
        chk = chk->lbl.link;
    }
    _Zoiks( ZOIKS_042 );
    return( FALSE );
#endif
}
예제 #22
0
extern  hw_reg_set      VarargsHomePtr( void ) {

    _Zoiks( ZOIKS_078 );
    return( HW_EAX );
}
예제 #23
0
static  void    ExpandTlsOp( instruction *ins, name **pop )
/**********************************************************
    If *pop is a ref to a piece of thread-local data, replace
    it by a ref to an index [t1] and prepend the magic sequence
    to get the address of a piece of tls data to the instruction.
    Here is the sequence to access variable foo:
        mov fs:__tls_array -> t1
        mov __tls_index -> t2
        mov t2 * 4 -> t2
        add t1, t2 -> t1
        mov [ t1 ] -> t3
        mov foo[ t3 ] -> result
*/
{
    fe_attr             attr;
    name                *op;
    name                *temp;
    name                *tls_data;
    name                *index;
    name                *base;
    instruction         *new_ins;

    op = *pop;
    switch( op->n.class ) {
    case N_MEMORY:
        if( op->m.memory_type == CG_FE ) {
            attr = FEAttr( op->v.symbol );
            if( ( attr & FE_THREAD_DATA ) != 0 ) {
                *pop = GetTLSDataRef( ins, op, _OpClass(ins) );
            }
        }
        break;
    case N_INDEXED:
        // gotta check for the base being one of these stupid TLS things
        if( op->i.base != NULL && ( op->i.index_flags & X_FAKE_BASE ) == 0 ) {
            base = op->i.base;
            if( base->n.class != N_MEMORY || base->m.memory_type != CG_FE ) break;
            attr = FEAttr( base->v.symbol );
            if( ( attr & FE_THREAD_DATA ) == 0 ) break;
            tls_data = GetTLSDataRef( ins, base, _OpClass(ins) );
            temp = AllocTemp( WD );
            new_ins = MakeUnary( OP_LA, tls_data, temp, WD );
            PrefixIns( ins, new_ins );
            index = op->i.index;
            if( op->i.scale != 0 ) {
                const signed_32 values[] = { 1, 2, 4, 8, 16 };
                if( op->i.scale > 4 ) _Zoiks( ZOIKS_134 );
                index = AllocTemp( WD );
                new_ins = MakeBinary( OP_MUL, op->i.index,
                                AllocS32Const( values[ op->i.scale ] ),
                                index, WD );
                PrefixIns( ins, new_ins );
            }
            new_ins = MakeBinary( OP_ADD, temp, index, temp, WD );
            PrefixIns( ins, new_ins );
            *pop = ScaleIndex( temp, NULL, 0,
                            _OpClass(ins),
                            TypeClassSize[ _OpClass(ins) ],
                            0, 0 );
        }
        break;
    }
예제 #24
0
extern hw_reg_set ScratchReg( void ) {
    _Zoiks( ZOIKS_091 );
    return( HW_SI );
}