Ignore:
Timestamp:
Jul 25, 2007, 11:21:25 AM (17 years ago)
Author:
dai_9181
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler32/CodeGenerator.cpp

    r230 r234  
    9999///////////////////
    100100
     101void CodeGenerator::op_mov_MV( int op_size, int base_reg, long offset, Schedule::Type offsetScheduleType, long value, Schedule::Type valueScheduleType )
     102{
     103    //mov ptr[base_reg+offset],value
     104
     105    if( op_size == sizeof(char) )
     106    {
     107        pNativeCode->Put( (char)0xC6 );
     108        pNativeCode->Put( (char)(0x80|REGISTER_OPERAND(base_reg)) );
     109        pNativeCode->Put( offset, offsetScheduleType );
     110        pNativeCode->Put( (char)value );
     111    }
     112    else if( op_size == sizeof(short) )
     113    {
     114        pNativeCode->Put( (char)0x66 );
     115        pNativeCode->Put( (char)0xC7 );
     116        pNativeCode->Put( (char)(0x80|REGISTER_OPERAND(base_reg)) );
     117        pNativeCode->Put( offset, offsetScheduleType );
     118        pNativeCode->Put( (short)value );
     119    }
     120    else if( op_size == sizeof(long) )
     121    {
     122        pNativeCode->Put( (char)0xC7 );
     123        pNativeCode->Put( (char)(0x80|REGISTER_OPERAND(base_reg)) );
     124        pNativeCode->Put( offset, offsetScheduleType );
     125        pNativeCode->Put( value, valueScheduleType );
     126    }
     127}
    101128void CodeGenerator::op_mov_RV(int reg,long offset, Schedule::Type scheduleType ){
    102129    //mov reg,value
     
    359386{
    360387    // add reg,offset
    361     pNativeCode->Put( (char)0x81 );
    362     pNativeCode->Put( (char)(0xC0|REGISTER_OPERAND(reg)) );
    363     pNativeCode->Put( offset, scheduleType );
     388
     389    if( reg == REG_EAX )
     390    {
     391        // eaxのみ特殊
     392        pNativeCode->Put( (char)0x05 );
     393        pNativeCode->Put( offset, scheduleType );
     394    }
     395    else
     396    {
     397        pNativeCode->Put( (char)0x81 );
     398        pNativeCode->Put( (char)(0xC0|REGISTER_OPERAND(reg)) );
     399        pNativeCode->Put( offset, scheduleType );
     400    }
    364401}
    365402void CodeGenerator::op_add_RR( int reg1, int reg2 )
Note: See TracChangeset for help on using the changeset viewer.