summary refs log tree commit diff
path: root/lisc/lisc.h
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-05 11:37:10 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:30 -0400
commit246a48ba94b92e6c1e02964d46269e0903b7a723 (patch)
tree5bbb97fa09f78af4c2c3f4db3b8c958b724fbbe6 /lisc/lisc.h
parent1477dffe32ae769c15ee49e77c5f0856bd0f56ea (diff)
downloadroux-246a48ba94b92e6c1e02964d46269e0903b7a723.tar.gz
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.
Diffstat (limited to 'lisc/lisc.h')
-rw-r--r--lisc/lisc.h13
1 files changed, 12 insertions, 1 deletions
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
 };