diff boolean.rhope @ 170:ac5c2d78663f

Inline calls to If@Boolean when static type info is present
author Mike Pavone <pavone@retrodev.com>
date Sun, 08 May 2011 18:21:19 -0700
parents 38d9cd036d49
children
line wrap: on
line diff
--- a/boolean.rhope	Sun May 08 01:37:44 2011 -0700
+++ b/boolean.rhope	Sun May 08 18:21:19 2011 -0700
@@ -21,3 +21,25 @@
 	out <- [backend]Store Function[ffunc]
 }
 
+Compile Boolean Inline Check[func,op,type,in,outyes,outno:out,no inline]
+{
+	,no inline <- If[[op]=["If"]]
+	{
+		,no inline <- If[[[type]Name >>]=["Boolean"]]
+		{
+			ifyes <- [[func]Instruction Stream
+			]Move[in, outyes]
+			
+			ifno <- [[func]Instruction Stream
+			]Move[in, outno]
+			
+			,inval <- [func]Read Field[Cast[in, type] "Val"]
+			{ 
+				out <- [[~]Do If[inval, ifyes]
+					]Do If[NotCond[inval], ifno]
+			}
+			
+		}
+	}
+}
+