Changeset 231 in dev for trunk/abdev/BasicCompiler32/Compile_Var.cpp
- Timestamp:
- Jul 25, 2007, 12:02:30 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r230 r231 978 978 979 979 //mov dword ptr[ebp+offset+sizeof(long)],eax 980 OpBuffer[obp++]=(char)0x89; 981 OpBuffer[obp++]=(char)0x85; 982 *((long *)(OpBuffer+obp))=offset+sizeof(long); 983 AddLocalVarAddrSchedule(); 984 obp+=sizeof(long); 980 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset+sizeof(long), MOD_BASE_DISP32, Schedule::LocalVar ); 985 981 986 982 //mov eax,LOLONG(dbl) 987 OpBuffer[obp++]=(char)0xB8; 988 *((long *)(OpBuffer+obp))=*(long *)(&dbl); 989 obp+=sizeof(long); 983 compiler.codeGenerator.op_mov_RV( REG_EAX, *(long *)(&dbl) ); 990 984 991 985 //mov dword ptr[ebp+offset],eax 992 OpBuffer[obp++]=(char)0x89; 993 OpBuffer[obp++]=(char)0x85; 994 *((long *)(OpBuffer+obp))=offset; 995 AddLocalVarAddrSchedule(); 996 obp+=sizeof(long); 986 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, Schedule::LocalVar ); 997 987 } 998 988 else if( type.IsSingle() ){ 999 989 float flt; 1000 990 flt=(float)dbl; 991 1001 992 //mov eax,InitValue 1002 OpBuffer[obp++]=(char)0xB8; 1003 *((long *)(OpBuffer+obp))=*(long *)&flt; 1004 obp+=sizeof(long); 993 compiler.codeGenerator.op_mov_RV( REG_EAX, *(long *)&flt ); 1005 994 1006 995 //mov dword ptr[ebp+offset],eax 1007 OpBuffer[obp++]=(char)0x89; 1008 OpBuffer[obp++]=(char)0x85; 1009 *((long *)(OpBuffer+obp))=offset; 1010 AddLocalVarAddrSchedule(); 1011 obp+=sizeof(long); 996 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, MOD_BASE_DISP32, Schedule::LocalVar ); 1012 997 } 1013 998 else if( type.Is64() ){ 1014 999 //mov eax,HILONG(i64data) 1015 OpBuffer[obp++]=(char)0xB8; 1016 *((long *)(OpBuffer+obp))=(long)*(long *)(((char *)(&i64data))+4); 1017 obp+=sizeof(long); 1000 compiler.codeGenerator.op_mov_RV( REG_EAX, *(long *)(((char *)(&i64data))+4) ); 1018 1001 1019 1002 //mov dword ptr[ebp+offset+sizeof(long)],eax 1020 OpBuffer[obp++]=(char)0x89; 1021 OpBuffer[obp++]=(char)0x85; 1022 *((long *)(OpBuffer+obp))=offset+sizeof(long); 1023 AddLocalVarAddrSchedule(); 1024 obp+=sizeof(long); 1003 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset+sizeof(long), MOD_BASE_DISP32, Schedule::LocalVar ); 1025 1004 1026 1005 //mov eax,LOLONG(i64data) 1027 OpBuffer[obp++]=(char)0xB8; 1028 *((long *)(OpBuffer+obp))=*(long *)(&i64data); 1029 obp+=sizeof(long); 1006 compiler.codeGenerator.op_mov_RV( REG_EAX, *(long *)(&i64data) ); 1030 1007 1031 1008 //mov dword ptr[ebp+offset],eax 1032 OpBuffer[obp++]=(char)0x89; 1033 OpBuffer[obp++]=(char)0x85; 1034 *((long *)(OpBuffer+obp))=offset; 1035 AddLocalVarAddrSchedule(); 1036 obp+=sizeof(long); 1009 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, Schedule::LocalVar ); 1037 1010 } 1038 1011 else if( type.IsDWord() || type.IsLong() || type.IsPointer() ){ … … 1053 1026 else{ 1054 1027 //mov eax,InitValue 1055 OpBuffer[obp++]=(char)0xB8; 1056 *((long *)(OpBuffer+obp))=(long)i64data; 1057 obp+=sizeof(long); 1028 compiler.codeGenerator.op_mov_RV( REG_EAX, (long)i64data ); 1058 1029 } 1059 1030 1060 1031 //mov dword ptr[ebp+offset],eax 1061 OpBuffer[obp++]=(char)0x89; 1062 OpBuffer[obp++]=(char)0x85; 1063 *((long *)(OpBuffer+obp))=offset; 1064 AddLocalVarAddrSchedule(); 1065 obp+=sizeof(long); 1032 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, MOD_BASE_DISP32, Schedule::LocalVar ); 1066 1033 } 1067 1034 else if( type.IsWord() || type.IsInteger() ){ … … 1073 1040 1074 1041 //mov word ptr[ebp+offset],ax 1075 OpBuffer[obp++]=(char)0x66; 1076 OpBuffer[obp++]=(char)0x89; 1077 OpBuffer[obp++]=(char)0x85; 1078 *((long *)(OpBuffer+obp))=offset; 1079 AddLocalVarAddrSchedule(); 1080 obp+=sizeof(long); 1042 compiler.codeGenerator.op_mov_MR( sizeof(short), REG_EAX, REG_EBP, offset, MOD_BASE_DISP32, Schedule::LocalVar ); 1081 1043 } 1082 1044 else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){ … … 1287 1249 if(pRelativeVar->bOffsetOffset){ 1288 1250 //mov eax,ecx 1289 OpBuffer[obp++]=(char)0x8B; 1290 OpBuffer[obp++]=(char)0xC1; 1251 compiler.codeGenerator.op_mov_RR( REG_EAX, REG_ECX ); 1291 1252 1292 1253 //add eax,dword ptr[ebp+offset] 1293 OpBuffer[obp++]=(char)0x03; 1294 OpBuffer[obp++]=(char)0x85; 1295 *((long *)(OpBuffer+obp))=pRelativeVar->offset; 1296 AddLocalVarAddrSchedule(); 1297 obp+=sizeof(long); 1254 compiler.codeGenerator.op_add_RM( sizeof(long), REG_EAX, REG_EBP, pRelativeVar->offset, MOD_BASE_DISP32, Schedule::LocalVar ); 1298 1255 } 1299 1256 else{ 1300 1257 //mov eax,dword ptr[ebp+offset] 1301 OpBuffer[obp++]=(char)0x8B; 1302 OpBuffer[obp++]=(char)0x85; 1303 *((long *)(OpBuffer+obp))=pRelativeVar->offset; 1304 AddLocalVarAddrSchedule(); 1305 obp+=sizeof(long); 1258 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, pRelativeVar->offset, MOD_BASE_DISP32, Schedule::LocalVar ); 1306 1259 } 1307 1260 } 1308 1261 else if(pRelativeVar->dwKind==VAR_DIRECTMEM){ 1309 1262 //mov eax,ecx 1310 OpBuffer[obp++]=(char)0x8B; 1311 OpBuffer[obp++]=(char)0xC1; 1263 compiler.codeGenerator.op_mov_RR( REG_EAX, REG_ECX ); 1312 1264 } 1313 1265 } … … 1340 1292 1341 1293 //mov eax,offset 1342 compiler.codeGenerator.op_mov_RV(REG_EAX,(int)pVar->GetOffsetAddress()); 1343 obp-=sizeof(long); 1344 pobj_GlobalVarSchedule->add(); 1345 obp+=sizeof(long); 1294 compiler.codeGenerator.op_mov_RV(REG_EAX,(int)pVar->GetOffsetAddress(), Schedule::GlobalVar ); 1346 1295 1347 1296 //push eax
Note:
See TracChangeset
for help on using the changeset viewer.