Commit 45cbf5e1 authored by nr@eecs.harvard.edu's avatar nr@eecs.harvard.edu
Browse files

add a big diagnostic for failures in CmmCvt.toZgraph

parent 9d2b0ebb
......@@ -27,7 +27,7 @@ cmmOfZgraph = cmmMapGraph ofZgraph
toZgraph :: String -> ListGraph CmmStmt -> UniqSM CmmGraph
toZgraph _ (ListGraph []) = lgraphOfAGraph emptyAGraph
toZgraph fun_name (ListGraph (BasicBlock id ss : other_blocks)) =
toZgraph fun_name g@(ListGraph (BasicBlock id ss : other_blocks)) =
labelAGraph id $ mkStmts ss <*> foldr addBlock emptyAGraph other_blocks
where addBlock (BasicBlock id ss) g = mkLabel id <*> mkStmts ss <*> g
mkStmts (CmmNop : ss) = mkNop <*> mkStmts ss
......@@ -43,8 +43,7 @@ toZgraph fun_name (ListGraph (BasicBlock id ss : other_blocks)) =
mkStmts (last : []) = mkLast last
mkStmts [] = bad "fell off end"
mkStmts (_ : _ : _) = bad "last node not at end"
bad msg = panic (msg {- ++ " in block " ++ showSDoc (ppr b) -}
++ " in function " ++ fun_name)
bad msg = pprPanic (msg ++ " in function " ++ fun_name) (ppr g)
mkLast (CmmCall f [] args _ CmmNeverReturns) = mkFinalCall f args
mkLast (CmmSwitch scrutinee table) = mkSwitch scrutinee table
mkLast (CmmJump tgt args) = mkJump tgt args
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment