Changeset 255 in dev for trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
- Timestamp:
- Aug 1, 2007, 3:37:09 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
r254 r255 39 39 40 40 //sub rsp,スタックフレームサイズ 41 int StackFrameSchedule; 42 compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF); 43 StackFrameSchedule=obp-sizeof(long); 41 const PertialSchedule *pStackFramePertialSchedule = compiler.codeGenerator.op_sub_rsp( 0, true ); 44 42 45 43 extern BOOL bDebugCompile; … … 65 63 66 64 //スタックフレームスケジュール(subコマンドに渡す値) 67 *((long *)(OpBuffer+StackFrameSchedule))=pobj_sf->GetFrameSize(0);65 compiler.codeGenerator.opfix( pStackFramePertialSchedule, pobj_sf->GetFrameSize(0) ); 68 66 69 67 UserProc::CompileStartForUserProc( pBackUserProc ); … … 77 75 78 76 //sub rsp,スタックフレームサイズ 79 int StackFrameSchedule; 80 compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF); 81 StackFrameSchedule=obp-sizeof(long); 77 const PertialSchedule *pStackFramePertialSchedule = compiler.codeGenerator.op_sub_rsp( 0, true ); 82 78 83 79 BOOST_FOREACH( Variable *pVar, compiler.GetMeta().GetGlobalVars() ){ … … 102 98 103 99 //スタックフレームスケジュール(subコマンドに渡す値) 104 *((long *)(OpBuffer+StackFrameSchedule))=pobj_sf->GetFrameSize(0);100 compiler.codeGenerator.opfix( pStackFramePertialSchedule, pobj_sf->GetFrameSize(0) ); 105 101 106 102 //ret … … 135 131 //ret 136 132 compiler.codeGenerator.op_ret(); 137 }138 else if( userProc.GetName() == "_allrem" ){139 //乗除演算用の特殊関数(64ビット整数対応)140 BYTE Buffer_allrem[]={141 0x53,0x57,0x33,0xFF,0x8B,0x44,0x24,0x10,0x0B,0xC0,0x7D,0x14,0x47,0x8B,0x54,0x24,0x0C,0xF7,0xD8,0xF7,0xDA,0x83,0xD8,0x00,0x89,0x44,0x24,0x10,0x89,0x54,0x24,0x0C,0x8B,0x44,0x24,0x18,0x0B,0xC0,0x7D,0x13,0x8B,0x54,0x24,0x14,0xF7,0xD8,0xF7,0xDA,0x83,0xD8,0x00,0x89,0x44,0x24,0x18,0x89,0x54,0x24,0x14,0x0B,0xC0,0x75,0x1B,0x8B,0x4C,0x24,0x14,0x8B,0x44,0x24,0x10,0x33,0xD2,0xF7,0xF1,0x8B,0x44,0x24,0x0C,0xF7,0xF1,0x8B,0xC2,0x33,0xD2,0x4F,0x79,0x4E,0xEB,0x53,0x8B,0xD8,0x8B,0x4C,0x24,0x14,0x8B,0x54,0x24,0x10,0x8B,0x44,0x24,0x0C,0xD1,0xEB,0xD1,0xD9,0xD1,0xEA,0xD1,0xD8,0x0B,0xDB,0x75,0xF4,0xF7,0xF1,0x8B,0xC8,0xF7,0x64,0x24,0x18,0x91,0xF7,0x64,0x24,0x14,0x03,0xD1,0x72,0x0E,0x3B,0x54,0x24,0x10,0x77,0x08,0x72,0x0E,0x3B,0x44,0x24,0x0C,0x76,0x08,0x2B,0x44,0x24,0x14,0x1B,0x54,0x24,0x18,0x2B,0x44,0x24,0x0C,0x1B,0x54,0x24,0x10,0x4F,0x79,0x07,0xF7,0xDA,0xF7,0xD8,0x83,0xDA,0x00,0x5F,0x5B,0xC2,0x10,0x00142 };143 144 memcpy(OpBuffer+obp,Buffer_allrem,178);145 obp+=178;146 }147 else if( userProc.GetName() == "_allmul" ){148 //乗算用の特殊関数(64ビット整数対応)149 BYTE Buffer_allmul[]={150 0x8B,0x44,0x24,0x08,0x8B,0x4C,0x24,0x10,0x0B,0xC8,0x8B,0x4C,0x24,0x0C,0x75,0x09,0x8B,0x44,0x24,0x04,0xF7,0xE1,0xC2,0x10,0x00,0x53,0xF7,0xE1,0x8B,0xD8,0x8B,0x44,0x24,0x08,0xF7,0x64,0x24,0x14,0x03,0xD8,0x8B,0x44,0x24,0x08,0xF7,0xE1,0x03,0xD3,0x5B,0xC2,0x10,0x00151 };152 153 memcpy(OpBuffer+obp,Buffer_allmul,52);154 obp+=52;155 }156 else if( userProc.GetName() == "_alldiv" ){157 //除算用の特殊関数(64ビット整数対応)158 BYTE Buffer_alldiv[]={159 0x57,0x56,0x53,0x33,0xFF,0x8B,0x44,0x24,0x14,0x0B,0xC0,0x7D,0x14,0x47,0x8B,0x54,0x24,0x10,0xF7,0xD8,0xF7,0xDA,0x83,0xD8,0x00,0x89,0x44,0x24,0x14,0x89,0x54,0x24,0x10,0x8B,0x44,0x24,0x1C,0x0B,0xC0,0x7D,0x14,0x47,0x8B,0x54,0x24,0x18,0xF7,0xD8,0xF7,0xDA,0x83,0xD8,0x00,0x89,0x44,0x24,0x1C,0x89,0x54,0x24,0x18,0x0B,0xC0,0x75,0x18,0x8B,0x4C,0x24,0x18,0x8B,0x44,0x24,0x14,0x33,0xD2,0xF7,0xF1,0x8B,0xD8,0x8B,0x44,0x24,0x10,0xF7,0xF1,0x8B,0xD3,0xEB,0x41,0x8B,0xD8,0x8B,0x4C,0x24,0x18,0x8B,0x54,0x24,0x14,0x8B,0x44,0x24,0x10,0xD1,0xEB,0xD1,0xD9,0xD1,0xEA,0xD1,0xD8,0x0B,0xDB,0x75,0xF4,0xF7,0xF1,0x8B,0xF0,0xF7,0x64,0x24,0x1C,0x8B,0xC8,0x8B,0x44,0x24,0x18,0xF7,0xE6,0x03,0xD1,0x72,0x0E,0x3B,0x54,0x24,0x14,0x77,0x08,0x72,0x07,0x3B,0x44,0x24,0x10,0x76,0x01,0x4E,0x33,0xD2,0x8B,0xC6,0x4F,0x75,0x07,0xF7,0xDA,0xF7,0xD8,0x83,0xDA,0x00,0x5B,0x5E,0x5F,0xC2,0x10,0x00160 };161 162 memcpy(OpBuffer+obp,Buffer_alldiv,170);163 obp+=170;164 }165 else if( userProc.GetName() == "_allshl" ){166 //符号あり左ビットシフト用の特殊関数(64ビット整数対応)167 BYTE Buffer_allshl[]={168 0x80,0xF9,0x40,0x73,0x15,0x80,0xF9,0x20,0x73,0x06,0x0F,0xA5,0xC2,0xD3,0xE0,0xC3,0x8B,0xD0,0x33,0xC0,0x80,0xE1,0x1F,0xD3,0xE2,0xC3,0x33,0xC0,0x33,0xD2,0xC3169 };170 171 memcpy(OpBuffer+obp,Buffer_allshl,31);172 obp+=31;173 }174 else if( userProc.GetName() == "_allshr" ){175 //符号あり右ビットシフト用の特殊関数(64ビット整数対応)176 BYTE Buffer_allshr[]={177 0x80,0xF9,0x40,0x73,0x16,0x80,0xF9,0x20,0x73,0x06,0x0F,0xAD,0xD0,0xD3,0xFA,0xC3,0x8B,0xC2,0xC1,0xFA,0x1F,0x80,0xE1,0x1F,0xD3,0xF8,0xC3,0xC1,0xFA,0x1F,0x8B,0xC2,0xC3178 };179 180 memcpy(OpBuffer+obp,Buffer_allshr,33);181 obp+=33;182 }183 else if( userProc.GetName() == "_aullshr" ){184 //符号なし右ビットシフト用の特殊関数(64ビット整数対応)185 BYTE Buffer_aullshr[]={186 0x80,0xF9,0x40, //cmp cl,40h187 0x73,0x15, //jae RETZERO (0040d71a)188 0x80,0xF9,0x20, //cmp cl,20h189 0x73,0x06, //jae MORE32 (0040d710)190 0x0F,0xAD,0xD0, //shrd eax,edx,cl191 0xD3,0xEA, //shr edx,cl192 0xC3, //ret193 //MORE32:194 0x8B,0xC2, //mov eax,edx195 0x33,0xD2, //xor edx,edx196 0x80,0xE1,0x1F, //and cl,1Fh197 0xD3,0xE8, //shr eax,cl198 0xC3, //ret199 //RETZERO:200 0x33,0xC0, //xor eax,eax201 0x33,0xD2, //xor edx,edx202 0xC3 //ret203 };204 205 memcpy(OpBuffer+obp,Buffer_aullshr,31);206 obp+=31;207 133 } 208 134 else{ … … 441 367 442 368 //sub rsp,スタックフレームサイズ 443 int StackFrameSchedule; 444 compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF); 445 StackFrameSchedule=obp-sizeof(long); 369 const PertialSchedule *pStackFramePertialSchedule = compiler.codeGenerator.op_sub_rsp( 0, true ); 446 370 447 371 //mov qword ptr[rsp+offset],reg ※スタックフレームを利用 … … 482 406 } 483 407 484 int RspOffsetSchedule=0;485 int RspOffsetSchedule2;408 const PertialSchedule *pRspOffsetPertialSchedule1 = NULL; 409 const PertialSchedule *pRspOffsetPertialSchedule2 = NULL; 486 410 if(bDebugCompile&&bDebugSupportProc==0){ 487 411 //mov rdx, qword ptr[rsp+スタックフレームサイズ] 488 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RDX,REG_RSP,0,MOD_BASE_DISP32); 489 RspOffsetSchedule=obp-sizeof(long); 412 pRspOffsetPertialSchedule1 = compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RDX,REG_RSP,0,MOD_BASE_DISP32, Schedule::None, true ); 490 413 491 414 //mov rcx,rsp … … 493 416 494 417 //add rcx,スタックフレームサイズ+sizeof(_int64) ※ret用のサイズを考慮 495 compiler.codeGenerator.op_add_RV(REG_RCX,0); 496 RspOffsetSchedule2=obp-sizeof(long); 418 pRspOffsetPertialSchedule2 = compiler.codeGenerator.op_add_RV(REG_RCX,0, Schedule::None, true ); 497 419 498 420 //call _DebugSys_StartProc … … 713 635 BOOST_FOREACH( const PertialSchedule *pPertialSchedule, compiler.codeGenerator.localVarPertialSchedules ) 714 636 { 715 compiler.codeGenerator.opfix_offset( pPertialSchedule, AllLocalVarSize );637 compiler.codeGenerator.opfix_offset( pPertialSchedule, AllLocalVarSize + stackFrameSize ); 716 638 } 717 639 compiler.codeGenerator.localVarPertialSchedules.clear(); … … 742 664 743 665 //デバッグ用 744 if( RspOffsetSchedule){745 *((long *)(OpBuffer+RspOffsetSchedule))=stackFrameAndLocalParamSize;746 *((long *)(OpBuffer+RspOffsetSchedule2))=stackFrameAndLocalParamSize+sizeof(_int64);666 if( pRspOffsetPertialSchedule1 ){ 667 compiler.codeGenerator.opfix( pRspOffsetPertialSchedule1, stackFrameAndLocalParamSize ); 668 compiler.codeGenerator.opfix( pRspOffsetPertialSchedule2, stackFrameAndLocalParamSize + sizeof(_int64) ); 747 669 } 748 670 749 671 750 672 //スタックフレームスケジュール(subコマンド) 751 *((long *)(OpBuffer+StackFrameSchedule))=stackFrameAndLocalParamSize;673 compiler.codeGenerator.opfix( pStackFramePertialSchedule, stackFrameAndLocalParamSize ); 752 674 753 675 //スタックフレームスケジュールを実行
Note:
See TracChangeset
for help on using the changeset viewer.