diff options
| author | jiang <30155751@qq.com> | 2014-04-30 14:24:44 +0800 |
|---|---|---|
| committer | jiang <30155751@qq.com> | 2014-04-30 14:24:44 +0800 |
| commit | 9ff288648b23537c205e4dad16002e2b9ca03203 (patch) | |
| tree | 04168042a0103b0dfde4491e8c664086db990711 /il-gen.c | |
| parent | 515169f21bf6c75a3179822e1dd9e006f5ef4412 (diff) | |
| download | tinycc-9ff288648b23537c205e4dad16002e2b9ca03203.tar.gz tinycc-9ff288648b23537c205e4dad16002e2b9ca03203.tar.bz2 | |
Restore eda2c756edc4dca004ba217d5bf361235dd9de1f
Diffstat (limited to 'il-gen.c')
| -rw-r--r-- | il-gen.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -516,7 +516,7 @@ int gtst(int inv, int t) break; } t = out_opj(c, t); - } else { /* VT_JMP || VT_JMPI */ + } else if (v == VT_JMP || v == VT_JMPI) { /* && or || optimization */ if ((v & 1) == inv) { /* insert vtop->c jump list in t */ @@ -529,6 +529,19 @@ int gtst(int inv, int t) t = gjmp(t); gsym(vtop->c.i); } + } else { + if (is_float(vtop->t)) { + vpushi(0); + gen_op(TOK_NE); + } + if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_FORWARD)) == VT_CONST) { + /* constant jmp optimization */ + if ((vtop->c.i != 0) != inv) + t = gjmp(t); + } else { + v = gv(RC_INT); + t = out_opj(IL_OP_BRTRUE - inv, t); + } } vtop--; return t; |
