Ignore:
Timestamp:
Apr 16, 2007, 3:52:40 AM (17 years ago)
Author:
dai_9181
Message:

関数の戻り値オブジェクトのメンバ・メソッドを一時オブジェクトを介さずに参照できるようにした。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/Compile_Calc_PushVar.cpp

    r66 r97  
    6565    }
    6666}
    67 void SetReg_WholeVariable(int type,RELATIVE_VAR *pRelativeVar,int reg){
     67void SetReg_WholeVariable(int type,RELATIVE_VAR *pRelativeVar,int reg, bool is64Head){
    6868    int varSize;
    6969
     
    8181
    8282        //上位32ビットをedxにロード
    83         pRelativeVar->offset+=sizeof(long);
    84         SetReg_WholeVariable(DEF_LONG,pRelativeVar,REG_EDX);
    85         pRelativeVar->offset-=sizeof(long);
     83        SetReg_WholeVariable(DEF_LONG,pRelativeVar,REG_EDX, true);
    8684
    8785        return;
    8886    }
    8987
     88    int offsetOf64Head = 0;
     89    if( is64Head ){
     90        offsetOf64Head = sizeof(long);
     91    }
     92
    9093    if(pRelativeVar->dwKind==VAR_GLOBAL){
    9194        if(pRelativeVar->bOffsetOffset){
    9295            //mov reg, ptr[ecx+offset]
    93             op_mov_RM(varSize,reg,REG_ECX,(int)pRelativeVar->offset,MOD_BASE_DISP32);
     96            op_mov_RM(varSize,reg,REG_ECX,(int)pRelativeVar->offset + offsetOf64Head,MOD_BASE_DISP32);
    9497        }
    9598        else{
    9699            //mov reg, ptr[offset]
    97             op_mov_RM(varSize,reg,0,(int)pRelativeVar->offset,MOD_DISP32);
     100            op_mov_RM(varSize,reg,0,(int)pRelativeVar->offset + offsetOf64Head,MOD_DISP32);
    98101        }
    99102        obp-=sizeof(long);
     
    119122        if(pRelativeVar->bOffsetOffset){
    120123            //mov reg, ptr[ebp+ecx+offset]
    121             op_mov_RM_ex(varSize,reg,REG_EBP,REG_ECX,(int)pRelativeVar->offset,USE_OFFSET);
     124            op_mov_RM_ex(varSize,reg,REG_EBP,REG_ECX,(int)pRelativeVar->offset + offsetOf64Head,USE_OFFSET);
    122125        }
    123126        else{
    124127            //mov reg, ptr[ebp+offset]
    125             op_mov_RM(varSize,reg,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
     128            op_mov_RM(varSize,reg,REG_EBP,(int)pRelativeVar->offset + offsetOf64Head,MOD_BASE_DISP32);
    126129        }
    127130        obp-=sizeof(long);
     
    146149    else if(pRelativeVar->dwKind==VAR_DIRECTMEM){
    147150directmem:
    148         //mov reg, ptr[ecx]
    149         op_mov_RM(varSize,reg,REG_ECX,0,MOD_BASE);
     151        if( is64Head ){
     152            //mov reg, ptr[ecx]
     153            op_mov_RM(varSize,reg,REG_ECX,offsetOf64Head,MOD_BASE_DISP8);
     154        }
     155        else{
     156            //mov reg, ptr[ecx]
     157            op_mov_RM(varSize,reg,REG_ECX,0,MOD_BASE);
     158        }
    150159    }
    151160}
Note: See TracChangeset for help on using the changeset viewer.