Wrap generated graphs to ensure entry and exit nodes have no extra edges

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
2024-05-09 21:08:32 -07:00
parent 69d1ecebae
commit 734e82ff6d
3 changed files with 14 additions and 18 deletions

View File

@@ -112,6 +112,9 @@ singleton bss = record
; outputs = zero ∷ []
}
wrap : Graph → Graph
wrap g = singleton [] ↦ g ↦ singleton []
buildCfg : Stmt → Graph
buildCfg ⟨ bs₁ ⟩ = singleton (bs₁ ∷ [])
buildCfg (s₁ then s₂) = buildCfg s₁ ↦ buildCfg s₂