summaryrefslogtreecommitdiff
path: root/Intermediate.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Intermediate.hs')
-rw-r--r--Intermediate.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Intermediate.hs b/Intermediate.hs
index 2705431..6a11bf0 100644
--- a/Intermediate.hs
+++ b/Intermediate.hs
@@ -82,6 +82,17 @@ instance AllRefs Terminator where
allRefs IExit = []
allRefs IUnknown = []
+outEdges :: BB -> [Int]
+outEdges (BB _ _ term) = outEdgesT term
+
+outEdgesT :: Terminator -> [Int]
+outEdgesT (IBr _ a b) = [a, b]
+outEdgesT (IJmp a) = [a]
+outEdgesT (IRet _) = []
+outEdgesT (ITailC _ _) = []
+outEdgesT IExit = []
+outEdgesT IUnknown = []
+
instance Show IRProgram where
show (IRProgram bbs gfds datas) = intercalate "\n" $