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

@ -355,7 +355,7 @@ spill(Fn *fn)
w = (Bits){{0}};
if (rtype(i->arg[1]) == RSym
&& !req(i->to, R)
&& !opdesc[i->op].commut) {
&& opdesc[i->op].comm == F) {
/* <arch>
* here we make sure that we
* will never have to compile