From ecd369e0fbdc71c74ccd327899f8915045a01630 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 29 Nov 2019 21:06:54 +0100 Subject: WIP liveness analysis implementation --- Intermediate.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Intermediate.hs') 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" $ -- cgit v1.2.3-54-g00ecf