diff options
| author | U-UNIT1\dennis <dennis@UNIT1.(none)> | 2010-04-03 21:20:34 +0300 |
|---|---|---|
| committer | U-UNIT1\dennis <dennis@UNIT1.(none)> | 2010-04-03 21:20:34 +0300 |
| commit | d3c432244c0075b483e2c2489fc9cfc45a853497 (patch) | |
| tree | 40fce27761c0f9c422827181551ef4b24c49c1fb | |
| parent | 27bcc8f583fc86d58f918fdab01f41ef4a83cdb1 (diff) | |
| download | tinycc-d3c432244c0075b483e2c2489fc9cfc45a853497.tar.gz tinycc-d3c432244c0075b483e2c2489fc9cfc45a853497.tar.bz2 | |
generate inc and dec for smaller code
| -rwxr-xr-x[-rw-r--r--] | i386-gen.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/i386-gen.c b/i386-gen.c index 5ea70df..f8795c1 100644..100755 --- a/i386-gen.c +++ b/i386-gen.c @@ -686,10 +686,16 @@ ST_FUNC void gen_opi(int op) vswap(); c = vtop->c.i; if (c == (char)c) { - /* XXX: generate inc and dec for smaller code ? */ - o(0x83); - o(0xc0 | (opc << 3) | r); - g(c); + /* generate inc and dec for smaller code */ + if (c==1 && opc==0) { + o (0x40 | r); // inc + } else if (c==1 && opc==5) { + o (0x48 | r); // dec + } else { + o(0x83); + o(0xc0 | (opc << 3) | r); + g(c); + } } else { o(0x81); oad(0xc0 | (opc << 3) | r, c); |
