clean the commutativity + fix bug in emit

The commutativity information only makes sense for
arithmetic expressions.  To account for that, I introduced
a new tri-valued boolean type B3.  Memory operations, for
example, will receive an undefined commutativity trit.

The code emitter was buggy when rega emitted instructions
like 'rax = add 1, rax', this is now fixed using the
commutativity information (we rewrite it in 'rax = add
rax, 1').
This commit is contained in:
Quentin Carbonneaux 2015-07-31 10:21:10 -04:00
parent 1a78659dfa
commit d8d17705c4
5 changed files with 28 additions and 16 deletions

View file

@ -350,11 +350,11 @@ rega(Fn *fn)
* situation
* eax = sub ebx, eax
*/
if (!opdesc[i->op].commut && r)
if (opdesc[i->op].comm == F && r)
BSET(cur.br, r);
t = i->arg[1].val;
i->arg[1] = ralloc(&cur, t);
if (!opdesc[i->op].commut && r)
if (opdesc[i->op].comm == F && r)
BCLR(cur.br, r);
}
}