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

Legend:

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

    r228 r232  
    160160///////////////////
    161161
    162 void CodeGenerator::op_mov_RV(int op_size,int reg,long i32data){
     162void CodeGenerator::op_mov_RV(int op_size,int reg,long i32data, Schedule::Type scheduleType ){
    163163    //mov reg,i32data
    164164
     
    179179
    180180    //即値
    181     pNativeCode->Put( i32data );
     181    pNativeCode->Put( i32data, scheduleType );
    182182}
    183183void CodeGenerator::op_mov_RV64(int reg,_int64 i64data){
     
    258258    }
    259259}
    260 void CodeGenerator::op_mov_MR(int op_size,int reg,int base_reg,long offset,char mod){
     260void CodeGenerator::op_mov_MR(int op_size,int reg,int base_reg,long offset,char mod, Schedule::Type scheduleType ){
    261261    //mov qword ptr[base_reg+offset],reg64
    262262    //mov dword ptr[base_reg+offset],reg32
     
    273273    else opcode=(char)0x89;
    274274
    275     __op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod);
    276 }
    277 void CodeGenerator::op_mov_MR_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset){
     275    __op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod, scheduleType );
     276}
     277void CodeGenerator::op_mov_MR_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset, Schedule::Type scheduleType ){
    278278    //mov qword ptr[base_reg1+base_reg2+offset],reg64
    279279    //mov dword ptr[base_reg1+base_reg2+offset],reg32
     
    309309
    310310        //オフセット値
    311         pNativeCode->Put( offset );
     311        pNativeCode->Put( offset, scheduleType );
    312312    }
    313313    else{
     
    389389}
    390390
    391 
    392 
    393 ///////////////////
    394 // mov64関連
    395 ///////////////////
    396 
    397 void CodeGenerator::op_mov64_ToReg(int reg,_int64 i64data){
    398     //mov reg,i64data
    399 
    400     if(REG_RAX<=reg&&reg<=REG_RDI){
    401         /*  rax~rdi
    402             0100 1000 1011 1xxx [64bit data]    */
    403         pNativeCode->Put( (char)0x48 );
    404         pNativeCode->Put( (char)(0xB8| REGISTER_OPERAND(reg) ) );
    405         pNativeCode->Put( i64data );
    406     }
    407     if(REG_R8<=reg&&reg<=REG_R15){
    408         /*  r8~r15
    409             0100 1001 1011 1xxx [64bit data]    */
    410         pNativeCode->Put( (char)0x49 );
    411         pNativeCode->Put( (char)(0xB8| REGISTER_OPERAND(reg) ) );
    412         pNativeCode->Put( i64data );
    413     }
    414 }
    415 void CodeGenerator::op_mov64_ToReg(int reg,long i32data){
    416     //mov reg,i32data
    417 
    418     if(REG_RAX<=reg&&reg<=REG_RDI){
    419         /*  rax~rdi
    420             0100 1000 1100 0111 1100 0xxx [32bit data]  */
    421         pNativeCode->Put( (char)0x48 );
    422         pNativeCode->Put( (char)0xC7 );
    423         pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg) ) );
    424         pNativeCode->Put( i32data );
    425     }
    426     if(REG_R8<=reg&&reg<=REG_R15){
    427         /*  r8~r15
    428             0100 1001 1100 0111 1100 0xxx [32bit data]  */
    429         pNativeCode->Put( (char)0x49 );
    430         pNativeCode->Put( (char)0xC7 );
    431         pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg) ) );
    432         pNativeCode->Put( i32data );
    433     }
    434 }
    435391void CodeGenerator::op_movsxd(int reg64,int reg32){
    436392    //movsxd reg64,reg32
     
    641597}
    642598
    643 void CodeGenerator::op_add_RV(int reg,long offset){
     599void CodeGenerator::op_add_RV(int reg,long offset, Schedule::Type scheduleType ){
    644600    //add reg,offset
    645601    char RexByte=-1;
     
    656612        pNativeCode->Put( (char)RexByte );
    657613        pNativeCode->Put( (char)0x05 );
    658         pNativeCode->Put( offset );
     614        pNativeCode->Put( offset, scheduleType );
    659615    }
    660616    else{
     
    665621        pNativeCode->Put( (char)0x81 );
    666622        pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)) );
    667         pNativeCode->Put( offset );
     623        pNativeCode->Put( offset, scheduleType );
    668624    }
    669625}
     
    13651321////////////////////
    13661322
    1367 void CodeGenerator::op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod){
     1323void CodeGenerator::op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
    13681324    //movlpd qword ptr[base_reg+offset],xmm_reg
    1369     __op_format(0,(char)0x66,(char)0x0F,(char)0x13,xmm_reg,base_reg,offset,mod);
    1370 }
    1371 void CodeGenerator::op_movlpd_RM(int xmm_reg,int base_reg,int offset,char mod){
     1325    __op_format(0,(char)0x66,(char)0x0F,(char)0x13,xmm_reg,base_reg,offset,mod, scheduleType );
     1326}
     1327void CodeGenerator::op_movlpd_RM(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
    13721328    //movlpd xmm_reg,qword ptr[base_reg+offset]
    1373     __op_format(0,(char)0x66,(char)0x0F,(char)0x12,xmm_reg,base_reg,offset,mod);
     1329    __op_format(0,(char)0x66,(char)0x0F,(char)0x12,xmm_reg,base_reg,offset,mod, scheduleType );
    13741330}
    13751331void CodeGenerator::op_movsd_RR(int xmm_reg1,int xmm_reg2){
     
    13791335    __op_format(0,(char)0xF2,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG);
    13801336}
    1381 void CodeGenerator::op_movsd_MR(int xmm_reg,int base_reg,int offset,char mod){
     1337void CodeGenerator::op_movsd_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
    13821338    //movsd qword ptr[reg+offset],xmm_reg
    13831339    //movsd qword ptr[reg],xmm_reg
    1384     __op_format(0,(char)0xF2,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod);
     1340    __op_format(0,(char)0xF2,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod, scheduleType );
    13851341}
    13861342void CodeGenerator::op_movss_RR(int xmm_reg1,int xmm_reg2){
     
    13901346    __op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG);
    13911347}
    1392 void CodeGenerator::op_movss_RM(int xmm_reg,int base_reg,int offset,char mod){
     1348void CodeGenerator::op_movss_RM(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
    13931349    //movss xmm_reg,dword ptr[base_reg+offset]
    1394     __op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg,base_reg,offset,mod);
    1395 }
    1396 void CodeGenerator::op_movss_MR(int xmm_reg,int base_reg,int offset,char mod){
     1350    __op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg,base_reg,offset,mod, scheduleType );
     1351}
     1352void CodeGenerator::op_movss_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
    13971353    //movss dword ptr[reg+offset],xmm_reg
    13981354    //movss dword ptr[reg],xmm_reg
    1399     __op_format(0,(char)0xF3,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod);
     1355    __op_format(0,(char)0xF3,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod, scheduleType );
    14001356}
    14011357
Note: See TracChangeset for help on using the changeset viewer.