Ejemplo n.º 1
0
static void DumpFunction(const Proto* f, const TString* p, DumpState* D)
{
 DumpString((f->source==p || D->strip) ? NULL : f->source,D);
 DumpInt(f->linedefined,D);
 DumpInt(f->lastlinedefined,D);
 DumpChar(f->nups,D);
 DumpChar(f->numparams,D);
 DumpChar(f->is_vararg,D);
 DumpChar(f->maxstacksize,D);
 DumpCode(f,D);
 DumpConstants(f,D);
 DumpDebug(f,D);
}
Ejemplo n.º 2
0
static void DumpFunction(const Proto* f, DumpState* D)
{
 int i;
 DumpInt(f->linedefined,D);
 DumpInt(f->lastlinedefined,D);
 DumpChar(f->numparams,D);
 DumpChar(f->is_vararg,D);
 DumpChar(f->maxstacksize,D);
 DumpInt(f->sizecode,D);
 for (i=0; i<f->sizecode; i++) DumpUInt(f->code[i],D);
 DumpConstants(f,D);
 DumpUpvalues(f,D);
 DumpDebug(f,D);
}
Ejemplo n.º 3
0
static void DumpFunction(const Proto* f, const TString* p, DumpState* D)
{
 DumpString((f->source==p) ? NULL : f->source,D);
 DumpInt(f->linedefined,D);
 DumpInt(f->lastlinedefined,D);
 DumpChar(f->nups,D);
 DumpChar(f->numparams,D);
 DumpChar(f->is_vararg,D);
 DumpChar(f->maxstacksize,D);
 if (D->strip) DumpInt(0,D); else DumpLines(f,D);
 if (D->strip) DumpInt(0,D); else DumpLocals(f,D);
 if (D->strip) DumpInt(0,D); else DumpUpvalues(f,D);
 DumpConstants(f,D);
 DumpCode(f,D);
}
Ejemplo n.º 4
0
static  void    DumpIndent( int i )
/*********************************/
{
    while( --i >= 0 ) {
        DumpChar( ' ' );
    }
}
Ejemplo n.º 5
0
int main()
{
LOGFILE.open("lab2_part1.log",ios::trunc);
if (LOGFILE.is_open())
  LOGFILE << POS_IN_PROGRAM << "start of logging" << endl;
else 
  {
  cout << "Unable to open file for logging.";
  return 1;
  }
	
// now all your regular stuff can go here

char c_array[5];
int i_array[5];
string intMsg = "Populate the int array with values.";
string charMsg = "Populate the char array with values.";
string dmpIntMsg = "Dump the data in the int array";
string dmpCharMsg = "Dump the data in the char array";

PromptForInt(intMsg, i_array);
PromptForChar(charMsg, c_array);

DumpInt(dmpIntMsg, i_array);
DumpChar(dmpCharMsg, c_array);


// close the logfile and exit
LOGFILE.close();
return 0;
}
Ejemplo n.º 6
0
static  void    DoOffset( unsigned_32 o ) {
/*****************************************/

    DumpChar( '\t' );
    Dump8h( o );
    DumpNL();
}
Ejemplo n.º 7
0
static void DumpNumber(lua_Number x, DumpState* D)
{
 /*
   http://stackoverflow.com/questions/14954088/how-do-i-handle-byte-order-differences-when-reading-writing-floating-point-types/14955046#14955046

   10-byte little-endian serialized format for double:
   - normalized mantissa stored as 64-bit (8-byte) signed integer:
       negative range: (-2^53, -2^52]
       zero: 0
       positive range: [+2^52, +2^53)
   - 16-bit (2-byte) signed exponent:
       range: [-0x7FFE, +0x7FFE]

   Represented value = mantissa * 2^(exponent - 53)

   Special cases:
   - +infinity: mantissa = 0x7FFFFFFFFFFFFFFF, exp = 0x7FFF
   - -infinity: mantissa = 0x8000000000000000, exp = 0x7FFF
   - NaN:       mantissa = 0x0000000000000000, exp = 0x7FFF
   - +/-0:      only one zero supported
 */
 double y=(double)x,m;
 unsigned char z[8];
 long long im;
 int ie;
 if (luai_numisnan(NULL,x)) { DumpChar(0,D); /* NaN */ return; }
 else if (x == LUA_INFINITY) { DumpChar(1,D); /* +inf */ return; }
 else if (x == -LUA_INFINITY) { DumpChar(2,D); /* -inf */ return; }
 else if (x == 0) { DumpChar(3,D); /* 0 */ return; }
 /* Split double into normalized mantissa (range: (-1, -0.5], 0, [+0.5, +1)) and base-2 exponent */
 m = frexp(y, &ie); /* y = m * 2^ie exactly for FLT_RADIX=2, frexp() can't fail */
 /* Extract most significant 53 bits of mantissa as integer */
 m = ldexp(m, 53); /* can't overflow because DBL_MAX_10_EXP >= 37 equivalent to DBL_MAX_2_EXP >= 122 */
 im = (long long)trunc(m);    /* exact unless DBL_MANT_DIG > 53 */
 /* If the exponent is too small or too big, reduce the number to 0 or +/- infinity */
 if (ie>0x7FFE)
 {
   if (im<0) DumpChar(2,D); /* -inf */ else DumpChar(1,D); /* +inf */
   return;
 }
 else if (ie<-0x7FFE) { DumpChar(3,D); /* 0 */ return; }
 DumpChar(4,D); /* encoded */
 /* Store im as signed 64-bit little-endian integer */
 z[0]=(unsigned char)(im&0xFF);
 z[1]=(unsigned char)((im>>8)&0xFF);
 z[2]=(unsigned char)((im>>16)&0xFF);
 z[3]=(unsigned char)((im>>24)&0xFF);
 z[4]=(unsigned char)((im>>32)&0xFF);
 z[5]=(unsigned char)((im>>40)&0xFF);
 z[6]=(unsigned char)((im>>48)&0xFF);
 z[7]=(unsigned char)((im>>56)&0xFF);
 DumpMem(z,1,8,D);
 /* Store ie as signed 16-bit little-endian integer */
 z[0]=(unsigned char)(ie&0xFF);
 z[1]=(unsigned char)((ie>>8)&0xFF);
 DumpMem(z,1,2,D);
}
Ejemplo n.º 8
0
static  void    DumpScList( score_list *curr )
/********************************************/
{
    DumpLiteral( "    " );
    switch( curr->info.class ) {
    case SC_N_CONSTANT:
        DumpChar( '&' );
        DumpLong( curr->info.offset );
        break;
    case SC_N_TEMP:
        DumpChar( 't' );
        DumpInt( curr->info.symbol.t->v.id );
        DumpLiteral( " offset " );
        DumpLong( curr->info.offset );
        break;
    case SC_N_MEMORY:
        DumpXString( FEName( curr->info.symbol.p ) );
        DumpLiteral( " offset " );
        DumpLong( curr->info.offset );
        break;
    case SC_N_INDEXED:
        if( curr->info.base == NULL ) {
            ;
        } else if( curr->info.base->n.class == N_TEMP ) {
            DumpChar( 't' );
            DumpInt( curr->info.base->t.v.id );
            DumpChar( '+' );
        } else {
            DumpXString( FEName( curr->info.base->v.symbol ) );
            DumpChar( '+' );
        }
        DumpLong( curr->info.offset );
        DumpChar( '[' );
        DumpRegName( ScoreList[curr->info.index_reg]->reg );
        DumpChar( ']' );
        break;
    case SC_N_INITIAL:
        DumpLiteral( "INITIAL(" );
        DumpLong( curr->info.offset );
        DumpChar( ')' );
        break;
    case SC_N_VOLATILE:
        DumpLiteral( "VOLATILE - Oh No!" );
        break;
    case SC_N_ADDRESS:
        DumpLiteral( "ADDRESS(" );
        DumpOperand(curr->info.symbol.p);
        DumpChar( ')' );
        break;
    }
Ejemplo n.º 9
0
void    DumpOpcodeName( int opcode )
/**********************************/
{
    if( opcode > OP_BLOCK || opcode < 0 ) {
        DumpLiteral( "??????" );
    } else {
        DumpString( OpcodeList[opcode] );
        DumpChar( ' ' );
    }
}
Ejemplo n.º 10
0
static  void    DumpInv( name *name ) {
/***************************************/

    for( ; name != NULL; name = name->n.next_name ) {
        if( _ChkLoopUsage( name, VU_INVARIANT ) ) {
            DumpOperand( name );
            DumpChar( ' ' );
        }
    }
    DumpNL();
}
Ejemplo n.º 11
0
static  void    DumpRgSet( hw_reg_set *possible )
/**************************************************/
{
    if( possible != NULL ) {
        DumpLiteral( " Choices " );
        for( ; !HW_CEqual( *possible, HW_EMPTY ); ++possible ) {
            DumpRegName( *possible );
            DumpChar( ' ' );
        }
    }
}
Ejemplo n.º 12
0
static  void    DoDump( reg_tree *tree, int indent ) {
/****************************************************/

    DumpIndent( indent );
    DumpRegs( tree->regs );
    DumpNL();
    DumpIndent( indent );
    DumpLiteral( "offset " );
    DumpInt( tree->offset );
    DumpLiteral( " size " );
    DumpInt( tree->size );
    DumpNL();
    if( tree->temp != NULL ) {
        DumpIndent( indent );
        DumpLiteral( "name " );
        DumpPtr( tree->temp );
        DumpChar( ' ' );
        DumpSym( tree->temp );
        DumpNL();
    }
    if( tree->alt != NULL ) {
        DumpIndent( indent );
        DumpLiteral( "alt  " );
        DumpPtr( tree->alt  );
        DumpChar( ' ' );
        DumpSym( tree->alt );
        DumpNL();
    }
    if( tree->hi != NULL ) {
        DumpIndent( indent );
        DumpLiteral( "high " );
        DumpNL();
        DoDump( tree->hi, indent + 4 );
    }
    if( tree->lo != NULL ) {
        DumpIndent( indent );
        DumpLiteral( "low  " );
        DumpNL();
        DoDump( tree->lo, indent + 4 );
    }
}
Ejemplo n.º 13
0
static  bool    LblName( label_handle lbl ) {
/*****************************************/


    if( ValidLbl( lbl ) == false ) return( false );
    DumpChar( 'L' );
    DumpPtr( lbl );
    if( lbl->lbl.sym == NULL ) return( true );
    DumpChar( '(' );
    if( AskIfRTLabel( lbl ) ) {
        DumpXString( AskRTName( (rt_class)(pointer_int)lbl->lbl.sym ) );
    } else if( AskIfCommonLabel( lbl ) ) {
        DumpLiteral( "Common import => [" );
        DumpInt( (int)(pointer_int)lbl->lbl.sym );
        DumpLiteral( "] " );
    } else {
        DumpXString( FEName( lbl->lbl.sym ) );
    }
    DumpChar( ')' );
    return( true );
}
Ejemplo n.º 14
0
extern  void    DumpInOut( instruction *ins ) {
/*********************************************/

    DumpLiteral( "     " );
    DumpGBit( &ins->head.live.out_of_block );
    DumpChar( ' ' );
    DumpLBit( &ins->head.live.within_block );
    if( !HW_CEqual( ins->head.live.regs, HW_EMPTY ) && !HW_COvlap( ins->head.live.regs, HW_UNUSED ) ) {
        DumpLiteral( "  " );
        DumpRegName( ins->head.live.regs );
    }
    DumpNL();
}
Ejemplo n.º 15
0
static void DumpConstants(const Proto* f, DumpState* D)
{
 int i,n=f->sizek;
 DumpInt(n,D);
 for (i=0; i<n; i++)
 {
  const TValue* o=&f->k[i];
  DumpChar(ttype(o),D);
  switch (ttype(o))
  {
   case LUA_TNIL:
	break;
   case LUA_TBOOLEAN:
	DumpChar(bvalue(o),D);
	break;
#ifdef LUA_TINT
   case LUA_TINT:
	DumpInteger(ivalue(o),D);
	break;
   case LUA_TNUMBER:
	DumpNumber(nvalue_fast(o),D);
	break;
#else
   case LUA_TNUMBER:
	DumpNumber(nvalue(o),D);
	break;
#endif
   case LUA_TSTRING:
	DumpString(rawtsvalue(o),D);
	break;
   default:
	lua_assert(0);			/* cannot happen */
	break;
  }
 }
 n=f->sizep;
 DumpInt(n,D);
 for (i=0; i<n; i++) DumpFunction(f->p[i],f->source,D);
}
Ejemplo n.º 16
0
extern  void    DumpConflicts() {
/*******************************/

    conflict_node       *conf;

    DumpLiteral( "Conflict graph" );
    DumpNL();
    for( conf = ConfList; conf != NULL; conf = conf->next_conflict ) {
        DumpPtr( conf );
        DumpChar( ' ' );
        DumpAConf( conf );
    }
    DumpNL();
}
Ejemplo n.º 17
0
static void DumpConstants(const LuaProto* f, DumpState* D)
{
  int n = (int)f->constants.size();
  DumpInt(n,D);
  for(int i=0; i < n; i++)
  {
    LuaValue v = f->constants[i];
    DumpChar(v.type(),D);

    if(v.isBool()) {
      DumpChar(v.getBool() ? 1 : 0,D);
    } else if(v.isNumber()) {
      DumpNumber(v.getNumber(),D);
    } else if(v.isString()) {
      DumpString(v.getString(),D);
    }
  }
  n = (int)f->subprotos_.size();
  DumpInt(n,D);
  for (int i=0; i < n; i++) {
    DumpFunction(f->subprotos_[i],D);
  }
}
Ejemplo n.º 18
0
static  void    DumpRegs( hw_reg_set *regs ) {
/********************************************/

    int     i;
    bool    first;

    DumpLiteral( "Choices " );
    if( regs != NULL ) {
        first = true;
        for( i = REG_COUNT; i > 0; --i ) {
            if( !HW_CEqual( *regs, HW_EMPTY ) ) {
                if( first ) {
                    first = false;
                } else {
                    DumpChar( ',' );
                }
                DumpRegName( *regs );
            }
            ++regs;
        }
    }
}
Ejemplo n.º 19
0
static void DumpIntWithSize(int x, int sizeof_int, DumpState* D)
{
 /* dump signed integer */
 switch(sizeof_int) {
  case 1: {
   if (x>0x7F || x<(-0x80)) D->status=LUA_ERR_CC_INTOVERFLOW; 
   DumpChar(x,D);
  } break;
  case 2: {
   if (x>0x7FFF || x<(-0x8000)) D->status=LUA_ERR_CC_INTOVERFLOW; 
   int16_t y=(int16_t)x;
   MaybeByteSwap((char*)&y,2,D);
   DumpVar(y,D);
  } break;
  case 4: {
   /* Need to reduce bounds by 1 to avoid messing 32-bit compilers up */
   if (x>0x7FFFFFFE || x<(-0x7FFFFFFF)) D->status=LUA_ERR_CC_INTOVERFLOW; 
   int32_t y=(int32_t)x;
   MaybeByteSwap((char*)&y,4,D);
   DumpVar(y,D);
  } break;
  default: lua_assert(0);
 }
}
Ejemplo n.º 20
0
static void DumpSize(uint32_t x, DumpState* D)
{
 /* dump unsigned integer */
 switch(D->target.sizeof_strsize_t) {
  case 1: {
   if (x>0xFF) D->status=LUA_ERR_CC_INTOVERFLOW; 
   DumpChar(x,D);
  } break;
  case 2: {
   if (x>0xFFFF) D->status=LUA_ERR_CC_INTOVERFLOW;
   uint16_t y=(uint16_t)x;
   MaybeByteSwap((char*)&y,2,D);
   DumpVar(y,D);
  } break;
  case 4: {
   /* Reduce bounds to avoid messing 32-bit compilers up */
   if (x>0xFFFFFFFE) D->status=LUA_ERR_CC_INTOVERFLOW;
   uint32_t y=x;
   MaybeByteSwap((char*)&y,4,D);
   DumpVar(y,D);
  } break;
  default: lua_assert(0);
 }
}
Ejemplo n.º 21
0
extern  void    DumpRegName( hw_reg_set regname ) {
/*************************************************/

    bool        first;
    hw_reg_set  name;

    first = true;
    name = regname;
    if( !HW_COvlap( name, HW_UNUSED ) ) {
        while( !HW_CEqual( name, HW_EMPTY ) ) {
            if( first ) {
                first = false;
            } else {
                DumpChar( ':' );
            }
#if _TARGET & _TARG_370
            if( Check(&name,HW_G0) ) { DumpLiteral( "G0" ); continue; }
            if( Check(&name,HW_G1) ) { DumpLiteral( "G1" ); continue; }
            if( Check(&name,HW_G2) ) { DumpLiteral( "G2" ); continue; }
            if( Check(&name,HW_G3) ) { DumpLiteral( "G3" ); continue; }
            if( Check(&name,HW_G4) ) { DumpLiteral( "G4" ); continue; }
            if( Check(&name,HW_G5) ) { DumpLiteral( "G5" ); continue; }
            if( Check(&name,HW_G6) ) { DumpLiteral( "G6" ); continue; }
            if( Check(&name,HW_G7) ) { DumpLiteral( "G7" ); continue; }
            if( Check(&name,HW_G8) ) { DumpLiteral( "G8" ); continue; }
            if( Check(&name,HW_G9) ) { DumpLiteral( "G9" ); continue; }
            if( Check(&name,HW_G10)) { DumpLiteral( "G10" ); continue; }
            if( Check(&name,HW_G11)) { DumpLiteral( "G11" ); continue; }
            if( Check(&name,HW_G12)) { DumpLiteral( "G12" ); continue; }
            if( Check(&name,HW_G13)) { DumpLiteral( "G13" ); continue; }
            if( Check(&name,HW_G14)) { DumpLiteral( "G14" ); continue; }
            if( Check(&name,HW_G15)) { DumpLiteral( "G15" ); continue; }
            if( Check(&name,HW_E0) ) { DumpLiteral( "E0" ); continue; }
            if( Check(&name,HW_E4) ) { DumpLiteral( "E4" ); continue; }
            if( Check(&name,HW_D0) ) { DumpLiteral( "D0" ); continue; }
            if( Check(&name,HW_D2) ) { DumpLiteral( "D2" ); continue; }
            if( Check(&name,HW_D4) ) { DumpLiteral( "D4" ); continue; }
            if( Check(&name,HW_D6) ) { DumpLiteral( "D6" ); continue; }
            if( Check(&name,HW_Y0) ) { DumpLiteral( "Y0" ); continue; }
            if( Check(&name,HW_Y2) ) { DumpLiteral( "Y2" ); continue; }
            if( Check(&name,HW_Y4) ) { DumpLiteral( "Y4" ); continue; }
            if( Check(&name,HW_Y6) ) { DumpLiteral( "Y6" ); continue; }
#endif
#if _TARGET & (_TARG_PPC | _TARG_AXP | _TARG_MIPS)
            if( Check(&name,HW_R0) ) { DumpLiteral( "R0" ); continue; }
            if( Check(&name,HW_R1) ) { DumpLiteral( "R1" ); continue; }
            if( Check(&name,HW_R2) ) { DumpLiteral( "R2" ); continue; }
            if( Check(&name,HW_R3) ) { DumpLiteral( "R3" ); continue; }
            if( Check(&name,HW_R4) ) { DumpLiteral( "R4" ); continue; }
            if( Check(&name,HW_R5) ) { DumpLiteral( "R5" ); continue; }
            if( Check(&name,HW_R6) ) { DumpLiteral( "R6" ); continue; }
            if( Check(&name,HW_R7) ) { DumpLiteral( "R7" ); continue; }
            if( Check(&name,HW_R8) ) { DumpLiteral( "R8" ); continue; }
            if( Check(&name,HW_R9) ) { DumpLiteral( "R9" ); continue; }
            if( Check(&name,HW_R10) ) { DumpLiteral( "R10" ); continue; }
            if( Check(&name,HW_R11) ) { DumpLiteral( "R11" ); continue; }
            if( Check(&name,HW_R12) ) { DumpLiteral( "R12" ); continue; }
            if( Check(&name,HW_R13) ) { DumpLiteral( "R13" ); continue; }
            if( Check(&name,HW_R14) ) { DumpLiteral( "R14" ); continue; }
            if( Check(&name,HW_R15) ) { DumpLiteral( "R15" ); continue; }
            if( Check(&name,HW_R16) ) { DumpLiteral( "R16" ); continue; }
            if( Check(&name,HW_R17) ) { DumpLiteral( "R17" ); continue; }
            if( Check(&name,HW_R18) ) { DumpLiteral( "R18" ); continue; }
            if( Check(&name,HW_R19) ) { DumpLiteral( "R19" ); continue; }
            if( Check(&name,HW_R20) ) { DumpLiteral( "R20" ); continue; }
            if( Check(&name,HW_R21) ) { DumpLiteral( "R21" ); continue; }
            if( Check(&name,HW_R22) ) { DumpLiteral( "R22" ); continue; }
            if( Check(&name,HW_R23) ) { DumpLiteral( "R23" ); continue; }
            if( Check(&name,HW_R24) ) { DumpLiteral( "R24" ); continue; }
            if( Check(&name,HW_R25) ) { DumpLiteral( "R25" ); continue; }
            if( Check(&name,HW_R26) ) { DumpLiteral( "R26" ); continue; }
            if( Check(&name,HW_R27) ) { DumpLiteral( "R27" ); continue; }
            if( Check(&name,HW_R28) ) { DumpLiteral( "R28" ); continue; }
            if( Check(&name,HW_R29) ) { DumpLiteral( "R29" ); continue; }
            if( Check(&name,HW_R30) ) { DumpLiteral( "R30" ); continue; }
            if( Check(&name,HW_R31) ) { DumpLiteral( "R31" ); continue; }
    
            if( Check(&name,HW_D0) ) { DumpLiteral( "D0" ); continue; }
            if( Check(&name,HW_D1) ) { DumpLiteral( "D1" ); continue; }
            if( Check(&name,HW_D2) ) { DumpLiteral( "D2" ); continue; }
            if( Check(&name,HW_D3) ) { DumpLiteral( "D3" ); continue; }
            if( Check(&name,HW_D4) ) { DumpLiteral( "D4" ); continue; }
            if( Check(&name,HW_D5) ) { DumpLiteral( "D5" ); continue; }
            if( Check(&name,HW_D6) ) { DumpLiteral( "D6" ); continue; }
            if( Check(&name,HW_D7) ) { DumpLiteral( "D7" ); continue; }
            if( Check(&name,HW_D8) ) { DumpLiteral( "D8" ); continue; }
            if( Check(&name,HW_D9) ) { DumpLiteral( "D9" ); continue; }
            if( Check(&name,HW_D10) ) { DumpLiteral( "D10" ); continue; }
            if( Check(&name,HW_D11) ) { DumpLiteral( "D11" ); continue; }
            if( Check(&name,HW_D12) ) { DumpLiteral( "D12" ); continue; }
            if( Check(&name,HW_D13) ) { DumpLiteral( "D13" ); continue; }
            if( Check(&name,HW_D14) ) { DumpLiteral( "D14" ); continue; }
            if( Check(&name,HW_D15) ) { DumpLiteral( "D15" ); continue; }
            if( Check(&name,HW_D16) ) { DumpLiteral( "D16" ); continue; }
            if( Check(&name,HW_D17) ) { DumpLiteral( "D17" ); continue; }
            if( Check(&name,HW_D18) ) { DumpLiteral( "D18" ); continue; }
            if( Check(&name,HW_D19) ) { DumpLiteral( "D19" ); continue; }
            if( Check(&name,HW_D20) ) { DumpLiteral( "D20" ); continue; }
            if( Check(&name,HW_D21) ) { DumpLiteral( "D21" ); continue; }
            if( Check(&name,HW_D22) ) { DumpLiteral( "D22" ); continue; }
            if( Check(&name,HW_D23) ) { DumpLiteral( "D23" ); continue; }
            if( Check(&name,HW_D24) ) { DumpLiteral( "D24" ); continue; }
            if( Check(&name,HW_D25) ) { DumpLiteral( "D25" ); continue; }
            if( Check(&name,HW_D26) ) { DumpLiteral( "D26" ); continue; }
            if( Check(&name,HW_D27) ) { DumpLiteral( "D27" ); continue; }
            if( Check(&name,HW_D28) ) { DumpLiteral( "D28" ); continue; }
            if( Check(&name,HW_D29) ) { DumpLiteral( "D29" ); continue; }
            if( Check(&name,HW_D30) ) { DumpLiteral( "D30" ); continue; }
            if( Check(&name,HW_D31) ) { DumpLiteral( "D31" ); continue; }
    
            if( Check(&name,HW_W0) ) { DumpLiteral( "W0" ); continue; }
            if( Check(&name,HW_W1) ) { DumpLiteral( "W1" ); continue; }
            if( Check(&name,HW_W2) ) { DumpLiteral( "W2" ); continue; }
            if( Check(&name,HW_W3) ) { DumpLiteral( "W3" ); continue; }
            if( Check(&name,HW_W4) ) { DumpLiteral( "W4" ); continue; }
            if( Check(&name,HW_W5) ) { DumpLiteral( "W5" ); continue; }
            if( Check(&name,HW_W6) ) { DumpLiteral( "W6" ); continue; }
            if( Check(&name,HW_W7) ) { DumpLiteral( "W7" ); continue; }
            if( Check(&name,HW_W8) ) { DumpLiteral( "W8" ); continue; }
            if( Check(&name,HW_W9) ) { DumpLiteral( "W9" ); continue; }
            if( Check(&name,HW_W10) ) { DumpLiteral( "W10" ); continue; }
            if( Check(&name,HW_W11) ) { DumpLiteral( "W11" ); continue; }
            if( Check(&name,HW_W12) ) { DumpLiteral( "W12" ); continue; }
            if( Check(&name,HW_W13) ) { DumpLiteral( "W13" ); continue; }
            if( Check(&name,HW_W14) ) { DumpLiteral( "W14" ); continue; }
            if( Check(&name,HW_W15) ) { DumpLiteral( "W15" ); continue; }
            if( Check(&name,HW_W16) ) { DumpLiteral( "W16" ); continue; }
            if( Check(&name,HW_W17) ) { DumpLiteral( "W17" ); continue; }
            if( Check(&name,HW_W18) ) { DumpLiteral( "W18" ); continue; }
            if( Check(&name,HW_W19) ) { DumpLiteral( "W19" ); continue; }
            if( Check(&name,HW_W20) ) { DumpLiteral( "W20" ); continue; }
            if( Check(&name,HW_W21) ) { DumpLiteral( "W21" ); continue; }
            if( Check(&name,HW_W22) ) { DumpLiteral( "W22" ); continue; }
            if( Check(&name,HW_W23) ) { DumpLiteral( "W23" ); continue; }
            if( Check(&name,HW_W24) ) { DumpLiteral( "W24" ); continue; }
            if( Check(&name,HW_W25) ) { DumpLiteral( "W25" ); continue; }
            if( Check(&name,HW_W26) ) { DumpLiteral( "W26" ); continue; }
            if( Check(&name,HW_W27) ) { DumpLiteral( "W27" ); continue; }
            if( Check(&name,HW_W28) ) { DumpLiteral( "W28" ); continue; }
            if( Check(&name,HW_W29) ) { DumpLiteral( "W29" ); continue; }
            if( Check(&name,HW_W30) ) { DumpLiteral( "W30" ); continue; }
            if( Check(&name,HW_W31) ) { DumpLiteral( "W31" ); continue; }
    
            if( Check(&name,HW_B0) ) { DumpLiteral( "B0" ); continue; }
            if( Check(&name,HW_B1) ) { DumpLiteral( "B1" ); continue; }
            if( Check(&name,HW_B2) ) { DumpLiteral( "B2" ); continue; }
            if( Check(&name,HW_B3) ) { DumpLiteral( "B3" ); continue; }
            if( Check(&name,HW_B4) ) { DumpLiteral( "B4" ); continue; }
            if( Check(&name,HW_B5) ) { DumpLiteral( "B5" ); continue; }
            if( Check(&name,HW_B6) ) { DumpLiteral( "B6" ); continue; }
            if( Check(&name,HW_B7) ) { DumpLiteral( "B7" ); continue; }
            if( Check(&name,HW_B8) ) { DumpLiteral( "B8" ); continue; }
            if( Check(&name,HW_B9) ) { DumpLiteral( "B9" ); continue; }
            if( Check(&name,HW_B10) ) { DumpLiteral( "B10" ); continue; }
            if( Check(&name,HW_B11) ) { DumpLiteral( "B11" ); continue; }
            if( Check(&name,HW_B12) ) { DumpLiteral( "B12" ); continue; }
            if( Check(&name,HW_B13) ) { DumpLiteral( "B13" ); continue; }
            if( Check(&name,HW_B14) ) { DumpLiteral( "B14" ); continue; }
            if( Check(&name,HW_B15) ) { DumpLiteral( "B15" ); continue; }
            if( Check(&name,HW_B16) ) { DumpLiteral( "B16" ); continue; }
            if( Check(&name,HW_B17) ) { DumpLiteral( "B17" ); continue; }
            if( Check(&name,HW_B18) ) { DumpLiteral( "B18" ); continue; }
            if( Check(&name,HW_B19) ) { DumpLiteral( "B19" ); continue; }
            if( Check(&name,HW_B20) ) { DumpLiteral( "B20" ); continue; }
            if( Check(&name,HW_B21) ) { DumpLiteral( "B21" ); continue; }
            if( Check(&name,HW_B22) ) { DumpLiteral( "B22" ); continue; }
            if( Check(&name,HW_B23) ) { DumpLiteral( "B23" ); continue; }
            if( Check(&name,HW_B24) ) { DumpLiteral( "B24" ); continue; }
            if( Check(&name,HW_B25) ) { DumpLiteral( "B25" ); continue; }
            if( Check(&name,HW_B26) ) { DumpLiteral( "B26" ); continue; }
            if( Check(&name,HW_B27) ) { DumpLiteral( "B27" ); continue; }
            if( Check(&name,HW_B28) ) { DumpLiteral( "B28" ); continue; }
            if( Check(&name,HW_B29) ) { DumpLiteral( "B29" ); continue; }
            if( Check(&name,HW_B30) ) { DumpLiteral( "B30" ); continue; }
            if( Check(&name,HW_B31) ) { DumpLiteral( "B31" ); continue; }
    
            if( Check(&name,HW_F0) ) { DumpLiteral( "F0" ); continue; }
            if( Check(&name,HW_F1) ) { DumpLiteral( "F1" ); continue; }
            if( Check(&name,HW_F2) ) { DumpLiteral( "F2" ); continue; }
            if( Check(&name,HW_F3) ) { DumpLiteral( "F3" ); continue; }
            if( Check(&name,HW_F4) ) { DumpLiteral( "F4" ); continue; }
            if( Check(&name,HW_F5) ) { DumpLiteral( "F5" ); continue; }
            if( Check(&name,HW_F6) ) { DumpLiteral( "F6" ); continue; }
            if( Check(&name,HW_F7) ) { DumpLiteral( "F7" ); continue; }
            if( Check(&name,HW_F8) ) { DumpLiteral( "F8" ); continue; }
            if( Check(&name,HW_F9) ) { DumpLiteral( "F9" ); continue; }
            if( Check(&name,HW_F10) ) { DumpLiteral( "F10" ); continue; }
            if( Check(&name,HW_F11) ) { DumpLiteral( "F11" ); continue; }
            if( Check(&name,HW_F12) ) { DumpLiteral( "F12" ); continue; }
            if( Check(&name,HW_F13) ) { DumpLiteral( "F13" ); continue; }
            if( Check(&name,HW_F14) ) { DumpLiteral( "F14" ); continue; }
            if( Check(&name,HW_F15) ) { DumpLiteral( "F15" ); continue; }
            if( Check(&name,HW_F16) ) { DumpLiteral( "F16" ); continue; }
            if( Check(&name,HW_F17) ) { DumpLiteral( "F17" ); continue; }
            if( Check(&name,HW_F18) ) { DumpLiteral( "F18" ); continue; }
            if( Check(&name,HW_F19) ) { DumpLiteral( "F19" ); continue; }
            if( Check(&name,HW_F20) ) { DumpLiteral( "F20" ); continue; }
            if( Check(&name,HW_F21) ) { DumpLiteral( "F21" ); continue; }
            if( Check(&name,HW_F22) ) { DumpLiteral( "F22" ); continue; }
            if( Check(&name,HW_F23) ) { DumpLiteral( "F23" ); continue; }
            if( Check(&name,HW_F24) ) { DumpLiteral( "F24" ); continue; }
            if( Check(&name,HW_F25) ) { DumpLiteral( "F25" ); continue; }
            if( Check(&name,HW_F26) ) { DumpLiteral( "F26" ); continue; }
            if( Check(&name,HW_F27) ) { DumpLiteral( "F27" ); continue; }
            if( Check(&name,HW_F28) ) { DumpLiteral( "F28" ); continue; }
            if( Check(&name,HW_F29) ) { DumpLiteral( "F29" ); continue; }
            if( Check(&name,HW_F30) ) { DumpLiteral( "F30" ); continue; }
            if( Check(&name,HW_F31) ) { DumpLiteral( "F31" ); continue; }
#endif
#if 0
#if _TARGET & _TARG_PPC
            if( Check(&name,HW_CTR) ) { DumpLiteral( "CTR" ); continue; }
            if( Check(&name,HW_CR) ) { DumpLiteral( "CR" ); continue; }
            if( Check(&name,HW_MQ) ) { DumpLiteral( "MQ" ); continue; }
            if( Check(&name,HW_LR) ) { DumpLiteral( "LR" ); continue; }
#endif
#endif
#if _TARGET & ( _TARG_80386 | _TARG_IAPX86 )
            if( Check(&name,HW_EAX)) { DumpLiteral("EAX"); continue; }
            if( Check(&name,HW_AX) ) { DumpLiteral( "AX"); continue; }
            if( Check(&name,HW_AL) ) { DumpLiteral( "AL"); continue; }
            if( Check(&name,HW_AH) ) { DumpLiteral( "AH"); continue; }
            if( Check(&name,HW_EBX)) { DumpLiteral("EBX"); continue; }
            if( Check(&name,HW_BX) ) { DumpLiteral( "BX"); continue; }
            if( Check(&name,HW_BL) ) { DumpLiteral( "BL"); continue; }
            if( Check(&name,HW_BH) ) { DumpLiteral( "BH"); continue; }
            if( Check(&name,HW_ECX)) { DumpLiteral("ECX"); continue; }
            if( Check(&name,HW_CX) ) { DumpLiteral( "CX"); continue; }
            if( Check(&name,HW_CL) ) { DumpLiteral( "CL"); continue; }
            if( Check(&name,HW_CH) ) { DumpLiteral( "CH"); continue; }
            if( Check(&name,HW_EDX)) { DumpLiteral("EDX"); continue; }
            if( Check(&name,HW_DX) ) { DumpLiteral( "DX"); continue; }
            if( Check(&name,HW_DL) ) { DumpLiteral( "DL"); continue; }
            if( Check(&name,HW_DH) ) { DumpLiteral( "DH"); continue; }
            if( Check(&name,HW_EDI)) { DumpLiteral("EDI"); continue; }
            if( Check(&name,HW_DI) ) { DumpLiteral( "DI"); continue; }
            if( Check(&name,HW_ESI)) { DumpLiteral("ESI"); continue; }
            if( Check(&name,HW_SI) ) { DumpLiteral( "SI"); continue; }
            if( Check(&name,HW_BP))  { DumpLiteral("EBP"); continue; }
            if( Check(&name,HW_SP))  { DumpLiteral("ESP"); continue; }
            if( Check(&name,HW_GS) ) { DumpLiteral( "GS"); continue; }
            if( Check(&name,HW_FS) ) { DumpLiteral( "FS"); continue; }
            if( Check(&name,HW_ES) ) { DumpLiteral( "ES"); continue; }
            if( Check(&name,HW_DS) ) { DumpLiteral( "DS"); continue; }
            if( Check(&name,HW_CS) ) { DumpLiteral( "CS"); continue; }
            if( Check(&name,HW_SS) ) { DumpLiteral( "SS"); continue; }
            if( Check(&name,HW_ST0) ) { DumpLiteral( "ST(0)"); continue; }
            if( Check(&name,HW_ST1) ) { DumpLiteral( "ST(1)"); continue; }
            if( Check(&name,HW_ST2) ) { DumpLiteral( "ST(2)"); continue; }
            if( Check(&name,HW_ST3) ) { DumpLiteral( "ST(3)"); continue; }
            if( Check(&name,HW_ST4) ) { DumpLiteral( "ST(4)"); continue; }
            if( Check(&name,HW_ST5) ) { DumpLiteral( "ST(5)"); continue; }
            if( Check(&name,HW_ST6) ) { DumpLiteral( "ST(6)"); continue; }
            if( Check(&name,HW_ST7) ) { DumpLiteral( "ST(7)"); continue; }
#endif
            break;
        }
    }
}
Ejemplo n.º 22
0
extern  void    DumpAConf( conflict_node *conf ) {
/************************************************/

    DumpOperand( conf->name );
    DumpLiteral( " id " );
    DumpGBit( &conf->id.out_of_block );
    DumpChar( ' ' );
    DumpLBit( &conf->id.within_block );
    DumpPossible( conf->possible );
    DumpNL();
    DumpLiteral( "    " );
    DumpInsRange( conf );
    DumpLiteral( " Start block " );
    DumpPtr( conf->start_block );
    DumpNL();
    DumpLiteral( "    Conflicts with " );
    DumpGBit( &conf->with.out_of_block );
    DumpChar( ' ' );
    DumpLBit( &conf->with.within_block );
    DumpChar( ' ' );
    DumpRegName( conf->with.regs );
    DumpNL();
    DumpLiteral( "    Constrained " );
    DumpInt( conf->num_constrained );
    DumpLiteral( " vs " );
    DumpInt( conf->available );
    DumpNL();
    if( _Is( conf, CST_SAVINGS_CALCULATED ) ) {
        DumpLiteral( "    Savings " );
        DumpLong( conf->savings );
        DumpNL();
    }
    if( _Is( conf, CST_CONFLICT_ON_HOLD ) ) {
        DumpLiteral( "    On hold" );
        DumpNL();
    }
    if( _Is( conf, CST_CHANGES_OTHERS ) ) {
        DumpLiteral( "    Changes Others" );
        DumpNL();
    }
    if( _Is( conf, CST_NEEDS_SEGMENT ) ) {
        DumpLiteral( "    Needs segment" );
        DumpNL();
    }
    if( _Is( conf, CST_NEEDS_SEGMENT_SPLIT ) ) {
        DumpLiteral( "    Needs segment split" );
        DumpNL();
    }
    if( _Is( conf, CST_SEGMENT_SPLIT ) ) {
        DumpLiteral( "    Is segment split" );
        DumpNL();
    }
    if( _Is( conf, CST_NEEDS_INDEX ) ) {
        DumpLiteral( "    Needs index" );
        DumpNL();
    }
    if( _Is( conf, CST_NEEDS_INDEX_SPLIT ) ) {
        DumpLiteral( "    Needs index split" );
        DumpNL();
    }
    if( _Is( conf, CST_INDEX_SPLIT ) ) {
        DumpLiteral( "    Is index split" );
        DumpNL();
    }
}
Ejemplo n.º 23
0
extern  void    DumpIV( induction *var ) {
/****************************************/

    induction   *alias;
    invariant   *invar;

    DumpPtr( var );
    DumpLiteral( "  " );
    DumpOperand( var->name );
    DumpLiteral( " = ( " );
    if( _IsV( var, IV_BASIC ) ) {
        DumpLiteral( "**basic**" );
    } else {
        if( var->ivtimes != NULL ) {
            DumpOperand( var->ivtimes );
            DumpLiteral( " * " );
        }
        if( var->times != 1 ) {
            DumpLong( var->times );
            DumpLiteral( " * " );
        }
        DumpOperand( var->basic->name );
    }
    DumpLiteral( " )" );
    if( var->plus != 0 ) {
        DumpLiteral( " + ( " );
        DumpLong( var->plus );
        DumpLiteral( " )" );
    }
    if( var->ivtimes != NULL && var->plus2 != 0 ) {
        DumpLiteral( " + ( " );
        DumpOperand( var->ivtimes );
        DumpLiteral( " * " );
        DumpLong( var->plus2 );
        DumpLiteral( " )" );
    }
    for( invar = var->invar; invar != NULL; invar = invar->next ) {
        DumpLiteral( " + ( " );
        if( var->lasttimes >= invar->id ) {
            DumpOperand( var->ivtimes );
            DumpLiteral( " * " );
        }
        if( invar->times != 1 ) {
            DumpLong( invar->times );
            DumpLiteral( " * " );
        }
        DumpOperand( invar->name );
        DumpLiteral( " )" );
    }
    DumpNL();
    DumpLiteral( "        ins=" );
    DumpPtr( var->ins );
    DumpLiteral( " prev=" );
    DumpPtr( var->prev );
    DumpLiteral( " basic=" );
    DumpOperand( var->basic->name );
    if( _IsV( var, IV_ALIAS ) ) {
        DumpLiteral( " alias=" );
        for( alias = var->alias; _IsV( alias, IV_ALIAS ); ) {
            alias = alias->alias;
        }
        DumpPtr( alias );
    }
    DumpNL();
    DumpLiteral( "        Uses: " );
    DumpInt( var->use_count );
    DumpChar( ' ' );
    if( _IsV( var, IV_BASIC ) ) {
        DumpLiteral( " Basic" );
    }
    if( _IsV( var, IV_DEAD ) ) {
        DumpLiteral( " Dead" );
    }
    if( _IsV( var, IV_SURVIVED ) ) {
        DumpLiteral( " Survived" );
    }
    if( _IsV( var, IV_TOP ) ) {
        DumpLiteral( " Top" );
    }
    if( _IsV( var, IV_INTRODUCED ) ) {
        DumpLiteral( " Introduced" );
    }
    if( _IsV( var, IV_ALIAS ) ) {
        DumpLiteral( " Alias" );
    }
    if( _IsV( var, IV_INDEXED ) ) {
        DumpLiteral( " Indexed" );
    }
    if( _IsV( var, IV_USED ) ) {
        DumpLiteral( " Used" );
    }
    DumpNL();
}
Ejemplo n.º 24
0
static void Align4(DumpState *D)
{
 while(D->wrote&3)
  DumpChar(0,D);
}
Ejemplo n.º 25
0
extern  void    DumpOperand( name *operand ) {
/********************************************/

    char        buffer[20];
    hw_reg_set  reg;
    name        *base;

    if( operand->n.class == N_INDEXED ) {
        if( operand->i.base != NULL ) {
            if( !( operand->i.index_flags & X_FAKE_BASE ) ) {
                if( operand->i.index_flags & X_LOW_ADDR_BASE ) {
                    DumpLiteral( "l^" );
                }
                DumpOperand( operand->i.base );
                if( operand->i.constant > 0 ) {
                    DumpChar( '+' );
                }
            }
        }
        if( operand->i.constant != 0 ) {
            DumpLong( operand->i.constant );
        }
        DumpChar( '[' );
        if( operand->i.index_flags & X_BASE ) {
            reg = operand->i.index->r.reg;
#if _TARGET & ( _TARG_IAPX86 | _TARG_80386 )
            if( HW_COvlap( reg, HW_SEGS ) ) {

                hw_reg_set tmp;

                tmp = reg;
                HW_COnlyOn( tmp, HW_SEGS );
                DumpRegName( tmp );
                DumpChar( ':' );
                HW_CTurnOff( reg, HW_SEGS );
            }
#endif
            if( operand->i.index_flags & X_HIGH_BASE ) {
                DumpRegName( HighReg( reg ) );
                DumpChar( '+' );
                DumpRegName( LowReg( reg ) );
            } else {
                DumpRegName( LowReg( reg ) );
                DumpChar( '+' );
                DumpRegName( HighReg( reg ) );
            }
        } else {
            DumpOperand( operand->i.index );
        }
        if( operand->i.scale != 0 ) {
            DumpChar( '*' );
            DumpInt( 1 << operand->i.scale );
        }
        if( operand->i.index_flags & ( X_ALIGNED_1 | X_ALIGNED_2 | X_ALIGNED_4 | X_ALIGNED_8 ) ) {
            DumpChar( '$' );
            DumpInt( FlagsToAlignment( operand->i.index_flags ) );
        }
        DumpChar( ']' );
        base = operand->i.base;
        if( base != NULL ) {
            if( operand->i.index_flags & X_FAKE_BASE ) {
                DumpChar( '{' );
                if( base->n.class == N_MEMORY ) {
                    DumpXString( AskName(base->v.symbol, base->m.memory_type) );
                } else if( base->n.class == N_TEMP ) {
                    if( _FrontEndTmp( base ) ) {
                        DumpXString( FEName( base->v.symbol ) );
                    } else {
                        DumpOperand( base );
                    }
                }
                DumpChar( '}' );
            }
        }