Changeset 225 in dev for trunk/abdev/BasicCompiler32/NumOpe_TypeOperation.cpp
- Timestamp:
- Jul 21, 2007, 11:47:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/NumOpe_TypeOperation.cpp
r206 r225 20 20 21 21 //pop eax 22 op_pop(REG_EAX);22 compiler.codeGenerator.op_pop(REG_EAX); 23 23 24 24 //cdq 25 op_cdq();25 compiler.codeGenerator.op_cdq(); 26 26 27 27 //push edx 28 op_push(REG_EDX);28 compiler.codeGenerator.op_push(REG_EDX); 29 29 30 30 //push eax 31 op_push(REG_EAX);31 compiler.codeGenerator.op_push(REG_EAX); 32 32 } 33 33 else{ … … 35 35 36 36 //pop eax 37 op_pop(REG_EAX);37 compiler.codeGenerator.op_pop(REG_EAX); 38 38 39 39 //push 0 40 op_push_V(0);40 compiler.codeGenerator.op_push_V(0); 41 41 42 42 //push eax 43 op_push(REG_EAX);43 compiler.codeGenerator.op_push(REG_EAX); 44 44 } 45 45 } … … 49 49 if(Is64Type(type)){ 50 50 //pop eax 51 op_pop(REG_EAX);51 compiler.codeGenerator.op_pop(REG_EAX); 52 52 53 53 //pop edx 54 op_pop(REG_EDX);54 compiler.codeGenerator.op_pop(REG_EDX); 55 55 56 56 //push eax 57 op_push(REG_EAX);57 compiler.codeGenerator.op_push(REG_EAX); 58 58 } 59 59 else if(type==DEF_INTEGER || (Smoothie::IsUnicode()&&type==DEF_CHAR)){ 60 60 //pop eax 61 op_pop(REG_EAX);61 compiler.codeGenerator.op_pop(REG_EAX); 62 62 63 63 //movsx eax,ax 64 OpBuffer[obp++]=(char)0x0F; 65 OpBuffer[obp++]=(char)0xBF; 66 OpBuffer[obp++]=(char)0xC0; 64 compiler.codeGenerator.op_movsx_R32R16( REG_EAX ); 67 65 68 66 //push eax 69 op_push(REG_EAX);67 compiler.codeGenerator.op_push(REG_EAX); 70 68 } 71 69 else if(type==DEF_WORD){ 72 70 //pop eax 73 op_pop(REG_EAX);71 compiler.codeGenerator.op_pop(REG_EAX); 74 72 75 73 //and eax,0000FFFFh … … 79 77 80 78 //push eax 81 op_push(REG_EAX);79 compiler.codeGenerator.op_push(REG_EAX); 82 80 } 83 81 else if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 84 82 //pop eax 85 op_pop(REG_EAX);83 compiler.codeGenerator.op_pop(REG_EAX); 86 84 87 85 //movsx eax,al 88 OpBuffer[obp++]=(char)0x0F; 89 OpBuffer[obp++]=(char)0xBE; 90 OpBuffer[obp++]=(char)0xC0; 86 compiler.codeGenerator.op_movsx_R32R8( REG_EAX ); 91 87 92 88 //push eax 93 op_push(REG_EAX);89 compiler.codeGenerator.op_push(REG_EAX); 94 90 } 95 91 else if(type==DEF_BYTE||type==DEF_BOOLEAN){ 96 92 //pop eax 97 op_pop(REG_EAX);93 compiler.codeGenerator.op_pop(REG_EAX); 98 94 99 95 //and eax,000000FFh … … 103 99 104 100 //push eax 105 op_push(REG_EAX);101 compiler.codeGenerator.op_push(REG_EAX); 106 102 } 107 103 } … … 109 105 if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 110 106 //pop eax 111 op_pop(REG_EAX);107 compiler.codeGenerator.op_pop(REG_EAX); 112 108 113 109 //movsx eax,al 114 OpBuffer[obp++]=(char)0x0F; 115 OpBuffer[obp++]=(char)0xBE; 116 OpBuffer[obp++]=(char)0xC0; 110 compiler.codeGenerator.op_movsx_R32R8( REG_EAX ); 117 111 118 112 //push eax 119 op_push(REG_EAX);113 compiler.codeGenerator.op_push(REG_EAX); 120 114 } 121 115 else if(type==DEF_BYTE){ 122 116 //pop eax 123 op_pop(REG_EAX);117 compiler.codeGenerator.op_pop(REG_EAX); 124 118 125 119 //and eax,000000FFh … … 129 123 130 124 //push eax 131 op_push(REG_EAX);125 compiler.codeGenerator.op_push(REG_EAX); 132 126 } 133 127 } … … 135 129 if(Is64Type(type)){ 136 130 //pop eax 137 op_pop(REG_EAX);131 compiler.codeGenerator.op_pop(REG_EAX); 138 132 139 133 //pop edx 140 op_pop(REG_EDX);134 compiler.codeGenerator.op_pop(REG_EDX); 141 135 142 136 //push eax 143 op_push(REG_EAX);137 compiler.codeGenerator.op_push(REG_EAX); 144 138 } 145 139 } … … 150 144 if(Is64Type(NewType)){ 151 145 //fld qword ptr[esp] 152 op_fld_ptr_esp(DEF_DOUBLE);146 compiler.codeGenerator.op_fld_ptr_esp(DEF_DOUBLE); 153 147 154 148 //fistp qword ptr[esp] 155 op_fistp_ptr_esp( sizeof(_int64) );149 compiler.codeGenerator.op_fistp_ptr_esp( sizeof(_int64) ); 156 150 } 157 151 else{ 158 152 //fld qword ptr[esp] 159 op_fld_ptr_esp(DEF_DOUBLE);153 compiler.codeGenerator.op_fld_ptr_esp(DEF_DOUBLE); 160 154 161 155 //add esp,4 162 op_add_esp(4);156 compiler.codeGenerator.op_add_esp(4); 163 157 164 158 //fistp dword ptr[esp] 165 op_fistp_ptr_esp( sizeof(long) );159 compiler.codeGenerator.op_fistp_ptr_esp( sizeof(long) ); 166 160 } 167 161 } … … 169 163 if(Is64Type(NewType)){ 170 164 //fld dword ptr[esp] 171 op_fld_ptr_esp(DEF_SINGLE);165 compiler.codeGenerator.op_fld_ptr_esp(DEF_SINGLE); 172 166 173 167 //sub esp,4 174 op_sub_esp(4);168 compiler.codeGenerator.op_sub_esp(4); 175 169 176 170 //fistp qword ptr[esp] 177 op_fistp_ptr_esp( sizeof(_int64) );171 compiler.codeGenerator.op_fistp_ptr_esp( sizeof(_int64) ); 178 172 } 179 173 else{ 180 174 //fld dword ptr[esp] 181 op_fld_ptr_esp(DEF_SINGLE);175 compiler.codeGenerator.op_fld_ptr_esp(DEF_SINGLE); 182 176 183 177 //fistp dword ptr[esp] 184 op_fistp_ptr_esp( sizeof(long) );178 compiler.codeGenerator.op_fistp_ptr_esp( sizeof(long) ); 185 179 } 186 180 }
Note:
See TracChangeset
for help on using the changeset viewer.