aboutsummaryrefslogtreecommitdiff
path: root/Intermediate.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-08-20 14:47:15 +0200
committertomsmeding <tom.smeding@gmail.com>2017-08-20 14:47:15 +0200
commitc36fd5a174ab74465b8562c5fb4fa69a25dfca79 (patch)
treecebd29dfb75e4713934a995ad13b957769194e7d /Intermediate.hs
parentf8d264f2b18fccdc3b96d8fb66656128a25137f2 (diff)
Fourth
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