start work on comparisons

There are two things I overlooked so far.

1. Binary instructions like cmp that do not have a result
   in registers need the size suffix sometimes, for example
   when comparing a spill location with a constant.

2. The register allocator needs to be adapted to support the
   comparison instruction: it is not possible to compare two
   spill locations without using a register.
This commit is contained in:
Quentin Carbonneaux 2015-08-05 11:37:10 -04:00
parent 1477dffe32
commit 246a48ba94
6 changed files with 109 additions and 22 deletions

View file

@ -38,7 +38,7 @@ tmpuse(Ref r, int use, int loop, Fn *fn)
return;
t = &fn->tmp[r.val];
t->nuse += use;
t->ndef += 1 - use;
t->ndef += !use;
t->cost += loop;
}