Mercurial > hg > CbC > old > device
diff mc-code-ia32.c @ 189:f53d70110377
immediate instructions.
author | kono |
---|---|
date | Mon, 01 Dec 2003 21:18:45 +0900 |
parents | dffcccf8b1cb |
children | 1b1c58483e67 |
line wrap: on
line diff
--- a/mc-code-ia32.c Mon Dec 01 20:07:57 2003 +0900 +++ b/mc-code-ia32.c Mon Dec 01 21:18:45 2003 +0900 @@ -1254,6 +1254,54 @@ regv[creg]=1; } +int +code_const_op_p(int op,int v) +{ + if (DIV||UDIV||MOD||UMOD) return 0; + else return 1; +} + +void +oprtc(int op,int orn) +{ + char *crn = register_name(creg,0); + + switch(op) { + case LSHIFT: + case ULSHIFT: + printf("\tsall $%d,%s\n",orn,crn); + return; + case RSHIFT: + printf("\tsarl $%d,%s\n",orn,crn); + return; + case URSHIFT: + printf("\tshrl $%d,%s\n",orn,crn); + return; + case ADD: + printf("\taddl $%d,%s\n",orn,crn); + break; + case SUB: case CMP: + printf("\tsubl $%d,%s\n",orn,crn); + break; + case BAND: + printf("\tandl $%d,%s\n",orn,crn); + break; + case EOR: + printf("\txorl $%d,%s\n",orn,crn); + break; + case BOR: + printf("\torl $%d,%s\n",orn,crn); + break; + case MUL: + case UMUL: + printf("\t%s $%d,%s\n","imull",orn,crn); + break; + default: + error(-1); + } +} + + static int edx_stack=0; int