Changeset 232 in dev for trunk/abdev/BasicCompiler64/CodeGenerator.cpp
- Timestamp:
- Jul 25, 2007, 4:04:11 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/CodeGenerator.cpp
r228 r232 160 160 /////////////////// 161 161 162 void CodeGenerator::op_mov_RV(int op_size,int reg,long i32data ){162 void CodeGenerator::op_mov_RV(int op_size,int reg,long i32data, Schedule::Type scheduleType ){ 163 163 //mov reg,i32data 164 164 … … 179 179 180 180 //即値 181 pNativeCode->Put( i32data );181 pNativeCode->Put( i32data, scheduleType ); 182 182 } 183 183 void CodeGenerator::op_mov_RV64(int reg,_int64 i64data){ … … 258 258 } 259 259 } 260 void CodeGenerator::op_mov_MR(int op_size,int reg,int base_reg,long offset,char mod ){260 void CodeGenerator::op_mov_MR(int op_size,int reg,int base_reg,long offset,char mod, Schedule::Type scheduleType ){ 261 261 //mov qword ptr[base_reg+offset],reg64 262 262 //mov dword ptr[base_reg+offset],reg32 … … 273 273 else opcode=(char)0x89; 274 274 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 } 277 void CodeGenerator::op_mov_MR_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset, Schedule::Type scheduleType ){ 278 278 //mov qword ptr[base_reg1+base_reg2+offset],reg64 279 279 //mov dword ptr[base_reg1+base_reg2+offset],reg32 … … 309 309 310 310 //オフセット値 311 pNativeCode->Put( offset );311 pNativeCode->Put( offset, scheduleType ); 312 312 } 313 313 else{ … … 389 389 } 390 390 391 392 393 ///////////////////394 // mov64関連395 ///////////////////396 397 void CodeGenerator::op_mov64_ToReg(int reg,_int64 i64data){398 //mov reg,i64data399 400 if(REG_RAX<=reg&®<=REG_RDI){401 /* rax~rdi402 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_R15){408 /* r8~r15409 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,i32data417 418 if(REG_RAX<=reg&®<=REG_RDI){419 /* rax~rdi420 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_R15){427 /* r8~r15428 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 }435 391 void CodeGenerator::op_movsxd(int reg64,int reg32){ 436 392 //movsxd reg64,reg32 … … 641 597 } 642 598 643 void CodeGenerator::op_add_RV(int reg,long offset ){599 void CodeGenerator::op_add_RV(int reg,long offset, Schedule::Type scheduleType ){ 644 600 //add reg,offset 645 601 char RexByte=-1; … … 656 612 pNativeCode->Put( (char)RexByte ); 657 613 pNativeCode->Put( (char)0x05 ); 658 pNativeCode->Put( offset );614 pNativeCode->Put( offset, scheduleType ); 659 615 } 660 616 else{ … … 665 621 pNativeCode->Put( (char)0x81 ); 666 622 pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)) ); 667 pNativeCode->Put( offset );623 pNativeCode->Put( offset, scheduleType ); 668 624 } 669 625 } … … 1365 1321 //////////////////// 1366 1322 1367 void CodeGenerator::op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod ){1323 void CodeGenerator::op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1368 1324 //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 } 1327 void CodeGenerator::op_movlpd_RM(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1372 1328 //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 ); 1374 1330 } 1375 1331 void CodeGenerator::op_movsd_RR(int xmm_reg1,int xmm_reg2){ … … 1379 1335 __op_format(0,(char)0xF2,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG); 1380 1336 } 1381 void CodeGenerator::op_movsd_MR(int xmm_reg,int base_reg,int offset,char mod ){1337 void CodeGenerator::op_movsd_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1382 1338 //movsd qword ptr[reg+offset],xmm_reg 1383 1339 //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 ); 1385 1341 } 1386 1342 void CodeGenerator::op_movss_RR(int xmm_reg1,int xmm_reg2){ … … 1390 1346 __op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG); 1391 1347 } 1392 void CodeGenerator::op_movss_RM(int xmm_reg,int base_reg,int offset,char mod ){1348 void CodeGenerator::op_movss_RM(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1393 1349 //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 } 1352 void CodeGenerator::op_movss_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1397 1353 //movss dword ptr[reg+offset],xmm_reg 1398 1354 //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 ); 1400 1356 } 1401 1357
Note:
See TracChangeset
for help on using the changeset viewer.