aboutsummaryrefslogtreecommitdiff
path: root/Intermediate.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Intermediate.hs')
-rw-r--r--Intermediate.hs25
1 files changed, 14 insertions, 11 deletions
diff --git a/Intermediate.hs b/Intermediate.hs
index f97d407..ad3cb89 100644
--- a/Intermediate.hs
+++ b/Intermediate.hs
@@ -50,17 +50,6 @@ data CmpType
deriving (Show, Eq)
-refSize :: Ref -> Size
-refSize (Temp sz _) = sz
-refSize (Argument sz _) = sz
-refSize (Global sz _) = sz
-refSize (Constant sz _) = sz
-
-isConstant :: Ref -> Bool
-isConstant (Constant _ _) = True
-isConstant _ = False
-
-
instance Pretty BB where
prettyI i (BB bid inss term) =
"{{{(" ++ show bid ++ ")\n" ++ indent (i+1) ++
@@ -151,6 +140,20 @@ instance Pretty CmpType where
prettyI _ CLeq = "jle"
+blockIdOf :: BB -> Id
+blockIdOf (BB bid _ _) = bid
+
+refSize :: Ref -> Size
+refSize (Temp sz _) = sz
+refSize (Argument sz _) = sz
+refSize (Global sz _) = sz
+refSize (Constant sz _) = sz
+
+isConstant :: Ref -> Bool
+isConstant (Constant _ _) = True
+isConstant _ = False
+
+
evaluateArith :: ArithType -> Value -> Value -> Value
evaluateArith at a b = case at of
AAdd -> a + b