Changeset 231 in dev
- Timestamp:
- Jul 25, 2007, 12:02:30 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Calc_PushVar.cpp
r229 r231 162 162 if(pRelativeVar->bOffsetOffset){ 163 163 //add ecx,offset 164 OpBuffer[obp++]=(char)0x81; 165 OpBuffer[obp++]=(char)0xC1; 166 *((long *)(OpBuffer+obp))=pRelativeVar->offset; 167 AddLocalVarAddrSchedule(); 168 obp+=sizeof(long); 164 compiler.codeGenerator.op_add_RV( REG_ECX, pRelativeVar->offset, Schedule::LocalVar ); 169 165 170 166 //push dword ptr[ebp+ecx] … … 178 174 else{ 179 175 //push dword ptr[ebp+offset] 180 OpBuffer[obp++]=(char)0xFF; 181 OpBuffer[obp++]=(char)0xB5; 182 *((long *)(OpBuffer+obp))=pRelativeVar->offset; 183 AddLocalVarAddrSchedule(); 184 obp+=sizeof(long); 176 compiler.codeGenerator.op_push_M( REG_EBP, pRelativeVar->offset, Schedule::LocalVar ); 185 177 } 186 178 } 187 179 else if(pRelativeVar->dwKind==VAR_REFLOCAL){ 188 180 //mov eax,dword ptr[ebp+offset] 189 OpBuffer[obp++]=(char)0x8B; 190 OpBuffer[obp++]=(char)0x85; 191 *((long *)(OpBuffer+obp))=pRelativeVar->offset; 192 AddLocalVarAddrSchedule(); 193 obp+=sizeof(long); 181 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, pRelativeVar->offset, MOD_BASE_DISP32, Schedule::LocalVar ); 194 182 195 183 if(pRelativeVar->bOffsetOffset){ -
trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
r225 r231 677 677 } 678 678 } 679 else if(i3==DEF_DOUBLE){ 679 else if( i3==DEF_DOUBLE 680 || i3 == DEF_SINGLE ) 681 { 680 682 //fld qword ptr[ebp+offset] 681 OpBuffer[obp++]=(char)0xDD; 682 OpBuffer[obp++]=(char)0x85; 683 *((long *)(OpBuffer+obp))=RelativeVar.offset; 684 AddLocalVarAddrSchedule(); 685 obp+=sizeof(long); 686 } 687 else if(i3==DEF_SINGLE){ 688 //fld dword ptr[ebp+offset] 689 OpBuffer[obp++]=(char)0xD9; 690 OpBuffer[obp++]=(char)0x85; 691 *((long *)(OpBuffer+obp))=RelativeVar.offset; 692 AddLocalVarAddrSchedule(); 693 obp+=sizeof(long); 683 compiler.codeGenerator.op_fld_base_offset( i3, REG_EBP, RelativeVar.offset, Schedule::LocalVar ); 694 684 } 695 685 else if(i3==DEF_INT64||i3==DEF_QWORD){ 696 686 //mov eax,dword ptr[ebp+offset] 697 OpBuffer[obp++]=(char)0x8B; 698 OpBuffer[obp++]=(char)0x85; 699 *((long *)(OpBuffer+obp))=RelativeVar.offset; 700 AddLocalVarAddrSchedule(); 701 obp+=sizeof(long); 687 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar ); 702 688 703 689 //mov edx,dword ptr[ebp+offset+sizeof(long)] 704 OpBuffer[obp++]=(char)0x8B; 705 OpBuffer[obp++]=(char)0x95; 706 *((long *)(OpBuffer+obp))=RelativeVar.offset+sizeof(long); 707 AddLocalVarAddrSchedule(); 708 obp+=sizeof(long); 690 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EBP, RelativeVar.offset+sizeof(long), MOD_BASE_DISP32, Schedule::LocalVar ); 709 691 } 710 692 else if(i3==DEF_LONG||i3==DEF_DWORD|| 711 693 IsPtrType(i3)){ 712 694 //mov eax,dword ptr[ebp+offset] 713 OpBuffer[obp++]=(char)0x8B; 714 OpBuffer[obp++]=(char)0x85; 715 *((long *)(OpBuffer+obp))=RelativeVar.offset; 716 AddLocalVarAddrSchedule(); 717 obp+=sizeof(long); 695 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar ); 718 696 } 719 697 else if(i3==DEF_INTEGER||i3==DEF_WORD || (Smoothie::IsUnicode()&&i3==DEF_CHAR)){ … … 722 700 723 701 //mov ax,word ptr[ebp+offset] 724 OpBuffer[obp++]=(char)0x66; 725 OpBuffer[obp++]=(char)0x8B; 726 OpBuffer[obp++]=(char)0x85; 727 *((long *)(OpBuffer+obp))=RelativeVar.offset; 728 AddLocalVarAddrSchedule(); 729 obp+=sizeof(long); 702 compiler.codeGenerator.op_mov_RM( sizeof(short), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar ); 730 703 } 731 704 else if(i3==DEF_SBYTE||i3==DEF_BYTE||i3==DEF_BOOLEAN || (Smoothie::IsUnicode()==false&&i3==DEF_CHAR)){ … … 734 707 735 708 //mov al,byte ptr[ebp+offset] 736 OpBuffer[obp++]=(char)0x8A; 737 OpBuffer[obp++]=(char)0x85; 738 *((long *)(OpBuffer+obp))=RelativeVar.offset; 739 AddLocalVarAddrSchedule(); 740 obp+=sizeof(long); 709 compiler.codeGenerator.op_mov_RM( sizeof(char), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar ); 741 710 } 742 711 } -
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.