Skip to content

Instantly share code, notes, and snippets.

@AndreasPK
Created October 15, 2019 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreasPK/302dd811ae0ac5d8c1e4278f77388067 to your computer and use it in GitHub Desktop.
Save AndreasPK/302dd811ae0ac5d8c1e4278f77388067 to your computer and use it in GitHub Desktop.
compiler\nativeGen\X86\CodeGen.hs:169:1: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In an equation for `verifyBasicBlock':
Patterns not matched: _ :: [Instr]
|
169 | verifyBasicBlock instrs
-- Verifying basic blocks is cheap, but not cheap enough to enable it unconditionally.
verifyBasicBlock :: [Instr] -> ()
verifyBasicBlock instrs
| debugIsOn = go False instrs
| not debugIsOn = ()
where
go _ [] = ()
go atEnd (i:instr)
= case i of
-- Start a new basic block
NEWBLOCK {} -> go False instr
-- Calls are not viable block terminators
CALL {} | atEnd -> faultyBlockWith i
| not atEnd -> go atEnd instr
-- All instructions ok, check if we reached the end and continue.
_ | not atEnd -> go (isJumpishInstr i) instr
-- Only jumps allowed at the end of basic blocks.
| otherwise -> if isJumpishInstr i
then go True instr
else faultyBlockWith i
faultyBlockWith i
= pprPanic "Non control flow instructions after end of basic block."
(ppr i <+> text "in:" $$ vcat (map ppr instrs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment