diff modules/il.tp @ 352:f74ce841fd1e

Produce something resembling correct il from low level dialect
author Michael Pavone <pavone@retrodev.com>
date Mon, 13 Apr 2015 22:42:27 -0700
parents a3b06d53bcb9
children a6cdcc1b1c02
line wrap: on
line diff
--- a/modules/il.tp	Mon Apr 13 22:41:00 2015 -0700
+++ b/modules/il.tp	Mon Apr 13 22:42:27 2015 -0700
@@ -210,6 +210,14 @@
 		w <- { word }
 		l <- { long }
 		q <- { quad }
+		
+		sizeFromBytes <- :bytes {
+			if: bytes < 4 {
+				if: bytes = 1 { b } else: { w }
+			} else: {
+				if: bytes = 4 { l } else: { q }
+			}
+		}
 
 		eq <- { _eq }
 		neq <- { _neq }
@@ -296,7 +304,7 @@
 		}
 
 		cmp <- :ina inb size {
-			op2: _cmp a: ina out: inb size: size
+			op2: _cmp in: ina out: inb size: size
 		}
 
 		band <- :ina inb out size {
@@ -511,9 +519,11 @@
 				opcode <- { _bool }
 				cond <- { _cond }
 				out <- { _out }
-				name <- { _names get: _save }
+				name <- { _names get: _bool }
 				numops <- { 0 }
-
+				string <- {
+					name . " " . cond . " " . out
+				}
 			}
 		}