From 20142a7dfd176c4f587adb21e1d0161018f1ec7f Mon Sep 17 00:00:00 2001 From: "benl@ouroborus.net" Date: Wed, 23 Jun 2010 08:50:02 +0000 Subject: [PATCH] NCG: Emit a warning on unreachable code block instead of panicing --- compiler/nativeGen/RegAlloc/Linear/Main.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/nativeGen/RegAlloc/Linear/Main.hs b/compiler/nativeGen/RegAlloc/Linear/Main.hs index 29cc0e5..63f2814 100644 --- a/compiler/nativeGen/RegAlloc/Linear/Main.hs +++ b/compiler/nativeGen/RegAlloc/Linear/Main.hs @@ -206,15 +206,16 @@ linearRA_SCCs first_id block_live blocksAcc (CyclicSCC blocks : sccs) some reason then this function will loop. We should probably do some more sanity checking to guard against this eventuality. -} - + process _ _ [] [] accum _ = return $ reverse accum process first_id block_live [] next_round accum madeProgress | not madeProgress - = pprPanic "RegAlloc.Linear.Main.process: no progress made, bailing out" - ( text "stalled blocks:" + = pprTrace "RegAlloc.Linear.Main.process: no progress made, bailing out." + ( text "Unreachable blocks:" $$ vcat (map ppr next_round)) + $ return $ reverse accum | otherwise = process first_id block_live @@ -380,9 +381,9 @@ genRaInsn block_live new_instrs block_id instr r_dying w_dying = clobber_saves <- saveClobberedTemps real_written r_dying -- debugging - freeregs <- getFreeRegsR +{- freeregs <- getFreeRegsR assig <- getAssigR -{- pprTrace "genRaInsn" + pprTrace "genRaInsn" (ppr instr $$ text "r_dying = " <+> ppr r_dying $$ text "w_dying = " <+> ppr w_dying -- 1.7.10.4