Changeset 75 in dev for BasicCompiler64/increment.cpp
- Timestamp:
- Mar 20, 2007, 4:36:16 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler64/increment.cpp
r11 r75 3 3 4 4 void IncDec(int idCalc, char *lpszLeft, char *lpszRight){ 5 int VarType;6 LONG_PTR lpVarIndex;7 RELATIVE_VAR VarRelativeVar;8 9 5 10 6 /////////////////////////// … … 12 8 /////////////////////////// 13 9 10 RELATIVE_VAR VarRelativeVar; 11 Type varType; 14 12 if(!GetVarOffsetReadWrite( 15 13 lpszLeft, 16 &VarType,17 14 &VarRelativeVar, 18 &lpVarIndex)) return;15 varType)) return; 19 16 20 17 //変数オフセットを一時退避 … … 30 27 31 28 int reg; 32 if( VarType==DEF_DOUBLE){29 if( varType.IsDouble() ){ 33 30 reg=REG_XMM0; 34 31 SetXmmReg_DoubleVariable(&VarRelativeVar,reg); 35 32 } 36 else if( VarType==DEF_SINGLE){33 else if( varType.IsSingle() ){ 37 34 reg=REG_XMM0; 38 35 SetXmmReg_SingleVariable(&VarRelativeVar,reg); … … 40 37 else{ 41 38 reg=REG_RAX; 42 SetReg_WholeVariable( VarType,&VarRelativeVar,reg);39 SetReg_WholeVariable(varType.GetBasicType(),&VarRelativeVar,reg); 43 40 } 44 41 45 42 46 if( IsWholeNumberType(VarType)&&lstrcmp(lpszRight,"1")==0&&43 if(varType.IsWhole()&&lstrcmp(lpszRight,"1")==0&& 47 44 (idCalc==CALC_ADDITION||idCalc==CALC_SUBTRACTION)){ 48 45 if(idCalc==CALC_ADDITION){ … … 60 57 61 58 //右辺を計算 62 int CalcType; 63 LONG_PTR lpCalcIndex; 59 Type calcType; 64 60 if(reg==REG_RAX) reg=REG_RCX; 65 61 else reg=REG_RAX; 66 CalcType=NumOpe(®,lpszRight,VarType,lpVarIndex,&lpCalcIndex);62 NumOpe(®,lpszRight,varType,calcType); 67 63 68 64 //レジスタのブロッキングを解除 … … 70 66 71 67 72 if( IsPtrType(VarType)&&IsWholeNumberType(CalcType)&&(!IsPtrType(CalcType))){68 if(varType.IsPointer()&&calcType.IsWhole()&&(!calcType.IsPointer())){ 73 69 //左辺がポインタ型、右辺が整数型の場合は、エラーをださないようにする 74 CalcType=VarType; 75 lpCalcIndex=lpVarIndex; 70 calcType = varType; 76 71 } 77 72 … … 81 76 ///////////////////////////////// 82 77 83 CheckDifferentType( VarType,lpVarIndex,CalcType,lpCalcIndex,0,0);78 CheckDifferentType(varType,calcType,0,0); 84 79 85 80 … … 88 83 89 84 //左辺用レジスタ 90 if( IsRealNumberType(VarType))85 if(varType.IsReal()) 91 86 pobj_reg->LockXmmReg(); 92 87 else … … 94 89 95 90 //右辺値レジスタ 96 if( VarType==DEF_DOUBLE)97 ChangeTypeToXmm_Double( CalcType,91 if(varType.IsDouble()) 92 ChangeTypeToXmm_Double(calcType.GetBasicType(), 98 93 pobj_reg->LockXmmReg(), 99 94 pobj_reg->GetNextReg()); 100 else if( VarType==DEF_SINGLE)101 ChangeTypeToXmm_Single( CalcType,95 else if(varType.IsSingle()) 96 ChangeTypeToXmm_Single(calcType.GetBasicType(), 102 97 pobj_reg->LockXmmReg(), 103 98 pobj_reg->GetNextReg()); 104 99 else 105 ChangeTypeToWhole( CalcType,VarType,100 ChangeTypeToWhole(calcType.GetBasicType(),varType.GetBasicType(), 106 101 pobj_reg->LockReg(), 107 102 pobj_reg->GetNextXmmReg()); 108 103 109 int type [255],sp;104 int type_stack[255],sp; 110 105 LONG_PTR index_stack[255]; 111 type [0]=VarType;112 type [1]=VarType;113 index_stack[0]= lpVarIndex;114 index_stack[1]= lpVarIndex;106 type_stack[0]=varType.GetBasicType(); 107 type_stack[1]=varType.GetBasicType(); 108 index_stack[0]=varType.GetIndex(); 109 index_stack[1]=varType.GetIndex(); 115 110 sp=2; 116 111 … … 119 114 case CALC_OR: 120 115 case CALC_AND: 121 CalcTwoTerm_Logical(idCalc,type ,index_stack,&sp);116 CalcTwoTerm_Logical(idCalc,type_stack,index_stack,&sp); 122 117 break; 123 118 case CALC_SHL: 124 119 case CALC_SHR: 125 Calc_Shift(idCalc,type ,&sp);120 Calc_Shift(idCalc,type_stack,&sp); 126 121 break; 127 122 case CALC_ADDITION: 128 123 case CALC_SUBTRACTION: 129 124 case CALC_PRODUCT: 130 CalcTwoTerm_Arithmetic(idCalc,type ,index_stack,&sp);125 CalcTwoTerm_Arithmetic(idCalc,type_stack,index_stack,&sp); 131 126 break; 132 127 case CALC_MOD: 133 Calc_Mod(type ,index_stack,&sp);128 Calc_Mod(type_stack,index_stack,&sp); 134 129 break; 135 130 case CALC_QUOTIENT: 136 Calc_Divide(type ,&sp,VarType);131 Calc_Divide(type_stack,&sp,varType.GetBasicType()); 137 132 break; 138 133 case CALC_INTQUOTIENT: 139 Calc_IntDivide(type ,index_stack,&sp);134 Calc_IntDivide(type_stack,index_stack,&sp); 140 135 break; 141 136 case CALC_POWER: 142 Calc_Power(type ,&sp);137 Calc_Power(type_stack,&sp); 143 138 break; 144 139 } … … 160 155 } 161 156 162 SetVariableFromRax( VarType,VarType,&VarRelativeVar);157 SetVariableFromRax(varType.GetBasicType(),varType.GetBasicType(),&VarRelativeVar); 163 158 }
Note:
See TracChangeset
for help on using the changeset viewer.