Changeset 237 in dev for trunk/abdev/BasicCompiler32
- Timestamp:
- Jul 26, 2007, 3:58:18 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/BasicCompiler.vcproj
r232 r237 843 843 </Filter> 844 844 <Filter 845 Name=" Compile"845 Name="x86Compiler" 846 846 > 847 847 <File … … 1117 1117 > 1118 1118 <File 1119 RelativePath=".\CodeGenerator.cpp"1120 >1121 <FileConfiguration1122 Name="Debug|Win32"1123 >1124 <Tool1125 Name="VCCLCompilerTool"1126 ObjectFile="$(IntDir)\$(InputName)1.obj"1127 XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"1128 />1129 </FileConfiguration>1130 <FileConfiguration1131 Name="Release|Win32"1132 >1133 <Tool1134 Name="VCCLCompilerTool"1135 ObjectFile="$(IntDir)\$(InputName)1.obj"1136 XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"1137 />1138 </FileConfiguration>1139 </File>1140 <File1141 1119 RelativePath="op32_main.cpp" 1142 1120 > … … 1157 1135 /> 1158 1136 </FileConfiguration> 1137 </File> 1138 <File 1139 RelativePath=".\x86CodeGenerator.cpp" 1140 > 1159 1141 </File> 1160 1142 </Filter> … … 1265 1247 </Filter> 1266 1248 <Filter 1267 Name="Langauge Classes"1268 >1269 <File1270 RelativePath="..\BasicCompiler_Common\src\Class.cpp"1271 >1272 </File>1273 <File1274 RelativePath="..\BasicCompiler_Common\src\CodeGenerator.cpp"1275 >1276 </File>1277 <File1278 RelativePath="..\BasicCompiler_Common\src\Compiler.cpp"1279 >1280 </File>1281 <File1282 RelativePath="..\BasicCompiler_Common\src\Const.cpp"1283 >1284 </File>1285 <File1286 RelativePath="..\BasicCompiler_Common\src\DataTable.cpp"1287 >1288 </File>1289 <File1290 RelativePath="..\BasicCompiler_Common\src\Exception.cpp"1291 >1292 </File>1293 <File1294 RelativePath="..\BasicCompiler_Common\src\LexicalScopingImpl.cpp"1295 >1296 </File>1297 <File1298 RelativePath="..\BasicCompiler_Common\src\Method.cpp"1299 >1300 </File>1301 <File1302 RelativePath="..\BasicCompiler_Common\src\Namespace.cpp"1303 >1304 </File>1305 <File1306 RelativePath="..\BasicCompiler_Common\src\NamespaceSupporter.cpp"1307 >1308 </File>1309 <File1310 RelativePath="..\BasicCompiler_Common\src\NativeCode.cpp"1311 >1312 </File>1313 <File1314 RelativePath="..\BasicCompiler_Common\src\Procedure.cpp"1315 >1316 </File>1317 <File1318 RelativePath="..\BasicCompiler_Common\src\Program.cpp"1319 >1320 </File>1321 <File1322 RelativePath="..\BasicCompiler_Common\src\SmoothieImpl.cpp"1323 >1324 </File>1325 <File1326 RelativePath="..\BasicCompiler_Common\src\Symbol.cpp"1327 >1328 </File>1329 <File1330 RelativePath="..\BasicCompiler_Common\src\Type.cpp"1331 >1332 </File>1333 <File1334 RelativePath="..\BasicCompiler_Common\src\TypeDef.cpp"1335 >1336 </File>1337 <File1338 RelativePath="..\BasicCompiler_Common\src\Variable.cpp"1339 >1340 </File>1341 </Filter>1342 <Filter1343 1249 Name="Common Classes" 1344 1250 > … … 1347 1253 > 1348 1254 </File> 1255 <Filter 1256 Name="Langauge Classes" 1257 > 1258 <File 1259 RelativePath="..\BasicCompiler_Common\src\Class.cpp" 1260 > 1261 </File> 1262 <File 1263 RelativePath="..\BasicCompiler_Common\src\CodeGenerator.cpp" 1264 > 1265 </File> 1266 <File 1267 RelativePath="..\BasicCompiler_Common\src\Compiler.cpp" 1268 > 1269 </File> 1270 <File 1271 RelativePath="..\BasicCompiler_Common\src\Const.cpp" 1272 > 1273 </File> 1274 <File 1275 RelativePath="..\BasicCompiler_Common\src\DataTable.cpp" 1276 > 1277 </File> 1278 <File 1279 RelativePath="..\BasicCompiler_Common\src\Exception.cpp" 1280 > 1281 </File> 1282 <File 1283 RelativePath="..\BasicCompiler_Common\src\LexicalScopingImpl.cpp" 1284 > 1285 </File> 1286 <File 1287 RelativePath="..\BasicCompiler_Common\src\Method.cpp" 1288 > 1289 </File> 1290 <File 1291 RelativePath="..\BasicCompiler_Common\src\Namespace.cpp" 1292 > 1293 </File> 1294 <File 1295 RelativePath="..\BasicCompiler_Common\src\NamespaceSupporter.cpp" 1296 > 1297 </File> 1298 <File 1299 RelativePath="..\BasicCompiler_Common\src\NativeCode.cpp" 1300 > 1301 </File> 1302 <File 1303 RelativePath="..\BasicCompiler_Common\src\Procedure.cpp" 1304 > 1305 </File> 1306 <File 1307 RelativePath="..\BasicCompiler_Common\src\Program.cpp" 1308 > 1309 </File> 1310 <File 1311 RelativePath="..\BasicCompiler_Common\src\SmoothieImpl.cpp" 1312 > 1313 </File> 1314 <File 1315 RelativePath="..\BasicCompiler_Common\src\Symbol.cpp" 1316 > 1317 </File> 1318 <File 1319 RelativePath="..\BasicCompiler_Common\src\Type.cpp" 1320 > 1321 </File> 1322 <File 1323 RelativePath="..\BasicCompiler_Common\src\TypeDef.cpp" 1324 > 1325 </File> 1326 <File 1327 RelativePath="..\BasicCompiler_Common\src\Variable.cpp" 1328 > 1329 </File> 1330 </Filter> 1331 <Filter 1332 Name="CoreClasses" 1333 > 1334 <File 1335 RelativePath="..\BasicCompiler_Common\src\CommonCodeGenerator.cpp" 1336 > 1337 </File> 1338 </Filter> 1349 1339 </Filter> 1350 1340 </Filter> -
trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
r235 r237 532 532 533 533 //mov eax,offset 534 OpBuffer[obp++]=(char)0xB8; 535 *((long *)(OpBuffer+obp))=offset; 536 pobj_DataTableSchedule->add(); 537 obp+=sizeof(long); 534 compiler.codeGenerator.op_mov_RV( REG_EAX, offset, Schedule::DataTable ); 538 535 539 536 //Thisポインタをecxにコピー -
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r236 r237 845 845 846 846 //mov eax,DataPos 847 OpBuffer[obp++]=(char)0xB8; 848 *((long *)(OpBuffer+obp))=(long)i2; 849 pobj_DataTableSchedule->add(); 850 obp+=sizeof(long); 847 compiler.codeGenerator.op_mov_RV( REG_EAX, i2, Schedule::DataTable ); 851 848 852 849 //mov dword ptr[offset],eax … … 978 975 979 976 //mov dword ptr[ebp+offset],eax 980 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, Schedule::LocalVar );977 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, MOD_BASE_DISP32, Schedule::LocalVar ); 981 978 } 982 979 else if( type.IsSingle() ){ … … 1001 998 1002 999 //mov dword ptr[ebp+offset],eax 1003 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, Schedule::LocalVar );1000 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, MOD_BASE_DISP32, Schedule::LocalVar ); 1004 1001 } 1005 1002 else if( type.IsDWord() || type.IsLong() || type.IsPointer() ){ … … 1013 1010 1014 1011 //mov eax,DataPos 1015 OpBuffer[obp++]=(char)0xB8; 1016 *((long *)(OpBuffer+obp))=(long)i2; 1017 pobj_DataTableSchedule->add(); 1018 obp+=sizeof(long); 1012 compiler.codeGenerator.op_mov_RV( REG_EAX, i2, Schedule::DataTable ); 1019 1013 } 1020 1014 else{ -
trunk/abdev/BasicCompiler32/MachineFixed.h
r226 r237 34 34 #define MOD_BASE_DISP8 (char)0x40 35 35 #define MOD_BASE_DISP32 (char)0x80 36 #define MOD_REG 36 #define MOD_REG (char)0xC0 37 37 38 38 #define USE_OFFSET 1 -
trunk/abdev/BasicCompiler32/NumOpe.cpp
r225 r237 595 595 596 596 //mov eax,i2 597 compiler.codeGenerator.op_mov_RV(REG_EAX,i2); 598 obp-=sizeof(long); 599 pobj_DataTableSchedule->add(); 600 obp+=sizeof(long); 597 compiler.codeGenerator.op_mov_RV(REG_EAX,i2, Schedule::DataTable ); 601 598 602 599 free( buffer ); … … 753 750 754 751 //push DataSize 755 OpBuffer[obp++]=(char)0x68; 756 *((long *)(OpBuffer+obp))=i2; 757 pobj_DataTableSchedule->add(); 758 obp+=sizeof(long); 752 compiler.codeGenerator.op_push_V( i2, Schedule::DataTable ); 759 753 } 760 754 else if((term[0]=='e'||term[0]=='E')&& -
trunk/abdev/BasicCompiler32/NumOpe_Relation.cpp
r227 r237 560 560 561 561 //test ah,01h 562 compiler.codeGenerator.op_test_ah( (char)0x 41 );562 compiler.codeGenerator.op_test_ah( (char)0x01 ); 563 563 564 564 //jne 2 565 565 OpBuffer[obp++]=(char)0x75; 566 OpBuffer[obp++]=(char)0x0 5;566 OpBuffer[obp++]=(char)0x02; 567 567 568 568 //xor ecx,ecx … … 1185 1185 // 64ビット整数演算 1186 1186 //////////////////// 1187 int FalseSchedule1, 1188 FalseSchedule2; 1187 int FalseSchedule1; 1189 1188 1190 1189 // 第1項 == 第2項 … … 1205 1204 compiler.codeGenerator.op_cmp_RR( REG_EDX, REG_ECX ); 1206 1205 1207 //jnz FalseSchedule2(偽へジャンプ) 1208 OpBuffer[obp++]=(char)0x75; 1209 FalseSchedule2=obp; 1210 obp++; 1206 //jne FalseSchedule2(偽へジャンプ) 1207 CodeGenerator::PertialSchedule *pFalsePertialSchedule = compiler.codeGenerator.op_jne( 0, sizeof(char), true ); 1211 1208 1212 1209 //mov eax,1 … … 1219 1216 //FalseScheduleのジャンプ先の設定 1220 1217 OpBuffer[FalseSchedule1]=obp-(FalseSchedule1+1); 1221 OpBuffer[FalseSchedule2]=obp-(FalseSchedule2+1);1218 compiler.codeGenerator.opfix_JmpPertialSchedule( pFalsePertialSchedule ); 1222 1219 1223 1220 //xor eax,eax(eaxを0にする) -
trunk/abdev/BasicCompiler32/x86CodeGenerator.cpp
r236 r237 20 20 21 21 void CodeGenerator::set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp, Schedule::Type scheduleType ){ 22 23 // エラーチェック 24 if( ! ( mod == MOD_BASE 25 || mod == MOD_DISP32 26 || mod == MOD_BASE_DISP8 27 || mod == MOD_BASE_DISP32 28 || mod == MOD_REG ) ) 29 { 30 SetError(); 31 } 32 22 33 if(mod==MOD_DISP32){ 23 34 //ModR/Mバイト … … 695 706 __op_format(0,(char)0x50,reg); 696 707 } 697 void CodeGenerator::op_push_V(long data ){708 void CodeGenerator::op_push_V(long data, Schedule::Type scheduleType ){ 698 709 //スタックにリテラル値をプッシュ 699 if(-128<=data&&data<=127 ){710 if(-128<=data&&data<=127 && scheduleType == Schedule::None ){ 700 711 //push 8ビット値 701 712 pNativeCode->Put( (char)0x6A ); … … 705 716 //push 32ビット値 706 717 pNativeCode->Put( (char)0x68 ); 707 pNativeCode->Put( data );718 pNativeCode->Put( data, scheduleType ); 708 719 } 709 720 }
Note:
See TracChangeset
for help on using the changeset viewer.