Changeset 75 in dev for BasicCompiler32/increment.cpp
- Timestamp:
- Mar 20, 2007, 4:36:16 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/increment.cpp
r64 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 if(IsUse_ecx(&VarRelativeVar)){ … … 28 25 /////////////////////////////////// 29 26 30 if( IsRealNumberType(VarType)){27 if( varType.IsReal() ){ 31 28 //実数 32 SetReg_RealVariable( VarType,&VarRelativeVar);29 SetReg_RealVariable(varType.GetBasicType(),&VarRelativeVar); 33 30 } 34 31 else{ 35 32 //整数 36 SetReg_WholeVariable( VarType,&VarRelativeVar,REG_EAX);33 SetReg_WholeVariable(varType.GetBasicType(),&VarRelativeVar,REG_EAX); 37 34 } 38 35 39 36 40 if( IsWholeNumberType(VarType)&&lstrcmp(lpszRight,"1")==0&&37 if(varType.IsWhole()&&lstrcmp(lpszRight,"1")==0&& 41 38 (idCalc==CALC_ADDITION||idCalc==CALC_SUBTRACTION)){ 42 39 //////////////////////////////////////////// … … 44 41 //////////////////////////////////////////// 45 42 46 if( Is64Type(VarType)){43 if( varType.Is64() ){ 47 44 if(idCalc==CALC_ADDITION){ 48 45 //64ビット インクリメント … … 80 77 op_push(REG_ECX); 81 78 82 83 if(VarType==DEF_DOUBLE){ 79 if( varType.IsDouble() ){ 84 80 //sub esp,8 85 81 op_sub_esp(8); 86 82 87 83 //fstp qword ptr[esp] 88 op_fstp_basereg( VarType,REG_ESP);89 } 90 else if( VarType==DEF_SINGLE){84 op_fstp_basereg(varType.GetBasicType(),REG_ESP); 85 } 86 else if( varType.IsSingle() ){ 91 87 //sub esp,4 92 88 op_sub_esp(4); 93 89 94 90 //fstp dword ptr[esp] 95 op_fstp_basereg( VarType,REG_ESP);96 } 97 else if( Is64Type(VarType)){91 op_fstp_basereg(varType.GetBasicType(),REG_ESP); 92 } 93 else if( varType.Is64() ){ 98 94 //push edx 99 95 op_push(REG_EDX); … … 107 103 } 108 104 109 int CalcType; 110 CalcType=NumOpe(lpszRight,VarType,lpVarIndex,0); 111 112 if(VarType==DEF_DOUBLE) ChangeTypeToDouble(CalcType); 113 else if(VarType==DEF_SINGLE) ChangeTypeToSingle(CalcType); 114 else ChangeTypeToWhole(CalcType,VarType); 115 116 int type[255],sp; 105 Type calcType; 106 if( !NumOpe(lpszRight,varType,calcType) ){ 107 return; 108 } 109 110 if( varType.IsDouble() ) ChangeTypeToDouble(calcType.GetBasicType()); 111 else if( varType.IsSingle() ) ChangeTypeToSingle(calcType.GetBasicType()); 112 else ChangeTypeToWhole(calcType.GetBasicType(),varType.GetBasicType()); 113 114 int type_stack[255],sp; 117 115 LONG_PTR index_stack[255]; 118 type [0]=VarType;119 type [1]=VarType;120 index_stack[0]= lpVarIndex;121 index_stack[1]= lpVarIndex;116 type_stack[0]=varType.GetBasicType(); 117 type_stack[1]=varType.GetBasicType(); 118 index_stack[0]=varType.GetIndex(); 119 index_stack[1]=varType.GetIndex(); 122 120 sp=2; 123 121 124 122 switch(idCalc){ 125 123 case CALC_XOR: 126 Calc_Xor(type ,index_stack,&sp);124 Calc_Xor(type_stack,index_stack,&sp); 127 125 break; 128 126 case CALC_OR: 129 Calc_Or(type ,index_stack,&sp);127 Calc_Or(type_stack,index_stack,&sp); 130 128 break; 131 129 case CALC_AND: 132 Calc_And(type ,index_stack,&sp);130 Calc_And(type_stack,index_stack,&sp); 133 131 break; 134 132 case CALC_SHL: 135 Calc_SHL(type ,&sp);133 Calc_SHL(type_stack,&sp); 136 134 break; 137 135 case CALC_SHR: 138 Calc_SHR(type ,&sp);136 Calc_SHR(type_stack,&sp); 139 137 break; 140 138 case CALC_ADDITION: 141 139 case CALC_SUBTRACTION: 142 140 case CALC_PRODUCT: 143 CalcTwoTerm_Arithmetic(idCalc,type ,index_stack,&sp);141 CalcTwoTerm_Arithmetic(idCalc,type_stack,index_stack,&sp); 144 142 break; 145 143 case CALC_MOD: 146 Calc_Mod(type ,&sp);144 Calc_Mod(type_stack,&sp); 147 145 break; 148 146 case CALC_QUOTIENT: 149 Calc_Divide(type ,&sp,VarType);147 Calc_Divide(type_stack,&sp,varType.GetBasicType()); 150 148 break; 151 149 case CALC_INTQUOTIENT: 152 Calc_IntDivide(type ,index_stack,&sp);150 Calc_IntDivide(type_stack,index_stack,&sp); 153 151 break; 154 152 case CALC_POWER: 155 Calc_Power(type ,&sp);156 break; 157 } 158 159 160 if( VarType==DEF_DOUBLE){153 Calc_Power(type_stack,&sp); 154 break; 155 } 156 157 158 if( varType.IsDouble() ){ 161 159 //fld qword ptr[esp] 162 op_fld_basereg( VarType,REG_ESP);160 op_fld_basereg(varType.GetBasicType(),REG_ESP); 163 161 164 162 //add esp,8 165 163 op_add_esp(8); 166 164 } 167 else if( VarType==DEF_SINGLE){165 else if( varType.IsSingle() ){ 168 166 //fld dword ptr[esp] 169 op_fld_basereg( VarType,REG_ESP);167 op_fld_basereg(varType.GetBasicType(),REG_ESP); 170 168 171 169 //add esp,4 172 170 op_add_esp(4); 173 171 } 174 else if( Is64Type(VarType)){172 else if( varType.Is64() ){ 175 173 //pop eax 176 174 op_pop(REG_EAX); … … 200 198 } 201 199 202 SetVariableFromEax( VarType,VarType,&VarRelativeVar);200 SetVariableFromEax(varType.GetBasicType(),varType.GetBasicType(),&VarRelativeVar); 203 201 }
Note:
See TracChangeset
for help on using the changeset viewer.