From 246a48ba94b92e6c1e02964d46269e0903b7a723 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Wed, 5 Aug 2015 11:37:10 -0400 Subject: 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. --- lisc/lisc.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lisc/lisc.h') diff --git a/lisc/lisc.h b/lisc/lisc.h index 46fb163..1291fea 100644 --- a/lisc/lisc.h +++ b/lisc/lisc.h @@ -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 }; -- cgit 1.4.1