Changeset 225 in dev for trunk/abdev/BasicCompiler32/Compile_Var.cpp
- Timestamp:
- Jul 21, 2007, 11:47:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r224 r225 28 28 29 29 //pop ebx 30 op_pop(REG_EBX);30 compiler.codeGenerator.op_pop(REG_EBX); 31 31 32 32 if( resultType.PtrLevel() ){ … … 36 36 if(typeSize>=2){ 37 37 //imul ebx,i2 38 op_imul_RV( REG_EBX, typeSize );38 compiler.codeGenerator.op_imul_RV( REG_EBX, typeSize ); 39 39 } 40 40 } … … 46 46 47 47 //pop ecx 48 op_pop(REG_ECX);48 compiler.codeGenerator.op_pop(REG_ECX); 49 49 50 50 //add ecx,ebx 51 OpBuffer[obp++]=(char)0x03; 52 OpBuffer[obp++]=(char)0xCB; 51 compiler.codeGenerator.op_add_RR( REG_ECX, REG_EBX ); 53 52 } 54 53 void SetRelativeOffset( RELATIVE_VAR &relativeVar ){ 55 54 if(relativeVar.dwKind==VAR_DIRECTMEM){ 56 55 //mov ecx,dword ptr[ecx] 57 op_mov_RM( sizeof(long), REG_ECX, REG_ECX, 0, MOD_BASE );56 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_ECX, REG_ECX, 0, MOD_BASE ); 58 57 } 59 58 else{ … … 63 62 64 63 //mov ecx,dword ptr[eax] 65 op_mov_RM( sizeof(long), REG_ECX, REG_EAX, 0, MOD_BASE );64 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_ECX, REG_EAX, 0, MOD_BASE ); 66 65 } 67 66 } … … 114 113 115 114 //push ecx 116 op_push(REG_ECX);115 compiler.codeGenerator.op_push(REG_ECX); 117 116 118 117 //push 0 119 op_push_V(0);118 compiler.codeGenerator.op_push_V(0); 120 119 121 120 for(i=i3-1;i>=0;i--){ … … 133 132 134 133 //pop eax 135 op_pop(REG_EAX);134 compiler.codeGenerator.op_pop(REG_EAX); 136 135 137 136 for(i2=i+1,i4=1;i2<i3;i2++) i4*=subscripts[i2]+1; … … 152 151 153 152 //pop eax 154 op_pop(REG_EAX);153 compiler.codeGenerator.op_pop(REG_EAX); 155 154 156 155 //imul eax,TypeSize … … 161 160 162 161 //pop ecx 163 op_pop(REG_ECX);162 compiler.codeGenerator.op_pop(REG_ECX); 164 163 165 164 //add ecx,eax 166 OpBuffer[obp++]=(char)0x03; 167 OpBuffer[obp++]=(char)0xC8; 165 compiler.codeGenerator.op_add_RR( REG_ECX, REG_EAX ); 168 166 169 167 return 1; … … 628 626 //xor ecx,ecx(ecxを0に初期化する) 629 627 //※ecxは変数ベースアドレスからの相対オフセットを示す 630 op_zero_reg(REG_ECX);628 compiler.codeGenerator.op_zero_reg(REG_ECX); 631 629 632 630 pRelativeVar->bOffsetOffset=1; … … 1194 1192 else{ 1195 1193 //push 0 1196 op_push_V(0);1194 compiler.codeGenerator.op_push_V(0); 1197 1195 1198 1196 //push VarSize 1199 op_push_V( pVar->GetMemorySize() );1197 compiler.codeGenerator.op_push_V( pVar->GetMemorySize() ); 1200 1198 1201 1199 //mov eax,ebp … … 1210 1208 1211 1209 //push eax 1212 op_push(REG_EAX);1210 compiler.codeGenerator.op_push(REG_EAX); 1213 1211 1214 1212 //call FillMemory … … 1237 1235 1238 1236 //pop eax 1239 op_pop( REG_EAX );1237 compiler.codeGenerator.op_pop( REG_EAX ); 1240 1238 1241 1239 RELATIVE_VAR RelativeVar; … … 1273 1271 1274 1272 //add eax,dword ptr[offset] 1275 op_add_RM( sizeof(long), REG_EAX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 );1273 compiler.codeGenerator.op_add_RM( sizeof(long), REG_EAX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 1276 1274 } 1277 1275 else{ 1278 1276 //mov eax,dword ptr[offset] 1279 op_mov_RM( sizeof(long), REG_EAX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 );1277 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 1280 1278 } 1281 1279 obp-=sizeof(long); … … 1356 1354 1357 1355 // 変数領域に要するLONG_PTR単位の個数を引き渡す 1358 op_push_V( pVar->GetMemorySize()/PTR_SIZE );1356 compiler.codeGenerator.op_push_V( pVar->GetMemorySize()/PTR_SIZE ); 1359 1357 1360 1358 … … 1363 1361 1364 1362 //mov eax,offset 1365 op_mov_RV(REG_EAX,(int)pVar->GetOffsetAddress());1363 compiler.codeGenerator.op_mov_RV(REG_EAX,(int)pVar->GetOffsetAddress()); 1366 1364 obp-=sizeof(long); 1367 1365 pobj_GlobalVarSchedule->add(); … … 1369 1367 1370 1368 //push eax 1371 op_push( REG_EAX );1369 compiler.codeGenerator.op_push( REG_EAX ); 1372 1370 1373 1371 // … … 1381 1379 1382 1380 //push eax 1383 op_push( REG_EAX );1381 compiler.codeGenerator.op_push( REG_EAX ); 1384 1382 1385 1383 // … … 1388 1386 1389 1387 // call AddGlobalRootPtr 1390 op_call( pUserProc_AddGlobalRootPtr );1388 compiler.codeGenerator.op_call( pUserProc_AddGlobalRootPtr ); 1391 1389 1392 1390 ReallocNativeCodeBuffer();
Note:
See TracChangeset
for help on using the changeset viewer.