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:
parent
1a78659dfa
commit
d8d17705c4
5 changed files with 28 additions and 16 deletions
23
lisc/parse.c
23
lisc/parse.c
|
@ -13,17 +13,18 @@ enum {
|
|||
Ins insb[NIns], *curi;
|
||||
|
||||
OpDesc opdesc[OLast] = {
|
||||
[OAdd] = { 2, 1, "add" },
|
||||
[OSub] = { 2, 0, "sub" },
|
||||
[ODiv] = { 2, 0, "div" },
|
||||
[ORem] = { 2, 0, "rem" },
|
||||
[OStore] = { 2, 0, "store" },
|
||||
[OLoad] = { 1, 0, "load" },
|
||||
[ONop] = { 0, 0, "nop" },
|
||||
[OCopy] = { 1, 0, "copy" },
|
||||
[OSwap] = { 2, 1, "swap" },
|
||||
[OIADiv] = { 1, 0, "iadiv" },
|
||||
[OIACltd] = { 0, 0, "iacltd" },
|
||||
/* NAME ARTY C */
|
||||
[OAdd] = { "add", 2, T },
|
||||
[OSub] = { "sub", 2, F },
|
||||
[ODiv] = { "div", 2, U },
|
||||
[ORem] = { "rem", 2, U },
|
||||
[OStore] = { "store", 2, U },
|
||||
[OLoad] = { "load", 1, U },
|
||||
[ONop] = { "nop", 0, U },
|
||||
[OCopy] = { "copy", 1, U },
|
||||
[OSwap] = { "swap", 2, T },
|
||||
[OIADiv] = { "iadiv", 1, U },
|
||||
[OIACltd] = { "iacltd", 0, U },
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue