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

@ -106,12 +106,20 @@ static inline int rtype(Ref r)
{ return req(r, R) ? -1 : r.type; }
enum {
OXXX = 0,
Ceq,
Csle,
NCmp,
};
enum {
OXXX,
/* public instruction */
OAdd,
OSub,
ODiv,
ORem,
OCmp,
OCmp1 = OCmp + NCmp-1,
OStore,
OLoad,
/* reserved instructions */
@ -120,6 +128,9 @@ enum {
OSwap,
OSign,
OXDiv,
OXCmp,
OXSet,
OXSet1 = OXSet + NCmp-1,
OLast
};