Changeset 251 in dev for trunk/abdev/BasicCompiler_Common
- Timestamp:
- Jul 30, 2007, 2:00:45 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h
r250 r251 255 255 void CheckUnresolveSchedule(); 256 256 257 void opfix( const PertialSchedule *pPertialSchedule, long newValue ); 257 258 void opfix_JmpPertialSchedule( const PertialSchedule *pPertialSchedule ); 258 259 … … 365 366 ///////////////////////////////////////////////////////////////// 366 367 private: 367 void set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp, Schedule::Type scheduleType = Schedule::None );368 const PertialSchedule *set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp, Schedule::Type scheduleType, bool isPertialSchedule ); 368 369 void __op_format(char op_prefix,char opcode,int reg); 369 void __op_format(char op_prefix,char opcode1,char opcode2,int reg,int base_reg,int offset,char mod, Schedule::Type scheduleType = Schedule::None );370 const PertialSchedule *__op_format(char op_prefix,char opcode1,char opcode2,int reg,int base_reg,int offset,char mod, Schedule::Type scheduleType = Schedule::None, bool isPertialSchedule = false ); 370 371 public: 371 372 void op_mov_MV ( int op_size, int base_reg, long offset, Schedule::Type offsetScheduleType, long value, Schedule::Type valueScheduleType = Schedule::None ); … … 409 410 void op_push_V( long data, Schedule::Type scheduleType = Schedule::None ); 410 411 void op_push_M( int base_reg ); 411 void op_push_M( int base_reg, long offset, Schedule::Type scheduleType = Schedule::None );412 const PertialSchedule *op_push_M( int base_reg, long offset, Schedule::Type scheduleType = Schedule::None, bool isPertialSchedule = false ); 412 413 void op_pop(int reg = REG_NON); 413 414 void op_add_esp(long num); -
trunk/abdev/BasicCompiler_Common/src/CommonCodeGenerator.cpp
r250 r251 27 27 } 28 28 29 30 // 分岐関連 31 void CodeGenerator::opfix_JmpPertialSchedule( const PertialSchedule *pPertialSchedule ) 29 void CodeGenerator::opfix( const PertialSchedule *pPertialSchedule, long newValue ) 32 30 { 33 31 bool isSuccessful = false; … … 38 36 if( (*it) == pPertialSchedule ) 39 37 { 40 long newValue = pNativeCode->GetSize() - (pPertialSchedule->GetCodePos()+pPertialSchedule->GetTypeSize());41 42 extern int obp;43 long newValueOld = obp - (pPertialSchedule->GetObpOld()+pPertialSchedule->GetTypeSize());44 45 38 if( pPertialSchedule->GetTypeSize() == sizeof(char) ) 46 39 { … … 54 47 55 48 // TODO: 未完成(用が無くなったら消す) 49 pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), (char)newValue ); 50 } 51 else if( pPertialSchedule->GetTypeSize() == sizeof(long) ) 52 { 53 pNativeCode->Overwrite( pPertialSchedule->GetCodePos(), newValue ); 54 55 // TODO: 未完成(用が無くなったら消す) 56 pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), newValue ); 57 } 58 else 59 { 60 SetError(); 61 } 62 63 it = pertialSchedules.erase( it ); 64 delete pPertialSchedule; 65 66 isSuccessful = true; 67 } 68 else 69 { 70 it++; 71 } 72 } 73 74 if( isSuccessful == false ) 75 { 76 SetError(); 77 } 78 } 79 80 81 // 分岐関連 82 void CodeGenerator::opfix_JmpPertialSchedule( const PertialSchedule *pPertialSchedule ) 83 { 84 bool isSuccessful = false; 85 86 PertialSchedules::iterator it = pertialSchedules.begin(); 87 while( it != pertialSchedules.end() ) 88 { 89 if( (*it) == pPertialSchedule ) 90 { 91 long newValue = pNativeCode->GetSize() - (pPertialSchedule->GetCodePos()+pPertialSchedule->GetTypeSize()); 92 93 extern int obp; 94 long newValueOld = obp - (pPertialSchedule->GetObpOld()+pPertialSchedule->GetTypeSize()); 95 96 if( pPertialSchedule->GetTypeSize() == sizeof(char) ) 97 { 98 if( newValue < -128 || 127 < newValue ) 99 { 100 // 範囲外 101 SetError(); 102 } 103 104 pNativeCode->Overwrite( pPertialSchedule->GetCodePos(), (char)newValue ); 105 106 // TODO: 未完成(用が無くなったら消す) 56 107 pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), (char)newValueOld ); 57 108 } … … 130 181 { 131 182 pertialSchedules.push_back( new PertialSchedule( pNativeCode->GetSize(), op_size ) ); 132 pPertialSchedule = pertialSchedules [pertialSchedules.size()-1];183 pPertialSchedule = pertialSchedules.back(); 133 184 } 134 185
Note:
See TracChangeset
for help on using the changeset viewer.