Changeset 236 in dev
- Timestamp:
- Jul 25, 2007, 12:17:24 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/CodeGenerator.cpp
r235 r236 783 783 ///////////////////// 784 784 void CodeGenerator::op_cmp_RR( int reg1, int reg2 ){ 785 //オペコード 786 pNativeCode->Put( (char)0x3B ); 787 788 //レジスタ 789 pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) ); 785 //cmp reg1,reg2 786 __op_format( (char)0, (char)0x3B, 0, reg1, reg2, 0, MOD_REG ); 790 787 } 791 788 void CodeGenerator::op_cmp_value(int op_size,int reg,char byte_data){ -
trunk/abdev/BasicCompiler32/Compile_Set_Var.cpp
r230 r236 157 157 else if(type==DEF_INT64||type==DEF_QWORD){ 158 158 //cmp eax,0 159 compiler.codeGenerator.op_cmp_value( GetTypeSize(type,-1),REG_EAX,0);159 compiler.codeGenerator.op_cmp_value(sizeof(long),REG_EAX,0); 160 160 161 161 //setne al … … 163 163 164 164 //cmp edx,0 165 compiler.codeGenerator.op_cmp_value( GetTypeSize(type,-1),REG_EDX,0);165 compiler.codeGenerator.op_cmp_value(sizeof(long),REG_EDX,0); 166 166 167 167 //setne cl -
trunk/abdev/BasicCompiler32/Compile_Statement.cpp
r227 r236 105 105 if( resultType.IsReal() ){ 106 106 //fstp st(0) 107 OpBuffer[obp++]=(char)0xDD; 108 OpBuffer[obp++]=(char)0xD8; 107 compiler.codeGenerator.PutOld( 108 (char)0xDD, 109 (char)0xD8 110 ); 109 111 } 110 112 else if( resultType.IsStruct() ){ … … 212 214 213 215 //cmp eax,0 214 OpBuffer[obp++]=(char)0x83; 215 OpBuffer[obp++]=(char)0xF8; 216 OpBuffer[obp++]=(char)0x00; 216 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EAX, 0 ); 217 217 218 218 //jne … … 224 224 225 225 //cmp ebx,0 226 OpBuffer[obp++]=(char)0x83; 227 OpBuffer[obp++]=(char)0xFB; 228 OpBuffer[obp++]=(char)0x00; 226 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EBX, 0 ); 229 227 230 228 //jne … … 253 251 254 252 //cmp eax,0 255 OpBuffer[obp++]=(char)0x83; 256 OpBuffer[obp++]=(char)0xF8; 257 OpBuffer[obp++]=(char)0x00; 253 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EAX, 0 ); 258 254 259 255 //je (endif、または else まで条件ジャンプ) … … 461 457 462 458 //cmp eax,0 463 OpBuffer[obp++]=(char)0x83; 464 OpBuffer[obp++]=(char)0xF8; 465 OpBuffer[obp++]=(char)0x00; 459 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EAX, 0 ); 466 460 467 461 //jne … … 473 467 474 468 //cmp ebx,0 475 OpBuffer[obp++]=(char)0x83; 476 OpBuffer[obp++]=(char)0xFB; 477 OpBuffer[obp++]=(char)0x00; 469 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EBX, 0 ); 478 470 479 471 //jne … … 501 493 502 494 //cmp eax,0 503 OpBuffer[obp++]=(char)0x83; 504 OpBuffer[obp++]=(char)0xF8; 505 OpBuffer[obp++]=(char)0x00; 495 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EAX, 0 ); 506 496 507 497 //je (Wend まで) … … 603 593 604 594 //cmp eax,0 605 OpBuffer[obp++]=(char)0x83; 606 OpBuffer[obp++]=(char)0xF8; 607 OpBuffer[obp++]=(char)0x00; 595 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EAX, 0 ); 608 596 609 597 //je [カウンタ減少の場合の判定] … … 637 625 638 626 //cmp eax,0 639 OpBuffer[obp++]=(char)0x83; 640 OpBuffer[obp++]=(char)0xF8; 641 OpBuffer[obp++]=(char)0x00; 627 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EAX, 0 ); 642 628 643 629 ErrorStep: … … 803 789 804 790 //cmp eax,0 805 OpBuffer[obp++]=(char)0x83; 806 OpBuffer[obp++]=(char)0xF8; 807 OpBuffer[obp++]=(char)0x00; 791 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EAX, 0 ); 808 792 809 793 //jne … … 815 799 816 800 //cmp ebx,0 817 OpBuffer[obp++]=(char)0x83; 818 OpBuffer[obp++]=(char)0xFB; 819 OpBuffer[obp++]=(char)0x00; 801 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EBX, 0 ); 820 802 821 803 //jne … … 856 838 857 839 //cmp eax,0 858 OpBuffer[obp++]=(char)0x83; 859 OpBuffer[obp++]=(char)0xF8; 860 OpBuffer[obp++]=(char)0x00; 840 compiler.codeGenerator.op_cmp_value( sizeof(long), REG_EAX, 0 ); 861 841 862 842 if(basbuf[i3]=='0'){ … … 1161 1141 1162 1142 //mov eax,dword ptr[esp] 1163 OpBuffer[obp++]=(char)0x8B; 1164 OpBuffer[obp++]=(char)0x04; 1165 OpBuffer[obp++]=(char)0x24; 1143 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_ESP, 0, MOD_BASE ); 1166 1144 1167 1145 //cmp eax,ebx … … 1368 1346 1369 1347 //fstp qword ptr[eax] 1370 OpBuffer[obp++]=(char)0xDD; 1371 OpBuffer[obp++]=(char)0x18; 1348 compiler.codeGenerator.PutOld( 1349 (char)0xDD, 1350 (char)0x18 1351 ); 1372 1352 } 1373 1353 else if(type==DEF_SINGLE){ … … 1423 1403 1424 1404 //mov word ptr[eax],bx 1425 OpBuffer[obp++]=(char)0x66; 1426 OpBuffer[obp++]=(char)0x89; 1427 OpBuffer[obp++]=(char)0x18; 1405 compiler.codeGenerator.op_mov_MR( sizeof(short), REG_EBX, REG_EAX, 0, MOD_BASE ); 1428 1406 } 1429 1407 else if(type==DEF_BYTE){ … … 1437 1415 1438 1416 //mov byte ptr[eax],bl 1439 OpBuffer[obp++]=(char)0x88; 1440 OpBuffer[obp++]=(char)0x18; 1417 compiler.codeGenerator.op_mov_MR( sizeof(char), REG_EBX, REG_EAX, 0, MOD_BASE ); 1441 1418 } 1442 1419 } -
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r234 r236 137 137 138 138 //imul eax,i4 139 OpBuffer[obp++]=(char)0x69; 140 OpBuffer[obp++]=(char)0xC0; 141 *((long *)(OpBuffer+obp))=i4; 142 obp+=sizeof(long); 139 compiler.codeGenerator.op_imul_RV( REG_EAX, i4 ); 143 140 144 141 //add dword ptr[esp],eax … … 154 151 155 152 //imul eax,TypeSize 156 OpBuffer[obp++]=(char)0x69; 157 OpBuffer[obp++]=(char)0xC0; 158 *((long *)(OpBuffer+obp)) = type.GetSize(); 159 obp+=sizeof(long); 153 compiler.codeGenerator.op_imul_RV( REG_EAX, type.GetSize() ); 160 154 161 155 //pop ecx
Note:
See TracChangeset
for help on using the changeset viewer.