Changeset 226 in dev for trunk/abdev/BasicCompiler64/Compile_Var.cpp
- Timestamp:
- Jul 22, 2007, 4:58:47 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/Compile_Var.cpp
r224 r226 54 54 if(typeSize>=2){ 55 55 //imul reg,i2 56 op_imul_RV(sizeof(_int64),reg,typeSize);56 compiler.codeGenerator.op_imul_RV(sizeof(_int64),reg,typeSize); 57 57 } 58 58 } … … 72 72 73 73 //add r11,reg 74 op_add64_reg(REG_R11,reg);74 compiler.codeGenerator.op_add64_reg(REG_R11,reg); 75 75 } 76 76 void SetRelativeOffset( RELATIVE_VAR &relativeVar ){ 77 77 if(relativeVar.dwKind==VAR_DIRECTMEM){ 78 78 //mov r11,qword ptr[r11] 79 op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE);79 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE); 80 80 } 81 81 else{ … … 85 85 86 86 //mov r11,qword ptr[r12] 87 op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);87 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE); 88 88 } 89 89 } … … 139 139 140 140 //xor r12,r12 141 op_zero_reg(REG_R12);141 compiler.codeGenerator.op_zero_reg(REG_R12); 142 142 143 143 for(i=i3-1;i>=0;i--){ … … 173 173 174 174 //imul reg,i4 175 op_imul_RV(sizeof(_int64),reg,i4);175 compiler.codeGenerator.op_imul_RV(sizeof(_int64),reg,i4); 176 176 177 177 //add r12,reg 178 op_add64_reg(REG_R12,reg);178 compiler.codeGenerator.op_add64_reg(REG_R12,reg); 179 179 180 180 HeapDefaultFree(pParm[i]); … … 352 352 353 353 //mov r11,qword ptr[r11] 354 op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE);354 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE); 355 355 } 356 356 else{ … … 652 652 //xor r11,r11(r11を0に初期化する) 653 653 //※r11は変数ベースアドレスからの相対オフセットを示す 654 op_zero_reg(REG_R11);654 compiler.codeGenerator.op_zero_reg(REG_R11); 655 655 656 656 pRelativeVar->bOffsetOffset=1; … … 701 701 702 702 //mov r11,qword ptr[r12] 703 op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);703 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE); 704 704 } 705 705 } … … 721 721 722 722 //mov r11,qword ptr[r12] 723 op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);723 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE); 724 724 } 725 725 else{ … … 872 872 873 873 //mov rax,DataPos 874 op_mov_RV(sizeof(_int64),REG_RAX,i2);874 compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,i2); 875 875 obp-=sizeof(long); 876 876 pobj_DataTableSchedule->add(); … … 878 878 879 879 //mov qword ptr[offset],rax 880 op_mov_MR(sizeof(_int64),REG_RAX,0,offset,MOD_DISP32);880 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,0,offset,MOD_DISP32); 881 881 obp-=sizeof(long); 882 882 pobj_GlobalVarSchedule->add(); … … 1002 1002 1003 1003 //mov rax,i64data 1004 op_mov64_ToReg(REG_RAX,i64data);1004 compiler.codeGenerator.op_mov64_ToReg(REG_RAX,i64data); 1005 1005 1006 1006 //mov qword ptr[rsp+offset],rax 1007 op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32);1007 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32); 1008 1008 obp-=sizeof(long); 1009 1009 AddLocalVarAddrSchedule(); … … 1015 1015 1016 1016 //mov dword ptr[rsp+offset],value 1017 op_mov_MV(sizeof(long),REG_RSP,offset,USE_OFFSET,*(int *)&flt);1017 compiler.codeGenerator.op_mov_MV(sizeof(long),REG_RSP,offset,USE_OFFSET,*(int *)&flt); 1018 1018 obp-=sizeof(long)+sizeof(long); 1019 1019 AddLocalVarAddrSchedule(); … … 1030 1030 1031 1031 //mov rax,i2 1032 op_mov_RV(sizeof(_int64),REG_RAX,i2);1032 compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,i2); 1033 1033 obp-=sizeof(long); 1034 1034 pobj_DataTableSchedule->add(); … … 1036 1036 1037 1037 //mov qword ptr[rsp+offset],rax 1038 op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32);1038 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32); 1039 1039 obp-=sizeof(long); 1040 1040 AddLocalVarAddrSchedule(); … … 1044 1044 if(i64data&0xFFFFFFFF00000000){ 1045 1045 //mov rax,i64data 1046 op_mov64_ToReg(REG_RAX,i64data);1046 compiler.codeGenerator.op_mov64_ToReg(REG_RAX,i64data); 1047 1047 1048 1048 //mov qword ptr[rsp+offset],rax 1049 op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32);1049 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32); 1050 1050 obp-=sizeof(long); 1051 1051 AddLocalVarAddrSchedule(); … … 1054 1054 else{ 1055 1055 //mov qword ptr[rsp+offset],value 1056 op_mov_MV(sizeof(_int64),REG_RSP,offset,USE_OFFSET,(int)i64data);1056 compiler.codeGenerator.op_mov_MV(sizeof(_int64),REG_RSP,offset,USE_OFFSET,(int)i64data); 1057 1057 obp-=sizeof(long)+sizeof(long); 1058 1058 AddLocalVarAddrSchedule(); … … 1063 1063 else if( type.IsDWord() || type.IsLong() ){ 1064 1064 //mov dword ptr[rsp+offset],value 1065 op_mov_MV(sizeof(long),REG_RSP,offset,USE_OFFSET,(int)i64data);1065 compiler.codeGenerator.op_mov_MV(sizeof(long),REG_RSP,offset,USE_OFFSET,(int)i64data); 1066 1066 obp-=sizeof(long)+sizeof(long); 1067 1067 AddLocalVarAddrSchedule(); … … 1070 1070 else if( type.IsWord() || type.IsInteger() ){ 1071 1071 //mov word ptr[rsp+offset],value 1072 op_mov_MV(sizeof(short),REG_RSP,offset,USE_OFFSET,(int)i64data);1072 compiler.codeGenerator.op_mov_MV(sizeof(short),REG_RSP,offset,USE_OFFSET,(int)i64data); 1073 1073 obp-=sizeof(long)+sizeof(short); 1074 1074 AddLocalVarAddrSchedule(); … … 1077 1077 else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){ 1078 1078 //mov byte ptr[rsp+offset],value 1079 op_mov_MV(sizeof(char),REG_RSP,offset,USE_OFFSET,(int)i64data);1079 compiler.codeGenerator.op_mov_MV(sizeof(char),REG_RSP,offset,USE_OFFSET,(int)i64data); 1080 1080 obp-=sizeof(long)+sizeof(char); 1081 1081 AddLocalVarAddrSchedule(); … … 1182 1182 1183 1183 //mov r8, 0 1184 op_zero_reg( REG_R8 );1184 compiler.codeGenerator.op_zero_reg( REG_R8 ); 1185 1185 1186 1186 //mov rdx, VarSize 1187 op_mov_RV( sizeof(_int64), REG_RDX, pVar->GetMemorySize() );1187 compiler.codeGenerator.op_mov_RV( sizeof(_int64), REG_RDX, pVar->GetMemorySize() ); 1188 1188 1189 1189 //mov rcx, rsp 1190 op_mov_RR( REG_RCX, REG_RSP );1190 compiler.codeGenerator.op_mov_RR( REG_RCX, REG_RSP ); 1191 1191 1192 1192 //add rcx, offset 1193 op_add_RV( REG_RCX, -pVar->GetOffsetAddress() );1193 compiler.codeGenerator.op_add_RV( REG_RCX, -pVar->GetOffsetAddress() ); 1194 1194 obp-=sizeof(long); 1195 1195 AddLocalVarAddrSchedule(); … … 1199 1199 DllProc *pDllProc; 1200 1200 pDllProc=GetDeclareHash("FillMemory"); 1201 op_call( pDllProc );1201 compiler.codeGenerator.op_call( pDllProc ); 1202 1202 } 1203 1203 } … … 1240 1240 1241 1241 //mov reg,r11 1242 op_mov_RR(reg,REG_R11);1242 compiler.codeGenerator.op_mov_RR(reg,REG_R11); 1243 1243 } 1244 1244 else{ 1245 1245 //mov reg,offset 1246 op_mov64_ToReg(reg,(int)pRelativeVar->offset);1246 compiler.codeGenerator.op_mov64_ToReg(reg,(long)pRelativeVar->offset); 1247 1247 obp-=sizeof(long); 1248 1248 pobj_GlobalVarSchedule->add(); … … 1253 1253 if(pRelativeVar->bOffsetOffset){ 1254 1254 //add r11,qword ptr[offset] 1255 op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 );1255 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 1256 1256 obp-=sizeof(long); 1257 1257 pobj_GlobalVarSchedule->add(); … … 1260 1260 else{ 1261 1261 //mov r11,qword ptr[offset] 1262 op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32);1262 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 1263 1263 obp-=sizeof(long); 1264 1264 pobj_GlobalVarSchedule->add(); … … 1279 1279 1280 1280 //add r11,rsp 1281 op_add64_reg(REG_R11,REG_RSP);1281 compiler.codeGenerator.op_add64_reg(REG_R11,REG_RSP); 1282 1282 1283 1283 //mov reg,r11 1284 op_mov_RR(reg,REG_R11);1284 compiler.codeGenerator.op_mov_RR(reg,REG_R11); 1285 1285 } 1286 1286 else{ 1287 1287 //mov reg,rsp 1288 op_mov_RR(reg,REG_RSP);1288 compiler.codeGenerator.op_mov_RR(reg,REG_RSP); 1289 1289 1290 1290 //add reg,offset 1291 op_add_RV(reg,(int)pRelativeVar->offset);1291 compiler.codeGenerator.op_add_RV(reg,(int)pRelativeVar->offset); 1292 1292 obp-=sizeof(long); 1293 1293 AddLocalVarAddrSchedule(); … … 1308 1308 else{ 1309 1309 //mov r11,qword ptr[rsp+offset] 1310 op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);1310 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 1311 1311 obp-=sizeof(long); 1312 1312 AddLocalVarAddrSchedule(); … … 1319 1319 directmem: 1320 1320 //mov reg,r11 1321 op_mov_RR(reg,REG_R11);1321 compiler.codeGenerator.op_mov_RR(reg,REG_R11); 1322 1322 } 1323 1323 } … … 1337 1337 // 変数領域に要するLONG_PTR単位の個数を引き渡す 1338 1338 //mov r8,count 1339 op_mov_RV(sizeof(_int64), REG_R8,pVar->GetMemorySize()/PTR_SIZE);1339 compiler.codeGenerator.op_mov_RV(sizeof(_int64), REG_R8,pVar->GetMemorySize()/PTR_SIZE); 1340 1340 1341 1341 // ルートポインタを引き渡す 1342 1342 //mov rdx,offset 1343 op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar->GetOffsetAddress());1343 compiler.codeGenerator.op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar->GetOffsetAddress()); 1344 1344 obp-=sizeof(long); 1345 1345 pobj_GlobalVarSchedule->add(); … … 1350 1350 1351 1351 // call AddGlobalRootPtr 1352 op_call( pUserProc_AddGlobalRootPtr );1352 compiler.codeGenerator.op_call( pUserProc_AddGlobalRootPtr ); 1353 1353 1354 1354 ReallocNativeCodeBuffer();
Note:
See TracChangeset
for help on using the changeset viewer.