Mercurial > hg > CbC > old > device
comparison mc-code-ia32.c @ 286:179e22f166ef register-assop
register assop fix
author | kono |
---|---|
date | Wed, 02 Jun 2004 13:19:13 +0900 |
parents | affb054fe920 |
children | a0779a414855 |
comparison
equal
deleted
inserted
replaced
285:912b54949344 | 286:179e22f166ef |
---|---|
1309 } | 1309 } |
1310 | 1310 |
1311 void | 1311 void |
1312 code_assign_register(int e2,int byte,int creg) { | 1312 code_assign_register(int e2,int byte,int creg) { |
1313 use_int(creg); | 1313 use_int(creg); |
1314 printf("\tmovl %s,%s\n",register_name(creg,0),register_name(e2,0)); | 1314 if (creg!=e2) |
1315 printf("\tmovl %s,%s\n",register_name(creg,0),register_name(e2,0)); | |
1315 } | 1316 } |
1316 | 1317 |
1317 void | 1318 void |
1318 code_assign(int e2,int byte,int creg) { | 1319 code_assign(int e2,int byte,int creg) { |
1319 use_int(e2); | 1320 use_int(e2); |
1328 int reg; | 1329 int reg; |
1329 int xreg = creg; | 1330 int xreg = creg; |
1330 creg = reg = e2; | 1331 creg = reg = e2; |
1331 tosop(op,reg,xreg); | 1332 tosop(op,reg,xreg); |
1332 creg = xreg; | 1333 creg = xreg; |
1333 printf("\tmovl %s,%s\n",register_name(reg,0),register_name(creg,0)); | 1334 // printf("\tmovl %s,%s\n",register_name(reg,0),register_name(creg,0)); |
1334 regs[creg]=regv[creg]=1; | 1335 regs[creg]=regv[creg]=1; |
1335 } | 1336 } |
1336 | 1337 |
1337 | 1338 |
1338 void | 1339 void |
2642 opl = 0; | 2643 opl = 0; |
2643 | 2644 |
2644 switch(op) { | 2645 switch(op) { |
2645 case LLSHIFT: | 2646 case LLSHIFT: |
2646 case LULSHIFT: | 2647 case LULSHIFT: |
2647 printf("\tshldl $%d,%%eax,%%edx\n",vl); | 2648 printf("\tshldl $%d,%s,%s\n",vl,l_eax(reg),l_edx(reg)); |
2648 printf("\tsall $%d,%%eax\n",vl); | 2649 printf("\tsall $%d,%s\n",vl,l_eax(reg)); |
2649 check_lreg(reg); | |
2650 return; | 2650 return; |
2651 case LRSHIFT: | 2651 case LRSHIFT: |
2652 printf("\tshrdl $%d,%%edx,%%eax\n",vl); | 2652 printf("\tshrdl $%d,%s,%s\n",vl,l_edx(reg),l_eax(reg)); |
2653 printf("\tsarl $%d,%%edx\n",vl); | 2653 printf("\tsarl $%d,%s\n",vl,l_edx(reg)); |
2654 check_lreg(reg); | |
2655 return; | 2654 return; |
2656 case LURSHIFT: | 2655 case LURSHIFT: |
2657 printf("\tshrdl $%d,%%edx,%%eax\n",vl); | 2656 printf("\tshrdl $%d,%s,%s\n",vl,l_edx(reg),l_eax(reg)); |
2658 printf("\tshrl $%d,%%edx\n",vl); | 2657 printf("\tshrl $%d,%s\n",vl,l_edx(reg)); |
2659 check_lreg(reg); | |
2660 return; | 2658 return; |
2661 } | 2659 } |
2662 switch(op) { | 2660 switch(op) { |
2663 case LADD: opl="addl";oph="adcl"; break; | 2661 case LADD: opl="addl";oph="adcl"; break; |
2664 case LSUB: opl="subl";oph="sbbl"; break; | 2662 case LSUB: opl="subl";oph="sbbl"; break; |
2665 case LBAND: opl=oph="andl"; break; | 2663 case LBAND: opl=oph="andl"; break; |
2666 case LEOR: opl=oph="xorl"; break; | 2664 case LEOR: opl=oph="xorl"; break; |
2667 case LBOR: opl=oph="orl"; break; | 2665 case LBOR: opl=oph="orl"; break; |
2668 default: error(-1); | 2666 default: error(-1); |
2669 } | 2667 } |
2670 printf("\t%s $%d,%%eax\n\t%s $%d,%%edx\n",opl,vl,oph,vh); | 2668 printf("\t%s $%d,%s\n\t%s $%d,%s\n",opl,vl,l_eax(reg),oph,vh,l_edx(reg)); |
2671 check_lreg(reg); | |
2672 } | 2669 } |
2673 | 2670 |
2674 void emit_lpop_free(int e1) | 2671 void emit_lpop_free(int e1) |
2675 { | 2672 { |
2676 // printf("\taddl $8,%%esp\n"); | 2673 // printf("\taddl $8,%%esp\n"); |