Changeset 66 in dev for BasicCompiler64
- Timestamp:
- Mar 9, 2007, 4:59:13 AM (18 years ago)
- Location:
- BasicCompiler64
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler64/CParameter.cpp
r64 r66 62 62 int type = NumOpe( ®, Parms[i2], DummyTypeInfo.type, DummyTypeInfo.u.lpIndex, &lpVarIndex ); 63 63 64 if( type == DEF_OBJECT ){64 if( type != DEF_STRUCT ){ 65 65 //一時参照を作成 66 66 pobj_sf->push( reg ); … … 115 115 op_call(pSub_free); 116 116 } 117 else if( types[i2].type == DEF_OBJECT ){117 else{ 118 118 pobj_sf->pop(); 119 119 pobj_sf->pop(); 120 }121 else{122 SetError(300,NULL,cp);123 120 } 124 121 } … … 423 420 } 424 421 else{ 425 //変数のアドレスを取得 426 int VarType; 427 LONG_PTR lpVarIndex; 428 if(GetVarOffset( 429 false, 430 false, 431 Parms[i2], 432 &VarType, 433 &RelativeVar, 434 &lpVarIndex)){ 435 436 if(DummyTypeInfo.type!=DEF_ANY){ 437 //型チェックを行う 438 if(DummyTypeInfo.type==VarType){ 439 if(DummyTypeInfo.type==DEF_OBJECT){ 440 if( !DummyTypeInfo.u.pobj_Class->IsEqualsOrSubClass( (CClass *)lpVarIndex ) ){ 441 SetError(11,Parms[i2],cp); 422 if( useTempParameters[i2] ){ 423 //一時オブジェクトをコピー 424 425 //mov reg, qword ptr[rsp+offset] 426 pobj_sf->ref_offset_data( reg, StackOffsetOfTempObject[i2] ); 427 } 428 else{ 429 //変数のアドレスを取得 430 int VarType; 431 LONG_PTR lpVarIndex; 432 if(GetVarOffset( 433 false, 434 false, 435 Parms[i2], 436 &VarType, 437 &RelativeVar, 438 &lpVarIndex)){ 439 440 if(DummyTypeInfo.type!=DEF_ANY){ 441 //型チェックを行う 442 if(DummyTypeInfo.type==VarType){ 443 if(DummyTypeInfo.type==DEF_OBJECT){ 444 if( !DummyTypeInfo.u.pobj_Class->IsEqualsOrSubClass( (CClass *)lpVarIndex ) ){ 445 SetError(11,Parms[i2],cp); 446 } 447 } 448 else if(DummyTypeInfo.type==DEF_STRUCT){ 449 if( !DummyTypeInfo.u.pobj_Class->IsEquals( (CClass *)lpVarIndex ) ){ 450 SetError(11,Parms[i2],cp); 451 } 442 452 } 443 453 } 444 else if(DummyTypeInfo.type==DEF_STRUCT){ 445 if( !DummyTypeInfo.u.pobj_Class->IsEquals( (CClass *)lpVarIndex ) ){ 446 SetError(11,Parms[i2],cp); 447 } 454 else if((VarType&FLAG_PTR)&&((VarType^FLAG_PTR)==DummyTypeInfo.type)){ 455 //仮引数がポインタ参照で、実引数が配列の先頭ポインタのとき 456 } 457 else{ 458 SetError(11,Parms[i2],cp); 448 459 } 449 460 } 450 else if((VarType&FLAG_PTR)&&((VarType^FLAG_PTR)==DummyTypeInfo.type)){ 451 //仮引数がポインタ参照で、実引数が配列の先頭ポインタのとき 452 } 453 else{ 454 SetError(11,Parms[i2],cp); 455 } 456 } 457 458 //変数アドレスをレジスタにセット 459 SetVarPtrToReg(reg,&RelativeVar); 460 461 } 462 else{ 463 //一時オブジェクトをコピー 464 465 //mov reg, qword ptr[rsp+offset] 466 pobj_sf->ref_offset_data( reg, StackOffsetOfTempObject[i2] ); 467 468 //VarType = NumOpe( ®, Parms[i2], DummyTypeInfo.type, DummyTypeInfo.u.lpIndex, &lpVarIndex ); 461 462 //変数アドレスをレジスタにセット 463 SetVarPtrToReg(reg,&RelativeVar); 464 465 } 469 466 } 470 467 } -
BasicCompiler64/Compile_Calc_PushVar.cpp
r62 r66 174 174 175 175 void SetReg_WholeVariable(int type,RELATIVE_VAR *pRelativeVar,int reg){ 176 int var _size;177 178 var _size=GetTypeSize(type,-1);176 int varSize; 177 178 varSize=GetTypeSize(type,-1); 179 179 180 180 if(pRelativeVar->dwKind==VAR_GLOBAL){ 181 181 if(pRelativeVar->bOffsetOffset){ 182 182 //mov reg, ptr[r11+offset] 183 op_mov_RM(var _size,reg,REG_R11,(int)pRelativeVar->offset,MOD_BASE_DISP32);183 op_mov_RM(varSize,reg,REG_R11,(int)pRelativeVar->offset,MOD_BASE_DISP32); 184 184 obp-=sizeof(long); 185 185 pobj_GlobalVarSchedule->add(); … … 188 188 else{ 189 189 //mov reg, ptr[offset] 190 op_mov_RM(var _size,reg,0,(int)pRelativeVar->offset,MOD_DISP32);190 op_mov_RM(varSize,reg,0,(int)pRelativeVar->offset,MOD_DISP32); 191 191 obp-=sizeof(long); 192 192 pobj_GlobalVarSchedule->add(); … … 215 215 if(pRelativeVar->bOffsetOffset){ 216 216 //mov reg, ptr[rsp+r11+offset] 217 op_mov_RM_ex(var _size,reg,REG_RSP,REG_R11,(int)pRelativeVar->offset,USE_OFFSET);217 op_mov_RM_ex(varSize,reg,REG_RSP,REG_R11,(int)pRelativeVar->offset,USE_OFFSET); 218 218 obp-=sizeof(long); 219 219 AddLocalVarAddrSchedule(); … … 222 222 else{ 223 223 //mov reg, ptr[rsp+offset] 224 op_mov_RM(var _size,reg,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);224 op_mov_RM(varSize,reg,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 225 225 obp-=sizeof(long); 226 226 AddLocalVarAddrSchedule(); … … 249 249 directmem: 250 250 //mov reg, ptr[r11] 251 op_mov_RM(var _size,reg,REG_R11,0,MOD_BASE);251 op_mov_RM(varSize,reg,REG_R11,0,MOD_BASE); 252 252 } 253 253 } -
BasicCompiler64/Compile_Set_Var.cpp
r64 r66 333 333 SetWholeVariable( sizeof(char), DEF_BYTE, pRelative); 334 334 } 335 void SetWholeVariable(int var _size,int type,RELATIVE_VAR *pRelative){335 void SetWholeVariable(int varSize,int type,RELATIVE_VAR *pRelative){ 336 336 if(type==DEF_DOUBLE){ 337 337 //Double型 … … 349 349 //その他の整数 350 350 351 if(var _size==sizeof(_int64)){351 if(varSize==sizeof(_int64)){ 352 352 //レジスタの値を64ビット(rax)に拡張する 353 353 ExtendTypeTo64(type,REG_RAX); 354 354 } 355 else if(var _size==sizeof(long)){355 else if(varSize==sizeof(long)){ 356 356 //レジスタの値を32ビット(eax)に拡張する 357 357 ExtendTypeTo32(type,REG_RAX); 358 358 } 359 else if(var _size==sizeof(short)){359 else if(varSize==sizeof(short)){ 360 360 //レジスタの値を16ビット(ax)に拡張する 361 361 ExtendTypeTo16(type,REG_RAX); … … 367 367 if(pRelative->bOffsetOffset){ 368 368 //mov ptr[r11+offset],rax/eax/ax/al 369 op_mov_MR(var _size,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32);369 op_mov_MR(varSize,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32); 370 370 obp-=sizeof(long); 371 371 pobj_GlobalVarSchedule->add(); … … 374 374 else{ 375 375 //mov ptr[offset],rax/eax/ax/al 376 op_mov_MR(var _size,REG_RAX,0,(int)pRelative->offset,MOD_DISP32);376 op_mov_MR(varSize,REG_RAX,0,(int)pRelative->offset,MOD_DISP32); 377 377 obp-=sizeof(long); 378 378 pobj_GlobalVarSchedule->add(); … … 401 401 if(pRelative->bOffsetOffset){ 402 402 //mov ptr[rsp+r11+offset],rax/eax/ax/al 403 op_mov_MR_ex(var _size,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET);403 op_mov_MR_ex(varSize,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET); 404 404 obp-=sizeof(long); 405 405 AddLocalVarAddrSchedule(); … … 408 408 else{ 409 409 //mov ptr[rsp+offset],rax/eax/ax/al 410 op_mov_MR(var _size,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);410 op_mov_MR(varSize,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 411 411 obp-=sizeof(long); 412 412 AddLocalVarAddrSchedule(); … … 436 436 437 437 //mov ptr[r11],rax/eax/ax/al 438 op_mov_MR(var _size,REG_RAX,REG_R11,0,MOD_BASE);439 } 440 } 438 op_mov_MR(varSize,REG_RAX,REG_R11,0,MOD_BASE); 439 } 440 } -
BasicCompiler64/Opcode.h
r64 r66 128 128 void mov_sp( int reg ); 129 129 int push(int reg); 130 void push(int xmm_reg,int var _size);130 void push(int xmm_reg,int varSize); 131 131 void ref_offset_data( int reg, int sp_offset ); 132 132 void ref(int reg); 133 void ref(int xmm_reg,int var _size);133 void ref(int xmm_reg,int varSize); 134 134 void pop(int reg = REG_NON); 135 void pop(int xmm_reg,int var _size);135 void pop(int xmm_reg,int varSize); 136 136 void parameter_allocate(int size); 137 137 void RunningSchedule(void); … … 289 289 void SetRealVariable(int VarType, int CalcType, RELATIVE_VAR *pRelativeVar); 290 290 void SetBooleanVariable(int type,RELATIVE_VAR *pRelative); 291 void SetWholeVariable(int var _size,int type,RELATIVE_VAR *pRelative);291 void SetWholeVariable(int varSize,int type,RELATIVE_VAR *pRelative); 292 292 293 293 //increment.cpp -
BasicCompiler64/stack_frame.cpp
r64 r66 70 70 return now_sp; 71 71 } 72 void CStackFrame::push(int xmm_reg,int var _size){72 void CStackFrame::push(int xmm_reg,int varSize){ 73 73 now_sp-=sizeof(_int64); 74 74 if(lowest_sp>now_sp) lowest_sp=now_sp; 75 75 76 if(var _size==sizeof(double)){76 if(varSize==sizeof(double)){ 77 77 //movlpd qword ptr[rsp+offset],xmm_reg 78 78 op_movlpd_MR(xmm_reg,REG_RSP,now_sp,MOD_BASE_DISP32); 79 79 } 80 if(var _size==sizeof(float)){80 if(varSize==sizeof(float)){ 81 81 //movss dword ptr[rsp+offset],xmm_reg 82 82 OpBuffer[obp++]=(char)0xF3; … … 106 106 ref_offset_data( reg, now_sp ); 107 107 } 108 void CStackFrame::ref(int xmm_reg,int var _size){109 if(var _size==sizeof(double)){108 void CStackFrame::ref(int xmm_reg,int varSize){ 109 if(varSize==sizeof(double)){ 110 110 //movlpd xmm_reg,qword ptr[rsp+offset] 111 111 op_movlpd_RM(xmm_reg,REG_RSP,now_sp,MOD_BASE_DISP32); 112 112 } 113 if(var _size==sizeof(float)){113 if(varSize==sizeof(float)){ 114 114 //movss xmm_reg,dword ptr[rsp+offset] 115 115 OpBuffer[obp++]=(char)0xF3; … … 132 132 now_sp+=sizeof(_int64); 133 133 } 134 void CStackFrame::pop(int xmm_reg,int var _size){135 ref(xmm_reg,var _size);134 void CStackFrame::pop(int xmm_reg,int varSize){ 135 ref(xmm_reg,varSize); 136 136 137 137 now_sp+=sizeof(_int64);
Note:
See TracChangeset
for help on using the changeset viewer.