Changeset 232 in dev for trunk/abdev/BasicCompiler64
- Timestamp:
- Jul 25, 2007, 4:04:11 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler64
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/BasicCompiler.vcproj
r226 r232 1117 1117 </File> 1118 1118 <File 1119 RelativePath="..\BasicCompiler_Common\src\NativeCode.cpp" 1120 > 1121 </File> 1122 <File 1119 1123 RelativePath="..\BasicCompiler_Common\src\Procedure.cpp" 1120 1124 > -
trunk/abdev/BasicCompiler64/CodeGenerator.cpp
r228 r232 160 160 /////////////////// 161 161 162 void CodeGenerator::op_mov_RV(int op_size,int reg,long i32data ){162 void CodeGenerator::op_mov_RV(int op_size,int reg,long i32data, Schedule::Type scheduleType ){ 163 163 //mov reg,i32data 164 164 … … 179 179 180 180 //即値 181 pNativeCode->Put( i32data );181 pNativeCode->Put( i32data, scheduleType ); 182 182 } 183 183 void CodeGenerator::op_mov_RV64(int reg,_int64 i64data){ … … 258 258 } 259 259 } 260 void CodeGenerator::op_mov_MR(int op_size,int reg,int base_reg,long offset,char mod ){260 void CodeGenerator::op_mov_MR(int op_size,int reg,int base_reg,long offset,char mod, Schedule::Type scheduleType ){ 261 261 //mov qword ptr[base_reg+offset],reg64 262 262 //mov dword ptr[base_reg+offset],reg32 … … 273 273 else opcode=(char)0x89; 274 274 275 __op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod );276 } 277 void CodeGenerator::op_mov_MR_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset ){275 __op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod, scheduleType ); 276 } 277 void CodeGenerator::op_mov_MR_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset, Schedule::Type scheduleType ){ 278 278 //mov qword ptr[base_reg1+base_reg2+offset],reg64 279 279 //mov dword ptr[base_reg1+base_reg2+offset],reg32 … … 309 309 310 310 //オフセット値 311 pNativeCode->Put( offset );311 pNativeCode->Put( offset, scheduleType ); 312 312 } 313 313 else{ … … 389 389 } 390 390 391 392 393 ///////////////////394 // mov64関連395 ///////////////////396 397 void CodeGenerator::op_mov64_ToReg(int reg,_int64 i64data){398 //mov reg,i64data399 400 if(REG_RAX<=reg&®<=REG_RDI){401 /* rax~rdi402 0100 1000 1011 1xxx [64bit data] */403 pNativeCode->Put( (char)0x48 );404 pNativeCode->Put( (char)(0xB8| REGISTER_OPERAND(reg) ) );405 pNativeCode->Put( i64data );406 }407 if(REG_R8<=reg&®<=REG_R15){408 /* r8~r15409 0100 1001 1011 1xxx [64bit data] */410 pNativeCode->Put( (char)0x49 );411 pNativeCode->Put( (char)(0xB8| REGISTER_OPERAND(reg) ) );412 pNativeCode->Put( i64data );413 }414 }415 void CodeGenerator::op_mov64_ToReg(int reg,long i32data){416 //mov reg,i32data417 418 if(REG_RAX<=reg&®<=REG_RDI){419 /* rax~rdi420 0100 1000 1100 0111 1100 0xxx [32bit data] */421 pNativeCode->Put( (char)0x48 );422 pNativeCode->Put( (char)0xC7 );423 pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg) ) );424 pNativeCode->Put( i32data );425 }426 if(REG_R8<=reg&®<=REG_R15){427 /* r8~r15428 0100 1001 1100 0111 1100 0xxx [32bit data] */429 pNativeCode->Put( (char)0x49 );430 pNativeCode->Put( (char)0xC7 );431 pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg) ) );432 pNativeCode->Put( i32data );433 }434 }435 391 void CodeGenerator::op_movsxd(int reg64,int reg32){ 436 392 //movsxd reg64,reg32 … … 641 597 } 642 598 643 void CodeGenerator::op_add_RV(int reg,long offset ){599 void CodeGenerator::op_add_RV(int reg,long offset, Schedule::Type scheduleType ){ 644 600 //add reg,offset 645 601 char RexByte=-1; … … 656 612 pNativeCode->Put( (char)RexByte ); 657 613 pNativeCode->Put( (char)0x05 ); 658 pNativeCode->Put( offset );614 pNativeCode->Put( offset, scheduleType ); 659 615 } 660 616 else{ … … 665 621 pNativeCode->Put( (char)0x81 ); 666 622 pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)) ); 667 pNativeCode->Put( offset );623 pNativeCode->Put( offset, scheduleType ); 668 624 } 669 625 } … … 1365 1321 //////////////////// 1366 1322 1367 void CodeGenerator::op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod ){1323 void CodeGenerator::op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1368 1324 //movlpd qword ptr[base_reg+offset],xmm_reg 1369 __op_format(0,(char)0x66,(char)0x0F,(char)0x13,xmm_reg,base_reg,offset,mod );1370 } 1371 void CodeGenerator::op_movlpd_RM(int xmm_reg,int base_reg,int offset,char mod ){1325 __op_format(0,(char)0x66,(char)0x0F,(char)0x13,xmm_reg,base_reg,offset,mod, scheduleType ); 1326 } 1327 void CodeGenerator::op_movlpd_RM(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1372 1328 //movlpd xmm_reg,qword ptr[base_reg+offset] 1373 __op_format(0,(char)0x66,(char)0x0F,(char)0x12,xmm_reg,base_reg,offset,mod );1329 __op_format(0,(char)0x66,(char)0x0F,(char)0x12,xmm_reg,base_reg,offset,mod, scheduleType ); 1374 1330 } 1375 1331 void CodeGenerator::op_movsd_RR(int xmm_reg1,int xmm_reg2){ … … 1379 1335 __op_format(0,(char)0xF2,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG); 1380 1336 } 1381 void CodeGenerator::op_movsd_MR(int xmm_reg,int base_reg,int offset,char mod ){1337 void CodeGenerator::op_movsd_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1382 1338 //movsd qword ptr[reg+offset],xmm_reg 1383 1339 //movsd qword ptr[reg],xmm_reg 1384 __op_format(0,(char)0xF2,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod );1340 __op_format(0,(char)0xF2,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod, scheduleType ); 1385 1341 } 1386 1342 void CodeGenerator::op_movss_RR(int xmm_reg1,int xmm_reg2){ … … 1390 1346 __op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG); 1391 1347 } 1392 void CodeGenerator::op_movss_RM(int xmm_reg,int base_reg,int offset,char mod ){1348 void CodeGenerator::op_movss_RM(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1393 1349 //movss xmm_reg,dword ptr[base_reg+offset] 1394 __op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg,base_reg,offset,mod );1395 } 1396 void CodeGenerator::op_movss_MR(int xmm_reg,int base_reg,int offset,char mod ){1350 __op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg,base_reg,offset,mod, scheduleType ); 1351 } 1352 void CodeGenerator::op_movss_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){ 1397 1353 //movss dword ptr[reg+offset],xmm_reg 1398 1354 //movss dword ptr[reg],xmm_reg 1399 __op_format(0,(char)0xF3,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod );1355 __op_format(0,(char)0xF3,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod, scheduleType ); 1400 1356 } 1401 1357 -
trunk/abdev/BasicCompiler64/Compile_Calc_PushVar.cpp
r228 r232 11 11 if(pRelativeVar->bOffsetOffset){ 12 12 //movlpd xmm_reg,qword ptr[r11+offset] 13 OpBuffer[obp++]=(char)0x66; 14 OpBuffer[obp++]=(char)0x41; 15 OpBuffer[obp++]=(char)0x0F; 16 OpBuffer[obp++]=(char)0x12; 17 OpBuffer[obp++]=(char)(0x83 | REGISTER_OPERAND(xmm_reg)<<3); 18 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 19 pobj_GlobalVarSchedule->add(); 20 obp+=sizeof(long); 13 compiler.codeGenerator.op_movlpd_RM( xmm_reg, REG_R11, (long)pRelativeVar->offset, MOD_BASE_DISP32, Schedule::GlobalVar ); 21 14 } 22 15 else{ 23 16 //movlpd xmm_reg,qword ptr[offset] 24 OpBuffer[obp++]=(char)0x66; 25 OpBuffer[obp++]=(char)0x0F; 26 OpBuffer[obp++]=(char)0x12; 27 OpBuffer[obp++]=(char)(0x04 | REGISTER_OPERAND(xmm_reg)<<3); 28 OpBuffer[obp++]=(char)0x25; 29 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 30 pobj_GlobalVarSchedule->add(); 31 obp+=sizeof(long); 17 compiler.codeGenerator.op_movlpd_RM( xmm_reg, 0, (long)pRelativeVar->offset, MOD_DISP32, Schedule::GlobalVar ); 32 18 } 33 19 } … … 50 36 else{ 51 37 //movlpd xmm_reg,qword ptr[rsp+offset] 52 OpBuffer[obp++]=(char)0x66; 53 OpBuffer[obp++]=(char)0x0F; 54 OpBuffer[obp++]=(char)0x12; 55 OpBuffer[obp++]=(char)(0x84 | REGISTER_OPERAND(xmm_reg)<<3); 56 OpBuffer[obp++]=(char)0x24; 57 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 58 AddLocalVarAddrSchedule(); 59 obp+=sizeof(long); 38 compiler.codeGenerator.op_movlpd_RM( xmm_reg, REG_RSP, (long)pRelativeVar->offset, MOD_BASE_DISP32, Schedule::LocalVar ); 60 39 } 61 40 } … … 63 42 if(pRelativeVar->bOffsetOffset){ 64 43 //add r11,qword ptr[rsp+offset] 65 OpBuffer[obp++]=(char)0x4C; 66 OpBuffer[obp++]=(char)0x03; 67 OpBuffer[obp++]=(char)0x9C; 68 OpBuffer[obp++]=(char)0x24; 69 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 70 AddLocalVarAddrSchedule(); 71 obp+=sizeof(long); 44 compiler.codeGenerator.op_add_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 72 45 } 73 46 else{ 74 47 //mov r11,qword ptr[rsp+offset] 75 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 76 obp-=sizeof(long); 77 AddLocalVarAddrSchedule(); 78 obp+=sizeof(long); 48 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 79 49 } 80 50 … … 84 54 directmem: 85 55 //movlpd xmm_reg,qword ptr[r11] 86 OpBuffer[obp++]=(char)0x66; 87 OpBuffer[obp++]=(char)0x41; 88 OpBuffer[obp++]=(char)0x0F; 89 OpBuffer[obp++]=(char)0x12; 90 OpBuffer[obp++]=(char)(0x03 | REGISTER_OPERAND(xmm_reg)<<3); 56 compiler.codeGenerator.op_movlpd_RM( xmm_reg, REG_R11, 0, MOD_BASE); 91 57 } 92 58 } … … 95 61 if(pRelativeVar->bOffsetOffset){ 96 62 //movss xmm_reg,dword ptr[r11+offset] 97 OpBuffer[obp++]=(char)0xF3; 98 OpBuffer[obp++]=(char)0x41; 99 OpBuffer[obp++]=(char)0x0F; 100 OpBuffer[obp++]=(char)0x10; 101 OpBuffer[obp++]=(char)(0x83 | REGISTER_OPERAND(xmm_reg)<<3); 102 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 103 pobj_GlobalVarSchedule->add(); 104 obp+=sizeof(long); 63 compiler.codeGenerator.op_movss_RM( xmm_reg, REG_R11, (long)pRelativeVar->offset, MOD_BASE_DISP32, Schedule::GlobalVar ); 105 64 } 106 65 else{ 107 66 //movss xmm_reg,dword ptr[offset] 108 OpBuffer[obp++]=(char)0xF3; 109 OpBuffer[obp++]=(char)0x0F; 110 OpBuffer[obp++]=(char)0x10; 111 OpBuffer[obp++]=(char)(0x04 | REGISTER_OPERAND(xmm_reg)<<3); 112 OpBuffer[obp++]=(char)0x25; 113 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 114 pobj_GlobalVarSchedule->add(); 115 obp+=sizeof(long); 67 compiler.codeGenerator.op_movss_RM( xmm_reg, 0, (long)pRelativeVar->offset, MOD_BASE, Schedule::GlobalVar ); 116 68 } 117 69 } … … 134 86 else{ 135 87 //movss xmm_reg,dword ptr[rsp+offset] 136 OpBuffer[obp++]=(char)0xF3; 137 OpBuffer[obp++]=(char)0x0F; 138 OpBuffer[obp++]=(char)0x10; 139 OpBuffer[obp++]=(char)(0x84 | REGISTER_OPERAND(xmm_reg)<<3); 140 OpBuffer[obp++]=(char)0x24; 141 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 142 AddLocalVarAddrSchedule(); 143 obp+=sizeof(long); 88 compiler.codeGenerator.op_movss_RM( xmm_reg, REG_RSP, (long)pRelativeVar->offset, MOD_BASE_DISP32, Schedule::LocalVar ); 144 89 } 145 90 } … … 147 92 if(pRelativeVar->bOffsetOffset){ 148 93 //add r11,qword ptr[rsp+offset] 149 OpBuffer[obp++]=(char)0x4C; 150 OpBuffer[obp++]=(char)0x03; 151 OpBuffer[obp++]=(char)0x9C; 152 OpBuffer[obp++]=(char)0x24; 153 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 154 AddLocalVarAddrSchedule(); 155 obp+=sizeof(long); 94 compiler.codeGenerator.op_add_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 156 95 } 157 96 else{ 158 97 //mov r11,qword ptr[rsp+offset] 159 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 160 obp-=sizeof(long); 161 AddLocalVarAddrSchedule(); 162 obp+=sizeof(long); 98 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 163 99 } 164 100 … … 168 104 directmem: 169 105 //movss xmm_reg,dword ptr[r11] 170 OpBuffer[obp++]=(char)0xF3; 171 OpBuffer[obp++]=(char)0x41; 172 OpBuffer[obp++]=(char)0x0F; 173 OpBuffer[obp++]=(char)0x10; 174 OpBuffer[obp++]=(char)(0x03 | REGISTER_OPERAND(xmm_reg)<<3); 106 compiler.codeGenerator.op_movss_RM( xmm_reg, REG_R11, 0, MOD_BASE); 175 107 } 176 108 } -
trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
r226 r232 740 740 //ローカル変数領域のサイズをスタックフレームに通知 741 741 int localParmSize = AllLocalVarSize - BaseLocalVar; 742 int stackFrameSize = pobj_sf->GetFrameSize( AllLocalVarSize );742 int stackFrameSize = pobj_sf->GetFrameSize( localParmSize ); 743 743 744 744 //ローカル変数アドレススケジュール -
trunk/abdev/BasicCompiler64/Compile_Set_Var.cpp
r228 r232 105 105 if(pRelative->bOffsetOffset){ 106 106 //movsd qword ptr[r11+offset],xmm0 107 OpBuffer[obp++]=(char)0xF2; 108 OpBuffer[obp++]=(char)0x41; 109 OpBuffer[obp++]=(char)0x0F; 110 OpBuffer[obp++]=(char)0x11; 111 OpBuffer[obp++]=(char)0x83; 112 *((long *)(OpBuffer+obp))=(int)pRelative->offset; 113 pobj_GlobalVarSchedule->add(); 114 obp+=sizeof(long); 107 compiler.codeGenerator.op_movsd_MR( REG_XMM0, REG_R11, (long)pRelative->offset, MOD_BASE_DISP32, Schedule::GlobalVar ); 115 108 } 116 109 else{ 117 110 //movsd qword ptr[offset],xmm0 118 OpBuffer[obp++]=(char)0xF2; 119 OpBuffer[obp++]=(char)0x0F; 120 OpBuffer[obp++]=(char)0x11; 121 OpBuffer[obp++]=(char)0x04; 122 OpBuffer[obp++]=(char)0x25; 123 *((long *)(OpBuffer+obp))=(int)pRelative->offset; 124 pobj_GlobalVarSchedule->add(); 125 obp+=sizeof(long); 111 compiler.codeGenerator.op_movsd_MR( REG_XMM0, 0, (long)pRelative->offset, MOD_DISP32, Schedule::GlobalVar ); 126 112 } 127 113 } … … 144 130 else{ 145 131 //movsd qword ptr[rsp+offset],xmm0 146 OpBuffer[obp++]=(char)0xF2; 147 OpBuffer[obp++]=(char)0x0F; 148 OpBuffer[obp++]=(char)0x11; 149 OpBuffer[obp++]=(char)0x84; 150 OpBuffer[obp++]=(char)0x24; 151 *((long *)(OpBuffer+obp))=(int)pRelative->offset; 152 AddLocalVarAddrSchedule(); 153 obp+=sizeof(long); 132 compiler.codeGenerator.op_movsd_MR( REG_XMM0, REG_RSP, (long)pRelative->offset, MOD_BASE_DISP32, Schedule::LocalVar ); 154 133 } 155 134 } … … 157 136 if(pRelative->bOffsetOffset){ 158 137 //add r11,qword ptr[rsp+offset] 159 OpBuffer[obp++]=(char)0x4C; 160 OpBuffer[obp++]=(char)0x03; 161 OpBuffer[obp++]=(char)0x9C; 162 OpBuffer[obp++]=(char)0x24; 163 *((long *)(OpBuffer+obp))=(int)pRelative->offset; 164 AddLocalVarAddrSchedule(); 165 obp+=sizeof(long); 138 compiler.codeGenerator.op_add_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 166 139 } 167 140 else{ 168 141 //mov r11,qword ptr[rsp+offset] 169 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 170 obp-=sizeof(long); 171 AddLocalVarAddrSchedule(); 172 obp+=sizeof(long); 142 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 173 143 } 174 144 … … 192 162 if(pRelative->bOffsetOffset){ 193 163 //movss dword ptr[r11+offset],xmm0 194 OpBuffer[obp++]=(char)0xF3; 195 OpBuffer[obp++]=(char)0x41; 196 OpBuffer[obp++]=(char)0x0F; 197 OpBuffer[obp++]=(char)0x11; 198 OpBuffer[obp++]=(char)0x83; 199 *((long *)(OpBuffer+obp))=(int)pRelative->offset; 200 pobj_GlobalVarSchedule->add(); 201 obp+=sizeof(long); 164 compiler.codeGenerator.op_movss_MR( REG_XMM0, REG_R11, (long)pRelative->offset, MOD_BASE_DISP32, Schedule::GlobalVar ); 202 165 } 203 166 else{ 204 167 //movss dword ptr[offset],xmm0 205 OpBuffer[obp++]=(char)0xF3; 206 OpBuffer[obp++]=(char)0x0F; 207 OpBuffer[obp++]=(char)0x11; 208 OpBuffer[obp++]=(char)0x04; 209 OpBuffer[obp++]=(char)0x25; 210 *((long *)(OpBuffer+obp))=(int)pRelative->offset; 211 pobj_GlobalVarSchedule->add(); 212 obp+=sizeof(long); 168 compiler.codeGenerator.op_movss_MR( REG_XMM0, 0, (long)pRelative->offset, MOD_DISP32, Schedule::GlobalVar ); 213 169 } 214 170 } … … 231 187 else{ 232 188 //movss dword ptr[rsp+offset],xmm0 233 OpBuffer[obp++]=(char)0xF3; 234 OpBuffer[obp++]=(char)0x0F; 235 OpBuffer[obp++]=(char)0x11; 236 OpBuffer[obp++]=(char)0x84; 237 OpBuffer[obp++]=(char)0x24; 238 *((long *)(OpBuffer+obp))=(int)pRelative->offset; 239 AddLocalVarAddrSchedule(); 240 obp+=sizeof(long); 189 compiler.codeGenerator.op_movss_MR( REG_XMM0, REG_RSP, (long)pRelative->offset, MOD_BASE_DISP32, Schedule::LocalVar ); 241 190 } 242 191 } … … 244 193 if(pRelative->bOffsetOffset){ 245 194 //add r11,qword ptr[rsp+offset] 246 OpBuffer[obp++]=(char)0x4C; 247 OpBuffer[obp++]=(char)0x03; 248 OpBuffer[obp++]=(char)0x9C; 249 OpBuffer[obp++]=(char)0x24; 250 *((long *)(OpBuffer+obp))=(int)pRelative->offset; 251 AddLocalVarAddrSchedule(); 252 obp+=sizeof(long); 195 compiler.codeGenerator.op_add_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 253 196 } 254 197 else{ 255 198 //mov r11,qword ptr[rsp+offset] 256 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 257 obp-=sizeof(long); 258 AddLocalVarAddrSchedule(); 259 obp+=sizeof(long); 199 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 260 200 } 261 201 … … 334 274 if(pRelative->bOffsetOffset){ 335 275 //mov ptr[r11+offset],rax/eax/ax/al 336 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32); 337 obp-=sizeof(long); 338 pobj_GlobalVarSchedule->add(); 339 obp+=sizeof(long); 276 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32, Schedule::GlobalVar ); 340 277 } 341 278 else{ 342 279 //mov ptr[offset],rax/eax/ax/al 343 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,0,(int)pRelative->offset,MOD_DISP32); 344 obp-=sizeof(long); 345 pobj_GlobalVarSchedule->add(); 346 obp+=sizeof(long); 280 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,0,(int)pRelative->offset,MOD_DISP32, Schedule::GlobalVar ); 347 281 } 348 282 } … … 350 284 if(pRelative->bOffsetOffset){ 351 285 //add r11,qword ptr[offset] 352 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelative->offset, MOD_DISP32 ); 353 obp-=sizeof(long); 354 pobj_GlobalVarSchedule->add(); 355 obp+=sizeof(long); 286 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelative->offset, MOD_DISP32, Schedule::GlobalVar ); 356 287 } 357 288 else{ 358 289 //mov r11,qword ptr[offset] 359 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelative->offset,MOD_DISP32); 360 obp-=sizeof(long); 361 pobj_GlobalVarSchedule->add(); 362 obp+=sizeof(long); 290 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelative->offset,MOD_DISP32, Schedule::GlobalVar ); 363 291 } 364 292 … … 368 296 if(pRelative->bOffsetOffset){ 369 297 //mov ptr[rsp+r11+offset],rax/eax/ax/al 370 compiler.codeGenerator.op_mov_MR_ex(varSize,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET); 371 obp-=sizeof(long); 372 AddLocalVarAddrSchedule(); 373 obp+=sizeof(long); 298 compiler.codeGenerator.op_mov_MR_ex(varSize,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET, Schedule::LocalVar ); 374 299 } 375 300 else{ 376 301 //mov ptr[rsp+offset],rax/eax/ax/al 377 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 378 obp-=sizeof(long); 379 AddLocalVarAddrSchedule(); 380 obp+=sizeof(long); 302 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 381 303 } 382 304 } … … 384 306 if(pRelative->bOffsetOffset){ 385 307 //add r11,qword ptr[rsp+offset] 386 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_RSP, (int)pRelative->offset, MOD_BASE_DISP32 ); 387 obp-=sizeof(long); 388 AddLocalVarAddrSchedule(); 389 obp+=sizeof(long); 308 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_RSP, (int)pRelative->offset, MOD_BASE_DISP32, Schedule::LocalVar ); 390 309 } 391 310 else{ 392 311 //mov r11,qword ptr[rsp+offset] 393 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 394 obp-=sizeof(long); 395 AddLocalVarAddrSchedule(); 396 obp+=sizeof(long); 312 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 397 313 } 398 314 -
trunk/abdev/BasicCompiler64/Compile_Var.cpp
r228 r232 868 868 869 869 //mov qword ptr[offset],rax 870 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,0,offset,MOD_DISP32); 871 obp-=sizeof(long); 872 pobj_GlobalVarSchedule->add(); 873 obp+=sizeof(long); 870 compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,0,offset,MOD_DISP32, Schedule::GlobalVar ); 874 871 } 875 872 else{ … … 992 989 993 990 //mov rax,i64data 994 compiler.codeGenerator.op_mov 64_ToReg(REG_RAX,i64data);991 compiler.codeGenerator.op_mov_RV64(REG_RAX,i64data); 995 992 996 993 //mov qword ptr[rsp+offset],rax … … 1034 1031 if(i64data&0xFFFFFFFF00000000){ 1035 1032 //mov rax,i64data 1036 compiler.codeGenerator.op_mov 64_ToReg(REG_RAX,i64data);1033 compiler.codeGenerator.op_mov_RV64(REG_RAX,i64data); 1037 1034 1038 1035 //mov qword ptr[rsp+offset],rax … … 1116 1113 //アラインメントを考慮 1117 1114 if( pVar->GetType().IsStruct() ){ 1118 int alignment = pVar->GetType().GetClass(). iAlign;1115 int alignment = pVar->GetType().GetClass().GetFixedAlignment(); 1119 1116 1120 1117 if( alignment ){ … … 1222 1219 if(pRelativeVar->bOffsetOffset){ 1223 1220 //add r11,offset 1224 OpBuffer[obp++]=(char)0x49; 1225 OpBuffer[obp++]=(char)0x81; 1226 OpBuffer[obp++]=(char)0xC3; 1227 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 1228 pobj_GlobalVarSchedule->add(); 1229 obp+=sizeof(long); 1221 compiler.codeGenerator.op_add_RV( REG_R11, (long)pRelativeVar->offset, Schedule::GlobalVar ); 1230 1222 1231 1223 //mov reg,r11 … … 1234 1226 else{ 1235 1227 //mov reg,offset 1236 compiler.codeGenerator.op_mov64_ToReg(reg,(long)pRelativeVar->offset); 1237 obp-=sizeof(long); 1238 pobj_GlobalVarSchedule->add(); 1239 obp+=sizeof(long); 1228 compiler.codeGenerator.op_mov_RV( sizeof(_int64), reg, (long)pRelativeVar->offset, Schedule::GlobalVar ); 1240 1229 } 1241 1230 } … … 1243 1232 if(pRelativeVar->bOffsetOffset){ 1244 1233 //add r11,qword ptr[offset] 1245 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 1246 obp-=sizeof(long); 1247 pobj_GlobalVarSchedule->add(); 1248 obp+=sizeof(long); 1234 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelativeVar->offset, MOD_DISP32, Schedule::GlobalVar ); 1249 1235 } 1250 1236 else{ 1251 1237 //mov r11,qword ptr[offset] 1252 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 1253 obp-=sizeof(long); 1254 pobj_GlobalVarSchedule->add(); 1255 obp+=sizeof(long); 1238 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32, Schedule::GlobalVar ); 1256 1239 } 1257 1240 … … 1261 1244 if(pRelativeVar->bOffsetOffset){ 1262 1245 //add r11,offset 1263 OpBuffer[obp++]=(char)0x49; 1264 OpBuffer[obp++]=(char)0x81; 1265 OpBuffer[obp++]=(char)0xC3; 1266 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 1267 AddLocalVarAddrSchedule(); 1268 obp+=sizeof(long); 1246 compiler.codeGenerator.op_add_RV( REG_R11, (long)pRelativeVar->offset, Schedule::LocalVar ); 1269 1247 1270 1248 //add r11,rsp … … 1279 1257 1280 1258 //add reg,offset 1281 compiler.codeGenerator.op_add_RV(reg,(int)pRelativeVar->offset); 1282 obp-=sizeof(long); 1283 AddLocalVarAddrSchedule(); 1284 obp+=sizeof(long); 1259 compiler.codeGenerator.op_add_RV(reg,(long)pRelativeVar->offset, Schedule::LocalVar ); 1285 1260 } 1286 1261 } … … 1288 1263 if(pRelativeVar->bOffsetOffset){ 1289 1264 //add r11,qword ptr[rsp+offset] 1290 OpBuffer[obp++]=(char)0x4C; 1291 OpBuffer[obp++]=(char)0x03; 1292 OpBuffer[obp++]=(char)0x9C; 1293 OpBuffer[obp++]=(char)0x24; 1294 *((long *)(OpBuffer+obp))=(int)pRelativeVar->offset; 1295 AddLocalVarAddrSchedule(); 1296 obp+=sizeof(long); 1265 compiler.codeGenerator.op_add_RM( REG_R11, REG_RSP, (long)pRelativeVar->offset, MOD_BASE_DISP32, Schedule::LocalVar ); 1297 1266 } 1298 1267 else{ 1299 1268 //mov r11,qword ptr[rsp+offset] 1300 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 1301 obp-=sizeof(long); 1302 AddLocalVarAddrSchedule(); 1303 obp+=sizeof(long); 1269 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32, Schedule::LocalVar ); 1304 1270 } 1305 1271 … … 1331 1297 // ルートポインタを引き渡す 1332 1298 //mov rdx,offset 1333 compiler.codeGenerator.op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar->GetOffsetAddress()); 1334 obp-=sizeof(long); 1335 pobj_GlobalVarSchedule->add(); 1336 obp+=sizeof(long); 1299 compiler.codeGenerator.op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar->GetOffsetAddress(), Schedule::GlobalVar ); 1337 1300 1338 1301 // Thisポインタを引き渡す -
trunk/abdev/BasicCompiler64/NumOpe.cpp
r226 r232 971 971 if(XmmReg==REG_XMM4){ 972 972 //mov r14,i64data 973 compiler.codeGenerator.op_mov 64_ToReg(REG_R14,i64data);973 compiler.codeGenerator.op_mov_RV64(REG_R14,i64data); 974 974 975 975 … … 1026 1026 1027 1027 //mov reg,i64data 1028 compiler.codeGenerator.op_mov 64_ToReg(UseReg,i64data);1028 compiler.codeGenerator.op_mov_RV64(UseReg,i64data); 1029 1029 1030 1030 if(UseReg==REG_R14){ … … 1194 1194 1195 1195 //mov reg,i64data 1196 compiler.codeGenerator.op_mov 64_ToReg(UseReg,i64data);1196 compiler.codeGenerator.op_mov_RV64(UseReg,i64data); 1197 1197 } 1198 1198 -
trunk/abdev/BasicCompiler64/stack_frame.cpp
r228 r232 25 25 answer_sp=lowest_sp-max_parm_size; 26 26 27 if((localParamSize%0x10)){ 28 if((answer_sp%0x10)==0){ 29 //関数のエントリポイントで128ビット境界ラインに合わせるため 30 return -(answer_sp-0x08); 31 } 32 return -(answer_sp-0x10); 27 if(((answer_sp-localParamSize)%0x10)==0){ 28 //関数のエントリポイントで128ビット境界ラインに合わせるため 29 return -(answer_sp-0x08); 33 30 } 34 35 if((answer_sp%0x10)==0){ 36 //関数のエントリポイントで128ビット境界ラインに合わせるため 37 return -(answer_sp-0x10); 38 } 39 return -(answer_sp-0x08); 31 return -(answer_sp-0x10); 40 32 } 41 33 int CStackFrame::GetNowSp(){
Note:
See TracChangeset
for help on using the changeset viewer.