Changeset 253 in dev for trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
- Timestamp:
- Jul 30, 2007, 4:12:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
r252 r253 236 236 extern HANDLE hHeap; 237 237 extern BOOL bDebugCompile; 238 int i3,i4, LocalVarSchedule,BaseOffset;238 int i3,i4,BaseOffset; 239 239 char temporary[VN_SIZE]; 240 240 … … 263 263 else bDebugSupportProc=0; 264 264 265 extern int obp; 265 266 pUserProc->SetBeginOpAddress( obp ); 266 267 … … 306 307 extern int AllLocalVarSize; 307 308 AllLocalVarSize=0; 308 309 //ローカル変数アドレススケジュール310 extern DWORD *pLocalVarAddrSchedule;311 extern int LocalVarAddrScheduleNum;312 pLocalVarAddrSchedule=(DWORD *)HeapAlloc(hHeap,0,1);313 LocalVarAddrScheduleNum=0;314 309 315 310 //パラメータ用の変数データを考慮 … … 362 357 363 358 //sub esp,AllLocalVarSize(スケジュール) 364 compiler.codeGenerator.op_sub_esp(0xFFFFFFFF); 365 LocalVarSchedule=obp-sizeof(long); 359 const PertialSchedule *pAllLocalVarPertialSchedule = compiler.codeGenerator.op_sub_esp( 0, true ); 366 360 367 361 //push ebp … … 641 635 { 642 636 //fld qword ptr[ebp+offset] 643 compiler.codeGenerator.op_fld_base_offset( i3, REG_EBP, RelativeVar.offset, Schedule::LocalVar ); 637 compiler.codeGenerator.localVarPertialSchedules.push_back( 638 compiler.codeGenerator.op_fld_base_offset( i3, REG_EBP, RelativeVar.offset, Schedule::None, true ) 639 ); 644 640 } 645 641 else if(i3==DEF_INT64||i3==DEF_QWORD){ 646 642 //mov eax,dword ptr[ebp+offset] 647 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar ); 643 compiler.codeGenerator.localVarPertialSchedules.push_back( 644 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true ) 645 ); 648 646 649 647 //mov edx,dword ptr[ebp+offset+sizeof(long)] 650 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EBP, RelativeVar.offset+sizeof(long), MOD_BASE_DISP32, Schedule::LocalVar ); 648 compiler.codeGenerator.localVarPertialSchedules.push_back( 649 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EBP, RelativeVar.offset+sizeof(long), MOD_BASE_DISP32, Schedule::None, true ) 650 ); 651 651 } 652 652 else if(i3==DEF_LONG||i3==DEF_DWORD|| 653 IsPtrType(i3)){ 653 IsPtrType(i3)) 654 { 654 655 //mov eax,dword ptr[ebp+offset] 655 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar ); 656 compiler.codeGenerator.localVarPertialSchedules.push_back( 657 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true ) 658 ); 656 659 } 657 660 else if(i3==DEF_INTEGER||i3==DEF_WORD || (Smoothie::IsUnicode()&&i3==DEF_CHAR)){ … … 660 663 661 664 //mov ax,word ptr[ebp+offset] 662 compiler.codeGenerator.op_mov_RM( sizeof(short), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar ); 665 compiler.codeGenerator.localVarPertialSchedules.push_back( 666 compiler.codeGenerator.op_mov_RM( sizeof(short), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true ) 667 ); 663 668 } 664 669 else if(i3==DEF_SBYTE||i3==DEF_BYTE||i3==DEF_BOOLEAN || (Smoothie::IsUnicode()==false&&i3==DEF_CHAR)){ … … 667 672 668 673 //mov al,byte ptr[ebp+offset] 669 compiler.codeGenerator.op_mov_RM( sizeof(char), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::LocalVar ); 674 compiler.codeGenerator.localVarPertialSchedules.push_back( 675 compiler.codeGenerator.op_mov_RM( sizeof(char), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true ) 676 ); 670 677 } 671 678 } 672 679 673 680 //ローカル変数アドレススケジュール 674 for(i3=0;i3<LocalVarAddrScheduleNum;i3++){ 675 *((long *)(OpBuffer+pLocalVarAddrSchedule[i3]))+=AllLocalVarSize; 676 } 677 HeapDefaultFree(pLocalVarAddrSchedule); 681 BOOST_FOREACH( const PertialSchedule *pPertialSchedule, compiler.codeGenerator.localVarPertialSchedules ) 682 { 683 compiler.codeGenerator.opfix_offset( pPertialSchedule, AllLocalVarSize ); 684 } 685 compiler.codeGenerator.localVarPertialSchedules.clear(); 678 686 BOOST_FOREACH( Variable *pVar, pUserProc->GetLocalVars() ){ 679 687 //後にデバッグで利用する … … 685 693 686 694 //ローカル変数用メモリを確保するためのスケジュール(subコマンド) 687 *((long *)(OpBuffer+LocalVarSchedule))=AllLocalVarSize-BaseOffset;695 compiler.codeGenerator.opfix( pAllLocalVarPertialSchedule, AllLocalVarSize - BaseOffset ); 688 696 689 697 //pop edi
Note:
See TracChangeset
for help on using the changeset viewer.