[206] | 1 | #include "stdafx.h"
|
---|
| 2 |
|
---|
[183] | 3 | #include <jenga/include/smoothie/LexicalAnalysis.h>
|
---|
| 4 |
|
---|
| 5 | #include <Compiler.h>
|
---|
| 6 |
|
---|
[3] | 7 | #include "../BasicCompiler_Common/common.h"
|
---|
| 8 | #include "Opcode.h"
|
---|
| 9 |
|
---|
[129] | 10 | void OpcodeOthers(const char *Command){
|
---|
[3] | 11 | int i,i2;
|
---|
| 12 |
|
---|
[122] | 13 | char leftTerm[8192];
|
---|
| 14 | int lastParePos = 0;
|
---|
[3] | 15 | for(i=0;;i++){
|
---|
[122] | 16 | if(Command[i]=='\"'){
|
---|
| 17 | //ダブルクォートは不正なのでエラー扱い
|
---|
| 18 | leftTerm[i]=0;
|
---|
| 19 | SetError(3,leftTerm,cp);
|
---|
| 20 | return;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | if(Command[i]=='('){
|
---|
| 24 | lastParePos = i;
|
---|
| 25 | i2=GetStringInPare(leftTerm+i,Command+i);
|
---|
[3] | 26 | i+=i2-1;
|
---|
| 27 | continue;
|
---|
| 28 | }
|
---|
[122] | 29 | if(Command[i]=='['){
|
---|
| 30 | i2=GetStringInBracket(leftTerm+i,Command+i);
|
---|
| 31 | i+=i2-1;
|
---|
[3] | 32 | continue;
|
---|
| 33 | }
|
---|
[122] | 34 | if(Command[i]=='\0'){
|
---|
| 35 | leftTerm[i] = 0;
|
---|
[3] | 36 | break;
|
---|
| 37 | }
|
---|
[122] | 38 |
|
---|
| 39 | if( IsNumCalcMark( Command, i ) ){
|
---|
| 40 | leftTerm[i] = 0;
|
---|
| 41 | break;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | leftTerm[i]=Command[i];
|
---|
[3] | 45 | }
|
---|
| 46 | if(!(
|
---|
[122] | 47 | IsVariableTopChar(leftTerm[0])||
|
---|
| 48 | leftTerm[0]=='.'||
|
---|
| 49 | (leftTerm[0]==1&&leftTerm[1]==ESC_PSMEM)
|
---|
[3] | 50 | )){
|
---|
| 51 | SetError(1,NULL,cp);
|
---|
| 52 | return;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 |
|
---|
[122] | 56 | if(Command[i]=='\0' && lastParePos == 0){
|
---|
[3] | 57 | //////////////////////////////
|
---|
| 58 | // パラメータ無しのマクロ検索
|
---|
| 59 | //////////////////////////////
|
---|
| 60 |
|
---|
[206] | 61 | const UserProc *pUserProc=GetSubHash(Command);
|
---|
[3] | 62 |
|
---|
| 63 | //GetSubHash内でエラー提示が行われた場合
|
---|
[75] | 64 | if(pUserProc==(UserProc *)-1) return;
|
---|
[3] | 65 |
|
---|
[75] | 66 | if(pUserProc==0){
|
---|
[3] | 67 | char temporary[VN_SIZE];
|
---|
| 68 | lstrcpy(temporary,Command);
|
---|
| 69 |
|
---|
| 70 | CharUpper(temporary);
|
---|
[75] | 71 | pUserProc=GetSubHash(temporary);
|
---|
[3] | 72 |
|
---|
| 73 | //GetSubHash内でエラー提示が行われた場合
|
---|
[75] | 74 | if(pUserProc==(UserProc *)-1) return;
|
---|
[3] | 75 | }
|
---|
| 76 |
|
---|
[75] | 77 | if(pUserProc){
|
---|
[97] | 78 | if( !pUserProc->IsMacro() ){
|
---|
| 79 | SetError(10,Command,cp);
|
---|
| 80 | }
|
---|
[3] | 81 |
|
---|
[308] | 82 | Opcode_CallProc("",pUserProc,0,"");
|
---|
[3] | 83 |
|
---|
| 84 | return;
|
---|
| 85 | }
|
---|
| 86 | }
|
---|
| 87 | else if(IsNumCalcMark(Command,i)){
|
---|
| 88 | //代入演算
|
---|
| 89 | OpcodeCalc(Command);
|
---|
| 90 | return;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
[122] | 93 | if( pobj_reg ){
|
---|
| 94 | SetError();
|
---|
| 95 | }
|
---|
| 96 | pobj_reg=new CRegister(REG_RAX);
|
---|
[3] | 97 |
|
---|
[370] | 98 | if( strstr(leftTerm,"赤"))
|
---|
| 99 | {
|
---|
| 100 | int test=0;
|
---|
| 101 | }
|
---|
| 102 |
|
---|
[122] | 103 | Type resultType;
|
---|
| 104 | bool isLiteral;
|
---|
| 105 | BOOL bUseHeap;
|
---|
[128] | 106 | bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, false, NULL, true );
|
---|
[3] | 107 |
|
---|
[122] | 108 | delete pobj_reg;
|
---|
| 109 | pobj_reg = NULL;
|
---|
[3] | 110 |
|
---|
[122] | 111 | if( result ){
|
---|
[3] | 112 |
|
---|
| 113 | /////////////////////
|
---|
| 114 | // 戻り値の処理
|
---|
| 115 | /////////////////////
|
---|
| 116 |
|
---|
[75] | 117 | if( resultType.IsStruct() ){
|
---|
[3] | 118 | //mov r14,rax
|
---|
[226] | 119 | compiler.codeGenerator.op_mov_RR(REG_R14,REG_RAX);
|
---|
[3] | 120 |
|
---|
[75] | 121 | FreeTempObject(REG_R14,&resultType.GetClass());
|
---|
[3] | 122 | }
|
---|
| 123 | }
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | void Judgment(char *buffer){
|
---|
[75] | 127 | int reg=REG_RAX;
|
---|
| 128 | Type resultType;
|
---|
[326] | 129 | if( !NumOpe(®,buffer,Type(DEF_BOOLEAN),resultType) ){
|
---|
[75] | 130 | return;
|
---|
| 131 | }
|
---|
[3] | 132 |
|
---|
| 133 | int offset;
|
---|
| 134 |
|
---|
[75] | 135 | if(resultType.IsDouble()){
|
---|
[3] | 136 | double dbl=0;
|
---|
[266] | 137 | offset=compiler.GetObjectModule().dataTable.Add( dbl );
|
---|
[3] | 138 |
|
---|
| 139 | //comisd xmm0,qword ptr[data table offset]
|
---|
[242] | 140 | compiler.codeGenerator.PutOld(
|
---|
| 141 | (char)0x66,
|
---|
| 142 | (char)0x0F,
|
---|
| 143 | (char)0x2F,
|
---|
| 144 | (char)0x04,
|
---|
| 145 | (char)0x25
|
---|
| 146 | );
|
---|
| 147 | compiler.codeGenerator.PutOld(
|
---|
| 148 | (long)offset,
|
---|
| 149 | Schedule::DataTable
|
---|
| 150 | );
|
---|
[3] | 151 | }
|
---|
[75] | 152 | else if(resultType.IsSingle()){
|
---|
[3] | 153 | float flt=0;
|
---|
[266] | 154 | offset=compiler.GetObjectModule().dataTable.Add( flt );
|
---|
[3] | 155 |
|
---|
| 156 | //comiss xmm0,dword ptr[data table offset]
|
---|
[242] | 157 | compiler.codeGenerator.PutOld(
|
---|
| 158 | (char)0x0F,
|
---|
| 159 | (char)0x2F,
|
---|
| 160 | (char)0x04,
|
---|
| 161 | (char)0x25
|
---|
| 162 | );
|
---|
| 163 | compiler.codeGenerator.PutOld(
|
---|
| 164 | (long)offset,
|
---|
| 165 | Schedule::DataTable
|
---|
| 166 | );
|
---|
[3] | 167 | }
|
---|
| 168 | else{
|
---|
| 169 | //整数型
|
---|
| 170 |
|
---|
| 171 | //cmp rax,0
|
---|
[226] | 172 | compiler.codeGenerator.op_cmp_value(resultType.GetSize(),REG_RAX,0);
|
---|
[3] | 173 | }
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | void OpcodeIf(char *Parameter){
|
---|
[242] | 177 | for(int i=0;;i++){
|
---|
[3] | 178 | if(Parameter[i]=='\0'){
|
---|
| 179 | SetError(21,NULL,cp);
|
---|
| 180 | return;
|
---|
| 181 | }
|
---|
| 182 | if(Parameter[i]==1&&Parameter[i+1]==ESC_THEN){
|
---|
| 183 | Parameter[i]=0;
|
---|
| 184 | break;
|
---|
| 185 | }
|
---|
| 186 | }
|
---|
| 187 |
|
---|
| 188 | //条件式を実行してフラグをセット
|
---|
| 189 | Judgment(Parameter);
|
---|
| 190 |
|
---|
| 191 | //je (endif、または else まで条件ジャンプ)
|
---|
[254] | 192 | const PertialSchedule *pIfPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true );
|
---|
[3] | 193 |
|
---|
| 194 |
|
---|
| 195 | /////////////////////////
|
---|
| 196 | // If内をコード化
|
---|
| 197 | /////////////////////////
|
---|
| 198 |
|
---|
| 199 | //レキシカルスコープをレベルアップ
|
---|
[308] | 200 | compiler.codeGenerator.lexicalScopes.Start(
|
---|
| 201 | compiler.codeGenerator.GetNativeCodeSize(),
|
---|
| 202 | LexicalScope::SCOPE_TYPE_IF
|
---|
| 203 | );
|
---|
[3] | 204 |
|
---|
[242] | 205 | int i2=CompileBuffer(ESC_ENDIF,0);
|
---|
[3] | 206 |
|
---|
| 207 | //レキシカルスコープをレベルダウン
|
---|
[254] | 208 | compiler.codeGenerator.lexicalScopes.End();
|
---|
[3] | 209 |
|
---|
| 210 |
|
---|
| 211 | if(i2==ESC_ELSE){
|
---|
| 212 | //jmp (endifまで)
|
---|
[254] | 213 | const PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
|
---|
[3] | 214 |
|
---|
[242] | 215 | compiler.codeGenerator.opfix_JmpPertialSchedule( pIfPertialSchedule );
|
---|
[3] | 216 |
|
---|
| 217 |
|
---|
| 218 |
|
---|
| 219 | /////////////////////////
|
---|
| 220 | // Else内をコード化
|
---|
| 221 | /////////////////////////
|
---|
| 222 |
|
---|
| 223 | //レキシカルスコープをレベルアップ
|
---|
[308] | 224 | compiler.codeGenerator.lexicalScopes.Start(
|
---|
| 225 | compiler.codeGenerator.GetNativeCodeSize(),
|
---|
| 226 | LexicalScope::SCOPE_TYPE_IF
|
---|
| 227 | );
|
---|
[3] | 228 |
|
---|
| 229 | CompileBuffer(ESC_ENDIF,0);
|
---|
| 230 |
|
---|
| 231 | //レキシカルスコープをレベルダウン
|
---|
[254] | 232 | compiler.codeGenerator.lexicalScopes.End();
|
---|
[3] | 233 |
|
---|
| 234 |
|
---|
[242] | 235 | compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
|
---|
[3] | 236 | }
|
---|
| 237 | else{
|
---|
[242] | 238 | compiler.codeGenerator.opfix_JmpPertialSchedule( pIfPertialSchedule );
|
---|
[3] | 239 | }
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | int GetLabelAddress(char *LabelName,int LineNum){
|
---|
| 243 | if(LabelName){
|
---|
[262] | 244 | BOOST_FOREACH( const GotoLabel &label, compiler.codeGenerator.gotoLabels )
|
---|
| 245 | {
|
---|
| 246 | if( label.name.size() > 0 )
|
---|
| 247 | {
|
---|
| 248 | if( label.name == LabelName )
|
---|
| 249 | {
|
---|
| 250 | return label.address;
|
---|
| 251 | }
|
---|
[3] | 252 | }
|
---|
| 253 | }
|
---|
| 254 | }
|
---|
| 255 | else{
|
---|
[262] | 256 | BOOST_FOREACH( const GotoLabel &label, compiler.codeGenerator.gotoLabels )
|
---|
| 257 | {
|
---|
| 258 | if( label.name.size() == 0 )
|
---|
| 259 | {
|
---|
| 260 | if( label.line == LineNum )
|
---|
| 261 | {
|
---|
| 262 | return label.address;
|
---|
| 263 | }
|
---|
[3] | 264 | }
|
---|
| 265 | }
|
---|
| 266 | }
|
---|
| 267 | return -1;
|
---|
| 268 | }
|
---|
| 269 | void OpcodeGoto(char *Parameter){
|
---|
| 270 | extern HANDLE hHeap;
|
---|
| 271 | int i,LineNum;
|
---|
| 272 |
|
---|
| 273 | if(Parameter[0]=='*'){
|
---|
| 274 | i=GetLabelAddress(Parameter+1,0);
|
---|
| 275 |
|
---|
[254] | 276 | if( i == -1 )
|
---|
| 277 | {
|
---|
| 278 | //jmp ...(schedule)
|
---|
| 279 | compiler.codeGenerator.op_jmp_goto_schedule( (const std::string)(Parameter + 1), 0, cp );
|
---|
[3] | 280 | }
|
---|
[254] | 281 | else
|
---|
| 282 | {
|
---|
| 283 | //jmp ...
|
---|
[308] | 284 | compiler.codeGenerator.op_jmp(
|
---|
| 285 | i-compiler.codeGenerator.GetNativeCodeSize(),
|
---|
| 286 | sizeof(long),
|
---|
| 287 | false,
|
---|
| 288 | true
|
---|
| 289 | );
|
---|
[254] | 290 | }
|
---|
[3] | 291 | }
|
---|
| 292 | else{
|
---|
| 293 | LineNum=atoi(Parameter);
|
---|
| 294 | i=GetLabelAddress(0,LineNum);
|
---|
| 295 |
|
---|
[254] | 296 | if( i == -1 )
|
---|
| 297 | {
|
---|
| 298 | //jmp ...(schedule)
|
---|
| 299 | compiler.codeGenerator.op_jmp_goto_schedule( "", LineNum, cp );
|
---|
[3] | 300 | }
|
---|
[254] | 301 | else
|
---|
| 302 | {
|
---|
| 303 | //jmp ...
|
---|
[308] | 304 | compiler.codeGenerator.op_jmp(
|
---|
| 305 | i-compiler.codeGenerator.GetNativeCodeSize(),
|
---|
| 306 | sizeof(long),
|
---|
| 307 | false,
|
---|
| 308 | true
|
---|
| 309 | );
|
---|
[254] | 310 | }
|
---|
[3] | 311 | }
|
---|
| 312 | }
|
---|
| 313 | void OpcodeWhile(char *Parameter){
|
---|
| 314 | extern HANDLE hHeap;
|
---|
| 315 |
|
---|
| 316 | //Continueアドレスのバックアップとセット
|
---|
[242] | 317 | compiler.codeGenerator.ContinueAreaBegin();
|
---|
[3] | 318 |
|
---|
| 319 | if(!Parameter[0]) SetError(10,"While",cp);
|
---|
| 320 |
|
---|
| 321 | //条件式を実行してフラグをセット
|
---|
| 322 | Judgment(Parameter);
|
---|
| 323 |
|
---|
| 324 | //je (Wend まで)
|
---|
[254] | 325 | const PertialSchedule *pWhilePertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true );
|
---|
[3] | 326 |
|
---|
| 327 | //レキシカルスコープをレベルアップ
|
---|
[308] | 328 | compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_WHILE );
|
---|
[3] | 329 |
|
---|
| 330 | //While内をコンパイル
|
---|
| 331 | CompileBuffer(0,COM_WEND);
|
---|
| 332 |
|
---|
[254] | 333 | compiler.codeGenerator.lexicalScopes.CallDestructorsOfScopeEnd();
|
---|
[3] | 334 |
|
---|
| 335 | //jmp ...
|
---|
[242] | 336 | compiler.codeGenerator.op_jmp_continue();
|
---|
[3] | 337 |
|
---|
| 338 | //レキシカルスコープをレベルダウン
|
---|
[254] | 339 | compiler.codeGenerator.lexicalScopes.End();
|
---|
[3] | 340 |
|
---|
[242] | 341 | compiler.codeGenerator.opfix_JmpPertialSchedule( pWhilePertialSchedule );
|
---|
[3] | 342 |
|
---|
| 343 | //Continueアドレスを復元
|
---|
[242] | 344 | compiler.codeGenerator.ContinueAreaEnd();
|
---|
[3] | 345 | }
|
---|
| 346 |
|
---|
| 347 | char szNextVariable[VN_SIZE];
|
---|
| 348 | void OpcodeFor(char *Parameter){
|
---|
| 349 | extern HANDLE hHeap;
|
---|
[75] | 350 | Type resultType;
|
---|
[242] | 351 | int i,i2;
|
---|
[3] | 352 | char temporary[VN_SIZE],variable[VN_SIZE],JudgeNum[VN_SIZE],StepNum[VN_SIZE];
|
---|
[34] | 353 | bool isError = false;
|
---|
[3] | 354 |
|
---|
| 355 | //第1パラメータを取得
|
---|
| 356 | i=GetOneParameter(Parameter,0,temporary);
|
---|
| 357 | if(!Parameter[i]){
|
---|
| 358 | SetError(12,"For",cp);
|
---|
[34] | 359 | isError = true;
|
---|
[3] | 360 | goto ErrorStep;
|
---|
| 361 | }
|
---|
| 362 |
|
---|
| 363 | for(i2=0;;i2++){
|
---|
| 364 | if(temporary[i2]=='='){
|
---|
| 365 | variable[i2]=0;
|
---|
| 366 |
|
---|
| 367 | //カウンタ初期化
|
---|
| 368 | OpcodeCalc(temporary);
|
---|
| 369 | break;
|
---|
| 370 | }
|
---|
| 371 | if(temporary[i2]=='\0'){
|
---|
| 372 | SetError(12,"For",cp);
|
---|
[34] | 373 | isError = true;
|
---|
[3] | 374 | goto ErrorStep;
|
---|
| 375 | }
|
---|
| 376 | variable[i2]=temporary[i2];
|
---|
| 377 | }
|
---|
| 378 |
|
---|
| 379 | //jmp ...
|
---|
[254] | 380 | const PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
|
---|
[3] | 381 |
|
---|
| 382 | //Continueアドレスのバックアップとセット
|
---|
[242] | 383 | compiler.codeGenerator.ContinueAreaBegin();
|
---|
[3] | 384 |
|
---|
| 385 | //第2パラメータを取得(to~)
|
---|
| 386 | i=GetOneParameter(Parameter,i,JudgeNum);
|
---|
| 387 |
|
---|
| 388 | //第3パラメータを取得(step~)
|
---|
| 389 | if(Parameter[i]){
|
---|
| 390 | i=GetOneParameter(Parameter,i,StepNum);
|
---|
| 391 | if(Parameter[i]) SetError(12,"For",cp);
|
---|
| 392 | }
|
---|
| 393 | else lstrcpy(StepNum,"1");
|
---|
| 394 |
|
---|
| 395 | //カウンタを増加させる
|
---|
| 396 | sprintf(temporary,"%s=(%s)+(%s)",variable,variable,StepNum);
|
---|
| 397 | OpcodeCalc(temporary);
|
---|
| 398 |
|
---|
[242] | 399 | compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
|
---|
[3] | 400 |
|
---|
| 401 | //増加か減少かを区別する
|
---|
| 402 | sprintf(temporary,"(%s)>=0",StepNum);
|
---|
| 403 |
|
---|
[75] | 404 | int reg;
|
---|
[3] | 405 | reg=REG_RAX;
|
---|
[75] | 406 | if( !NumOpe(®,temporary,Type(),resultType) ){
|
---|
| 407 | return;
|
---|
| 408 | }
|
---|
[3] | 409 |
|
---|
| 410 | //cmp rax,0
|
---|
[226] | 411 | compiler.codeGenerator.op_cmp_value(resultType.GetSize(),REG_RAX,0);
|
---|
[3] | 412 |
|
---|
| 413 | //je [カウンタ減少の場合の判定]
|
---|
[242] | 414 | pTempPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true );
|
---|
[3] | 415 |
|
---|
| 416 | //判定(カウンタ増加の場合)
|
---|
| 417 | sprintf(temporary,"%s<=(%s)",variable,JudgeNum);
|
---|
| 418 |
|
---|
| 419 | reg=REG_RAX;
|
---|
[75] | 420 | NumOpe(®,temporary,Type(),Type());
|
---|
[3] | 421 |
|
---|
| 422 | //jmp [カウンタ減少の場合の判定を飛び越す]
|
---|
[254] | 423 | const PertialSchedule *pTempPertialSchedule2 = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
|
---|
[3] | 424 |
|
---|
[242] | 425 | //jeジャンプ先のオフセット値
|
---|
| 426 | compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
|
---|
[3] | 427 |
|
---|
| 428 | //判定(カウンタ減少の場合)
|
---|
| 429 | sprintf(temporary,"%s>=(%s)",variable,JudgeNum);
|
---|
| 430 |
|
---|
| 431 | reg=REG_RAX;
|
---|
[75] | 432 | NumOpe(®,temporary,Type(),resultType);
|
---|
[3] | 433 |
|
---|
[242] | 434 | //jmpジャンプ先のオフセット値
|
---|
| 435 | compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule2 );
|
---|
[3] | 436 |
|
---|
| 437 | //cmp rax,0
|
---|
[226] | 438 | compiler.codeGenerator.op_cmp_value(resultType.GetSize(),REG_RAX,0);
|
---|
[3] | 439 |
|
---|
| 440 | ErrorStep:
|
---|
| 441 |
|
---|
| 442 | //je ...
|
---|
[242] | 443 | pTempPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true );
|
---|
[3] | 444 |
|
---|
| 445 | //レキシカルスコープをレベルアップ
|
---|
[308] | 446 | compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR );
|
---|
[3] | 447 |
|
---|
| 448 | //For内をコンパイル
|
---|
| 449 | CompileBuffer(0,COM_NEXT);
|
---|
| 450 |
|
---|
[254] | 451 | compiler.codeGenerator.lexicalScopes.CallDestructorsOfScopeEnd();
|
---|
[3] | 452 |
|
---|
| 453 | if(szNextVariable[0]){
|
---|
| 454 | if(lstrcmp(szNextVariable,variable)!=0){
|
---|
| 455 | SetError(55,szNextVariable,cp);
|
---|
| 456 | }
|
---|
| 457 | }
|
---|
| 458 |
|
---|
| 459 | //jmp ...
|
---|
[242] | 460 | compiler.codeGenerator.op_jmp_continue();
|
---|
[3] | 461 |
|
---|
| 462 | //レキシカルスコープをレベルダウン
|
---|
[254] | 463 | compiler.codeGenerator.lexicalScopes.End();
|
---|
[3] | 464 |
|
---|
[242] | 465 | //jeジャンプ先のオフセット値
|
---|
| 466 | compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
|
---|
[3] | 467 |
|
---|
| 468 | //Continueアドレスを復元
|
---|
[242] | 469 | compiler.codeGenerator.ContinueAreaEnd();
|
---|
[3] | 470 | }
|
---|
| 471 |
|
---|
| 472 | void OpcodeDo(char *Parameter){
|
---|
| 473 | extern HANDLE hHeap;
|
---|
| 474 | int i,i2,i3;
|
---|
| 475 |
|
---|
| 476 | if(Parameter[0]) SetError(10,"Do",cp);
|
---|
| 477 |
|
---|
| 478 | //Continueアドレスのバックアップとセット
|
---|
[242] | 479 | compiler.codeGenerator.ContinueAreaBegin();
|
---|
[3] | 480 |
|
---|
| 481 | //レキシカルスコープをレベルアップ
|
---|
[308] | 482 | compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_DO );
|
---|
[3] | 483 |
|
---|
| 484 | //Do内をコンパイル
|
---|
| 485 | CompileBuffer(0,COM_LOOP);
|
---|
| 486 |
|
---|
[254] | 487 | compiler.codeGenerator.lexicalScopes.CallDestructorsOfScopeEnd();
|
---|
[3] | 488 |
|
---|
[254] | 489 | const PertialSchedule *pDoPertialSchedule = NULL;
|
---|
[242] | 490 |
|
---|
[3] | 491 | extern char *basbuf;
|
---|
| 492 | char temporary[VN_SIZE];
|
---|
| 493 | for(i=cp-1;;i--){
|
---|
| 494 | if(IsCommandDelimitation(basbuf[i])){
|
---|
| 495 | i+=3;
|
---|
| 496 | if(!(basbuf[i]=='0'||basbuf[i]=='1')){
|
---|
| 497 | //無条件ループ
|
---|
| 498 | break;
|
---|
| 499 | }
|
---|
| 500 | i3=i;
|
---|
| 501 |
|
---|
| 502 | for(i+=2,i2=0;;i++,i2++){
|
---|
| 503 | if(IsCommandDelimitation(basbuf[i])){
|
---|
| 504 | temporary[i2]=0;
|
---|
| 505 | break;
|
---|
| 506 | }
|
---|
| 507 | temporary[i2]=basbuf[i];
|
---|
| 508 | }
|
---|
| 509 |
|
---|
| 510 | //条件式を実行してフラグをセット
|
---|
| 511 | Judgment(temporary);
|
---|
| 512 |
|
---|
| 513 | if(basbuf[i3]=='0'){
|
---|
| 514 | //While
|
---|
| 515 |
|
---|
| 516 | //je 5(ループ終了)
|
---|
[242] | 517 | pDoPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(char), true );
|
---|
[3] | 518 | }
|
---|
| 519 | else if(basbuf[i3]=='1'){
|
---|
| 520 | //Until
|
---|
| 521 |
|
---|
| 522 | //jne 5(ループ終了)
|
---|
[242] | 523 | pDoPertialSchedule = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
|
---|
[3] | 524 | }
|
---|
| 525 | break;
|
---|
| 526 | }
|
---|
| 527 | }
|
---|
| 528 |
|
---|
| 529 | //jmp ...
|
---|
[242] | 530 | compiler.codeGenerator.op_jmp_continue();
|
---|
[3] | 531 |
|
---|
[242] | 532 | if( pDoPertialSchedule )
|
---|
| 533 | {
|
---|
| 534 | compiler.codeGenerator.opfix_JmpPertialSchedule( pDoPertialSchedule );
|
---|
| 535 | }
|
---|
| 536 |
|
---|
[3] | 537 | //jmp ...
|
---|
[254] | 538 | const PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
|
---|
[3] | 539 |
|
---|
| 540 | //レキシカルスコープをレベルダウン
|
---|
[254] | 541 | compiler.codeGenerator.lexicalScopes.End();
|
---|
[3] | 542 |
|
---|
[243] | 543 | //jmpジャンプ先のオフセット値
|
---|
| 544 | compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
|
---|
[3] | 545 |
|
---|
| 546 | //Continueアドレスを復元
|
---|
[242] | 547 | compiler.codeGenerator.ContinueAreaEnd();
|
---|
[3] | 548 | }
|
---|
| 549 | void OpcodeContinue(void){
|
---|
| 550 | //jmp ...(Continue addr)
|
---|
[242] | 551 | compiler.codeGenerator.op_jmp_continue();
|
---|
[3] | 552 | }
|
---|
| 553 |
|
---|
| 554 | void OpcodeExitSub(void){
|
---|
[75] | 555 | if( UserProc::IsGlobalAreaCompiling() ){
|
---|
[3] | 556 | SetError(12,"Exit Sub/Function",cp);
|
---|
| 557 | return;
|
---|
| 558 | }
|
---|
| 559 |
|
---|
[34] | 560 | //未解放のローカルオブジェクトのデストラクタを呼び出す
|
---|
[254] | 561 | compiler.codeGenerator.lexicalScopes.CallDestructorsOfReturn();
|
---|
[34] | 562 |
|
---|
[3] | 563 | //jmp ...(End Sub/Function)
|
---|
[254] | 564 | compiler.codeGenerator.op_jmp_exitsub();
|
---|
| 565 | }
|
---|
[3] | 566 |
|
---|
[254] | 567 | //Caseスケジュール
|
---|
| 568 | class SelectSchedule
|
---|
| 569 | {
|
---|
| 570 | public:
|
---|
| 571 | SelectSchedule( int typeSize )
|
---|
| 572 | : typeSize( typeSize )
|
---|
| 573 | , nowCaseSchedule( 0 )
|
---|
| 574 | {
|
---|
| 575 | }
|
---|
[3] | 576 |
|
---|
[254] | 577 | PertialSchedules casePertialSchedules;
|
---|
| 578 | int typeSize;
|
---|
| 579 | int nowCaseSchedule;
|
---|
| 580 | };
|
---|
| 581 | std::vector<SelectSchedule> selectSchedules;
|
---|
[3] | 582 |
|
---|
[75] | 583 | void OpcodeSelect( const char *lpszParms ){
|
---|
[3] | 584 | extern HANDLE hHeap;
|
---|
| 585 | extern char *basbuf;
|
---|
| 586 | int i,i2,i3,NowCaseCp;
|
---|
| 587 | char temporary[VN_SIZE];
|
---|
[254] | 588 |
|
---|
[75] | 589 | int reg1=REG_RAX;
|
---|
| 590 | Type type1;
|
---|
| 591 | if( !NumOpe(®1,lpszParms,Type(), type1 ) ){
|
---|
| 592 | return;
|
---|
| 593 | }
|
---|
[3] | 594 |
|
---|
[254] | 595 | selectSchedules.push_back( SelectSchedule( type1.GetSize() ) );
|
---|
| 596 |
|
---|
| 597 | if( selectSchedules.back().typeSize < sizeof(long) ){
|
---|
| 598 | selectSchedules.back().typeSize = sizeof(long);
|
---|
| 599 | }
|
---|
| 600 |
|
---|
[75] | 601 | if(type1.IsDouble()){
|
---|
[3] | 602 | //movsd qword ptr[rsp+offset],xmm_reg ※スタックフレームを利用
|
---|
| 603 | pobj_sf->push(reg1,sizeof(double));
|
---|
| 604 | }
|
---|
[75] | 605 | else if(type1.IsSingle()){
|
---|
[3] | 606 | //movss dword ptr[rsp+offset],xmm_reg ※スタックフレームを利用
|
---|
| 607 | pobj_sf->push(reg1,sizeof(float));
|
---|
| 608 | }
|
---|
| 609 | else{
|
---|
[75] | 610 | ExtendTypeTo64(type1.GetBasicType(),reg1);
|
---|
[3] | 611 |
|
---|
| 612 | //mov qword ptr[rsp+offset],reg ※スタックフレームを利用
|
---|
| 613 | pobj_sf->push(reg1);
|
---|
| 614 | }
|
---|
| 615 |
|
---|
| 616 | for(i=cp;;i++){
|
---|
| 617 | if(basbuf[i]=='\0'){
|
---|
[254] | 618 | selectSchedules.pop_back();
|
---|
[3] | 619 | SetError(22,"Select",cp);
|
---|
| 620 | return;
|
---|
| 621 | }
|
---|
| 622 | if(basbuf[i]==1&&basbuf[i+1]==ESC_SELECTCASE){
|
---|
| 623 | for(i2=0;;i++){
|
---|
| 624 | if(basbuf[i]==1&&basbuf[i+1]==ESC_SELECTCASE) i2++;
|
---|
| 625 | if(basbuf[i]==1&&basbuf[i+1]==ESC_ENDSELECT){
|
---|
| 626 | i2--;
|
---|
| 627 | if(i2==0) break;
|
---|
| 628 | }
|
---|
| 629 | }
|
---|
| 630 | continue;
|
---|
| 631 | }
|
---|
| 632 | if(basbuf[i]==1&&basbuf[i+1]==ESC_ENDSELECT) break;
|
---|
| 633 |
|
---|
| 634 | if(basbuf[i]==1&&basbuf[i+1]==ESC_CASE){
|
---|
| 635 | NowCaseCp=i;
|
---|
| 636 |
|
---|
| 637 | i++;
|
---|
| 638 | while(1){
|
---|
| 639 | for(i++,i2=0;;i++,i2++){
|
---|
| 640 | if(basbuf[i]=='\"'){
|
---|
| 641 | i3=GetStringInQuotation(temporary+i2,basbuf+i);
|
---|
| 642 | i+=i3-1;
|
---|
| 643 | i2+=i3-1;
|
---|
| 644 | continue;
|
---|
| 645 | }
|
---|
| 646 | if(basbuf[i]=='('){
|
---|
| 647 | i3=GetStringInPare(temporary+i2,basbuf+i);
|
---|
| 648 | i+=i3-1;
|
---|
| 649 | i2+=i3-1;
|
---|
| 650 | continue;
|
---|
| 651 | }
|
---|
| 652 | if(basbuf[i]=='['){
|
---|
| 653 | i3=GetStringInBracket(temporary+i2,basbuf+i);
|
---|
| 654 | i+=i3-1;
|
---|
| 655 | i2+=i3-1;
|
---|
| 656 | continue;
|
---|
| 657 | }
|
---|
| 658 |
|
---|
| 659 | if(IsCommandDelimitation(basbuf[i])){
|
---|
| 660 | temporary[i2]=0;
|
---|
| 661 | break;
|
---|
| 662 | }
|
---|
| 663 | if(basbuf[i]==','){
|
---|
| 664 | temporary[i2]=0;
|
---|
| 665 | break;
|
---|
| 666 | }
|
---|
| 667 |
|
---|
| 668 | temporary[i2]=basbuf[i];
|
---|
| 669 | }
|
---|
| 670 |
|
---|
| 671 | //エラー用
|
---|
| 672 | i2=cp;
|
---|
| 673 | cp=NowCaseCp;
|
---|
| 674 |
|
---|
[75] | 675 | int reg2=REG_RDX;
|
---|
| 676 | Type type2;
|
---|
| 677 | if( !NumOpe(®2,temporary,type1,type2) ){
|
---|
| 678 | return;
|
---|
| 679 | }
|
---|
[3] | 680 |
|
---|
| 681 | cp=i2;
|
---|
| 682 |
|
---|
[75] | 683 | if(type1.IsObject()){
|
---|
[206] | 684 | std::vector<const UserProc *> subs;
|
---|
[345] | 685 | type1.GetClass().GetDynamicMethods().Enum( CALC_EQUAL, subs );
|
---|
[50] | 686 | if( subs.size() == 0 ){
|
---|
[3] | 687 | return;
|
---|
| 688 | }
|
---|
| 689 |
|
---|
[75] | 690 | Parameters params;
|
---|
| 691 | params.push_back( new Parameter( "", Type( type2 ) ) );
|
---|
[3] | 692 |
|
---|
| 693 | //オーバーロードを解決
|
---|
[206] | 694 | const UserProc *pUserProc = OverloadSolution("==",subs, params, NULL);
|
---|
[3] | 695 |
|
---|
[75] | 696 | delete params[0];
|
---|
| 697 |
|
---|
| 698 | if(!pUserProc){
|
---|
[3] | 699 | //エラー
|
---|
| 700 | return;
|
---|
| 701 | }
|
---|
| 702 |
|
---|
| 703 |
|
---|
| 704 | //実体オブジェクト
|
---|
| 705 | if(reg2!=REG_RDX){
|
---|
| 706 | //mov rdx,reg2
|
---|
[226] | 707 | compiler.codeGenerator.op_mov_RR(REG_RDX,reg2);
|
---|
[3] | 708 | }
|
---|
| 709 |
|
---|
| 710 | //mov rcx,qword ptr[rsp+offset] ※スタックフレームから参照
|
---|
| 711 | pobj_sf->ref(REG_RCX);
|
---|
| 712 |
|
---|
| 713 | //call operator_proc ※ ==演算子
|
---|
[226] | 714 | compiler.codeGenerator.op_call(pUserProc);
|
---|
[3] | 715 |
|
---|
| 716 | //test rax,rax
|
---|
[226] | 717 | compiler.codeGenerator.op_test(REG_RAX,REG_RAX);
|
---|
[3] | 718 |
|
---|
| 719 | //jne ...
|
---|
[254] | 720 | selectSchedules.back().casePertialSchedules.push_back(
|
---|
| 721 | compiler.codeGenerator.op_jne( 0, sizeof(long), true )
|
---|
| 722 | );
|
---|
[3] | 723 | }
|
---|
| 724 | else{
|
---|
[75] | 725 | if(type1.IsDouble()){
|
---|
[3] | 726 | int xmm_reg;
|
---|
| 727 | if(IsXmmReg(reg2)) xmm_reg=reg2;
|
---|
| 728 | else xmm_reg=REG_XMM5;
|
---|
[75] | 729 | ChangeTypeToXmm_Double(type2.GetBasicType(),xmm_reg,reg2);
|
---|
[3] | 730 |
|
---|
| 731 | //movsd xmm4,qword ptr[rsp+offset] ※スタックフレームから参照
|
---|
| 732 | pobj_sf->ref(REG_XMM4,sizeof(double));
|
---|
| 733 |
|
---|
| 734 | //comiss xmm_reg1,xmm_reg2
|
---|
[226] | 735 | compiler.codeGenerator.op_comisd(xmm_reg,REG_XMM4);
|
---|
[3] | 736 | }
|
---|
[75] | 737 | else if(type1.IsSingle()){
|
---|
[3] | 738 | int xmm_reg;
|
---|
| 739 | if(IsXmmReg(reg2)) xmm_reg=reg2;
|
---|
| 740 | else xmm_reg=REG_XMM5;
|
---|
[75] | 741 | ChangeTypeToXmm_Single(type2.GetBasicType(),xmm_reg,reg2);
|
---|
[3] | 742 |
|
---|
| 743 | //movss xmm4,dword ptr[rsp+offset] ※スタックフレームから参照
|
---|
| 744 | pobj_sf->ref(REG_XMM4,sizeof(float));
|
---|
| 745 |
|
---|
| 746 | //comiss xmm_reg1,xmm_reg2
|
---|
[226] | 747 | compiler.codeGenerator.op_comiss(xmm_reg,REG_XMM4);
|
---|
[3] | 748 | }
|
---|
| 749 | else{
|
---|
| 750 | //その他整数型
|
---|
| 751 |
|
---|
[75] | 752 | i2=NeutralizationType(type1.GetBasicType(),-1,type2.GetBasicType(),-1);
|
---|
[3] | 753 |
|
---|
| 754 | //mov r14,qword ptr[rsp+offset] ※スタックフレームから参照
|
---|
| 755 | pobj_sf->ref(REG_R14);
|
---|
| 756 |
|
---|
| 757 | //cmp reg2,r14
|
---|
[308] | 758 | compiler.codeGenerator.op_cmp_reg(Type(i2).GetSize(),reg2,REG_R14);
|
---|
[3] | 759 | }
|
---|
| 760 |
|
---|
| 761 | //je ...
|
---|
[254] | 762 | selectSchedules.back().casePertialSchedules.push_back(
|
---|
| 763 | compiler.codeGenerator.op_je( 0, sizeof(long), true )
|
---|
| 764 | );
|
---|
[3] | 765 | }
|
---|
| 766 |
|
---|
| 767 | if(basbuf[i]!=',') break;
|
---|
| 768 | }
|
---|
| 769 | }
|
---|
| 770 | if(basbuf[i]==1&&basbuf[i+1]==ESC_CASEELSE){
|
---|
| 771 | //jmp ...
|
---|
[254] | 772 | selectSchedules.back().casePertialSchedules.push_back(
|
---|
| 773 | compiler.codeGenerator.op_jmp( 0, sizeof(long), true )
|
---|
| 774 | );
|
---|
[3] | 775 | }
|
---|
| 776 | }
|
---|
| 777 |
|
---|
| 778 | //スタックフレームを1スペースだけ解除
|
---|
| 779 | pobj_sf->pop(REG_NON);
|
---|
| 780 |
|
---|
| 781 | //レキシカルスコープをレベルアップ
|
---|
[308] | 782 | compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_SELECT );
|
---|
[3] | 783 |
|
---|
| 784 | //Select Case内をコンパイル
|
---|
| 785 | CompileBuffer(ESC_ENDSELECT,0);
|
---|
| 786 |
|
---|
| 787 | //jmp EndSelect
|
---|
[254] | 788 | selectSchedules.back().casePertialSchedules.push_back(
|
---|
| 789 | compiler.codeGenerator.op_jmp( 0, sizeof(long), true )
|
---|
| 790 | );
|
---|
[3] | 791 |
|
---|
| 792 | //最終スケジュール
|
---|
[254] | 793 | for(i=selectSchedules.back().nowCaseSchedule;i<(int)selectSchedules.back().casePertialSchedules.size();i++){
|
---|
| 794 | compiler.codeGenerator.opfix_JmpPertialSchedule( selectSchedules.back().casePertialSchedules[i] );
|
---|
[3] | 795 | }
|
---|
| 796 |
|
---|
| 797 | //レキシカルスコープをレベルダウン
|
---|
[254] | 798 | compiler.codeGenerator.lexicalScopes.End();
|
---|
[3] | 799 |
|
---|
[254] | 800 | selectSchedules.pop_back();
|
---|
[3] | 801 | }
|
---|
| 802 | void OpcodeCase(char *Parameter){
|
---|
| 803 | int i;
|
---|
| 804 |
|
---|
[254] | 805 | if(selectSchedules.back().typeSize==-1){
|
---|
[3] | 806 | SetError(30,"Case",cp);
|
---|
| 807 | return;
|
---|
| 808 | }
|
---|
| 809 |
|
---|
| 810 | //jmp EndSelect
|
---|
[254] | 811 | selectSchedules.back().casePertialSchedules.push_back(
|
---|
| 812 | compiler.codeGenerator.op_jmp( 0, sizeof(long), true )
|
---|
| 813 | );
|
---|
[3] | 814 |
|
---|
| 815 | i=0;
|
---|
| 816 | while(1){
|
---|
| 817 | //Caseスケジュール
|
---|
[254] | 818 | compiler.codeGenerator.opfix_JmpPertialSchedule( selectSchedules.back().casePertialSchedules[selectSchedules.back().nowCaseSchedule] );
|
---|
| 819 | selectSchedules.back().nowCaseSchedule++;
|
---|
[3] | 820 |
|
---|
| 821 | i=JumpOneParameter(Parameter,i);
|
---|
| 822 | if(Parameter[i]=='\0') break;
|
---|
| 823 | }
|
---|
| 824 | }
|
---|
| 825 |
|
---|
| 826 | void OpcodeGosub(char *Parameter){
|
---|
| 827 | SetError(-1,"Gosub ~ Returnステートメントは64ビットコンパイラで利用することはできません。",cp);
|
---|
| 828 | }
|
---|
| 829 | void OpcodeReturn(char *Parameter){
|
---|
[75] | 830 | if( UserProc::IsGlobalAreaCompiling() ){
|
---|
[34] | 831 | SetError(62,NULL,cp);
|
---|
[3] | 832 | }
|
---|
| 833 | else{
|
---|
| 834 | //戻り値をセット
|
---|
| 835 | if(Parameter[0]){
|
---|
[206] | 836 | const UserProc &proc = UserProc::CompilingUserProc();
|
---|
[3] | 837 |
|
---|
[75] | 838 | const char *temp = "_System_ReturnValue";
|
---|
| 839 | if(proc.GetName()[0]==1&&proc.GetName()[1]==ESC_OPERATOR)
|
---|
| 840 | {
|
---|
[40] | 841 | }
|
---|
| 842 | else{
|
---|
[75] | 843 | temp=proc.GetName().c_str();
|
---|
| 844 | }
|
---|
| 845 |
|
---|
| 846 | char temporary[VN_SIZE];
|
---|
| 847 | sprintf(temporary,"%s=%s",temp,Parameter);
|
---|
| 848 | OpcodeCalc(temporary);
|
---|
[3] | 849 | }
|
---|
| 850 |
|
---|
| 851 | //プロシージャを抜け出す(C言語のreturnと同様の処理を行う)
|
---|
| 852 | OpcodeExitSub();
|
---|
| 853 | }
|
---|
| 854 | }
|
---|
| 855 |
|
---|
| 856 |
|
---|
| 857 | ////////////
|
---|
| 858 | // ポインタ
|
---|
| 859 | ////////////
|
---|
| 860 |
|
---|
| 861 | void OpcodeSetPtrData(char *Parameter,int type){
|
---|
[75] | 862 | int i;
|
---|
[3] | 863 | char temporary[VN_SIZE];
|
---|
| 864 |
|
---|
| 865 | if(Parameter[0]=='('){
|
---|
| 866 | i=JumpStringInPare(Parameter,1);
|
---|
| 867 | if(Parameter[i+1]=='\0'){
|
---|
| 868 | for(i=0;;i++){
|
---|
| 869 | Parameter[i]=Parameter[i+1];
|
---|
| 870 | if(Parameter[i]=='\0') break;
|
---|
| 871 | }
|
---|
| 872 | Parameter[i-1]=0;
|
---|
| 873 | }
|
---|
| 874 | }
|
---|
| 875 |
|
---|
| 876 | //第1パラメータを取得
|
---|
| 877 | i=GetOneParameter(Parameter,0,temporary);
|
---|
| 878 | if(!Parameter[i]){
|
---|
| 879 | SetError(1,NULL,cp);
|
---|
| 880 | return;
|
---|
| 881 | }
|
---|
| 882 |
|
---|
| 883 | int reg_ptr=REG_RAX;
|
---|
[75] | 884 | Type resultType;
|
---|
| 885 | if( !NumOpe(®_ptr,temporary,Type(),resultType) ){
|
---|
| 886 | return;
|
---|
| 887 | }
|
---|
| 888 | if(!resultType.IsWhole()){
|
---|
[3] | 889 | SetError(11,Parameter,cp);
|
---|
| 890 | return;
|
---|
| 891 | }
|
---|
| 892 |
|
---|
| 893 | //結果を格納しているレジスタをブロッキング
|
---|
| 894 | pobj_BlockReg->lock(reg_ptr);
|
---|
| 895 |
|
---|
| 896 | //第2パラメータを取得
|
---|
| 897 | i=GetOneParameter(Parameter,i,temporary);
|
---|
| 898 | if(Parameter[i]){
|
---|
| 899 | SetError(1,NULL,cp);
|
---|
| 900 | return;
|
---|
| 901 | }
|
---|
| 902 |
|
---|
| 903 | int temp_reg=REG_NON;
|
---|
[75] | 904 | if( !NumOpe(&temp_reg,temporary,Type(),resultType) ){
|
---|
| 905 | return;
|
---|
| 906 | }
|
---|
[3] | 907 |
|
---|
| 908 | //レジスタのブロッキングを解除
|
---|
| 909 | pobj_BlockReg->clear();
|
---|
| 910 |
|
---|
| 911 | if(type==DEF_DOUBLE){
|
---|
[75] | 912 | ChangeTypeToXmm_Double(resultType.GetBasicType(),REG_XMM0,temp_reg);
|
---|
[3] | 913 |
|
---|
| 914 | //movsd qword ptr[reg_ptr],xmm0
|
---|
[226] | 915 | compiler.codeGenerator.op_movsd_MR(REG_XMM0,reg_ptr,0,MOD_BASE);
|
---|
[3] | 916 | }
|
---|
| 917 | else if(type==DEF_SINGLE){
|
---|
[75] | 918 | ChangeTypeToXmm_Single(resultType.GetBasicType(),REG_XMM0,temp_reg);
|
---|
[3] | 919 |
|
---|
| 920 | //movss dword ptr[reg_ptr],xmm0
|
---|
[226] | 921 | compiler.codeGenerator.op_movss_MR(REG_XMM0,reg_ptr,0,MOD_BASE);
|
---|
[3] | 922 | }
|
---|
| 923 | else{
|
---|
[308] | 924 | ChangeTypeToWhole(resultType,Type(type),REG_RCX,temp_reg);
|
---|
[3] | 925 |
|
---|
| 926 | //mov ptr[reg_ptr],rcx
|
---|
[308] | 927 | compiler.codeGenerator.op_mov_MR(Type(type).GetSize(),REG_RCX,reg_ptr,0,MOD_BASE);
|
---|
[3] | 928 | }
|
---|
| 929 | }
|
---|