Changeset 226 in dev for trunk/abdev/BasicCompiler64/Compile_Set_Var.cpp
- Timestamp:
- Jul 22, 2007, 4:58:47 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/Compile_Set_Var.cpp
r206 r226 1 1 #include "stdafx.h" 2 3 #include <Compiler.h> 2 4 3 5 #include "../BasicCompiler_Common/common.h" … … 24 26 if( calcType.IsDouble() ){ 25 27 //movlsd RightTermReg,xmm0 26 op_movsd_RR(RightTermReg,REG_XMM0);28 compiler.codeGenerator.op_movsd_RR(RightTermReg,REG_XMM0); 27 29 } 28 30 else if( calcType.IsSingle() ){ 29 31 //movlss RightTermReg,xmm0 30 op_movss_RR(RightTermReg,REG_XMM0);32 compiler.codeGenerator.op_movss_RR(RightTermReg,REG_XMM0); 31 33 } 32 34 } … … 35 37 36 38 //mov RightTermReg,rax 37 op_mov_RR(RightTermReg,REG_RAX);39 compiler.codeGenerator.op_mov_RR(RightTermReg,REG_RAX); 38 40 } 39 41 … … 57 59 58 60 //mov rsi,RightTermReg 59 op_mov_RR(REG_RSI,RightTermReg);61 compiler.codeGenerator.op_mov_RR(REG_RSI,RightTermReg); 60 62 61 63 //mov rdi,VarReg 62 op_mov_RR(REG_RDI,VarReg);64 compiler.codeGenerator.op_mov_RR(REG_RDI,VarReg); 63 65 64 66 int object_size = varType.GetClass().GetSize(); 65 67 66 68 //mov rcx,object_size 67 op_mov_RV(sizeof(_int64),REG_RCX,object_size);69 compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RCX,object_size); 68 70 69 71 if(bUseHeap){ 70 72 //mov rax,rsi 71 op_mov_RR(REG_RAX,REG_RSI);73 compiler.codeGenerator.op_mov_RR(REG_RAX,REG_RSI); 72 74 } 73 75 74 76 //rep movs byte ptr[rdi],byte ptr[rsi] 75 op_rep_movs(sizeof(BYTE));77 compiler.codeGenerator.op_rep_movs(sizeof(BYTE)); 76 78 77 79 if(bUseHeap){ 78 80 //mov rcx,rax 79 op_mov_RR(REG_RCX,REG_RAX);81 compiler.codeGenerator.op_mov_RR(REG_RCX,REG_RAX); 80 82 81 83 //call free 82 84 extern const UserProc *pSub_free; 83 op_call(pSub_free);85 compiler.codeGenerator.op_call(pSub_free); 84 86 } 85 87 … … 165 167 else{ 166 168 //mov r11,qword ptr[rsp+offset] 167 op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);169 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 168 170 obp-=sizeof(long); 169 171 AddLocalVarAddrSchedule(); … … 256 258 else{ 257 259 //mov r11,qword ptr[rsp+offset] 258 op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);260 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 259 261 obp-=sizeof(long); 260 262 AddLocalVarAddrSchedule(); … … 289 291 290 292 //cvttsd2si rax,xmm0 291 op_cvttsd2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);293 compiler.codeGenerator.op_cvttsd2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0); 292 294 } 293 295 else if(type==DEF_SINGLE){ … … 295 297 296 298 //cvttss2si rax,xmm0 297 op_cvttss2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);299 compiler.codeGenerator.op_cvttss2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0); 298 300 } 299 301 300 302 //cmp rax,0 301 op_cmp_value(GetTypeSize(type,-1),REG_RAX,0);303 compiler.codeGenerator.op_cmp_value(GetTypeSize(type,-1),REG_RAX,0); 302 304 303 305 //setne al 304 op_setne( REG_RAX );306 compiler.codeGenerator.op_setne( REG_RAX ); 305 307 306 308 SetWholeVariable( sizeof(char), DEF_BYTE, pRelative); … … 311 313 312 314 //cvttsd2si rax,xmm0 313 op_cvttsd2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);315 compiler.codeGenerator.op_cvttsd2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0); 314 316 } 315 317 else if(type==DEF_SINGLE){ … … 317 319 318 320 //cvttss2si rax,xmm0 319 op_cvttss2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);321 compiler.codeGenerator.op_cvttss2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0); 320 322 } 321 323 else{ … … 340 342 if(pRelative->bOffsetOffset){ 341 343 //mov ptr[r11+offset],rax/eax/ax/al 342 op_mov_MR(varSize,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32);344 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32); 343 345 obp-=sizeof(long); 344 346 pobj_GlobalVarSchedule->add(); … … 347 349 else{ 348 350 //mov ptr[offset],rax/eax/ax/al 349 op_mov_MR(varSize,REG_RAX,0,(int)pRelative->offset,MOD_DISP32);351 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,0,(int)pRelative->offset,MOD_DISP32); 350 352 obp-=sizeof(long); 351 353 pobj_GlobalVarSchedule->add(); … … 356 358 if(pRelative->bOffsetOffset){ 357 359 //add r11,qword ptr[offset] 358 op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelative->offset, MOD_DISP32 );360 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelative->offset, MOD_DISP32 ); 359 361 obp-=sizeof(long); 360 362 pobj_GlobalVarSchedule->add(); … … 363 365 else{ 364 366 //mov r11,qword ptr[offset] 365 op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelative->offset,MOD_DISP32);367 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelative->offset,MOD_DISP32); 366 368 obp-=sizeof(long); 367 369 pobj_GlobalVarSchedule->add(); … … 374 376 if(pRelative->bOffsetOffset){ 375 377 //mov ptr[rsp+r11+offset],rax/eax/ax/al 376 op_mov_MR_ex(varSize,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET);378 compiler.codeGenerator.op_mov_MR_ex(varSize,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET); 377 379 obp-=sizeof(long); 378 380 AddLocalVarAddrSchedule(); … … 381 383 else{ 382 384 //mov ptr[rsp+offset],rax/eax/ax/al 383 op_mov_MR(varSize,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);385 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 384 386 obp-=sizeof(long); 385 387 AddLocalVarAddrSchedule(); … … 390 392 if(pRelative->bOffsetOffset){ 391 393 //add r11,qword ptr[rsp+offset] 392 op_add_RM( sizeof(_int64), REG_R11, REG_RSP, (int)pRelative->offset, MOD_BASE_DISP32 );394 compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_RSP, (int)pRelative->offset, MOD_BASE_DISP32 ); 393 395 obp-=sizeof(long); 394 396 AddLocalVarAddrSchedule(); … … 397 399 else{ 398 400 //mov r11,qword ptr[rsp+offset] 399 op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);401 compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 400 402 obp-=sizeof(long); 401 403 AddLocalVarAddrSchedule(); … … 409 411 410 412 //mov ptr[r11],rax/eax/ax/al 411 op_mov_MR(varSize,REG_RAX,REG_R11,0,MOD_BASE);412 } 413 } 413 compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_R11,0,MOD_BASE); 414 } 415 }
Note:
See TracChangeset
for help on using the changeset viewer.