Commit a2bedb5c authored by Joachim Breitner's avatar Joachim Breitner

RegAlloc: Make some pattern matched complete

these actually are complete, but due to the use of pattern guards, the
compiler does not see that. Refactor the code that it does.

Differential Revision: https://phabricator.haskell.org/D2574
parent 4a03012a
......@@ -360,6 +360,9 @@ graphAddCoalesce (r1, r2) graph
, RegReal _ <- r2
= graph
| otherwise
= panic "graphAddCoalesce"
-- | Patch registers in code using the reg -> reg mapping in this graph.
patchRegsFromGraph
......
......@@ -897,12 +897,9 @@ livenessForward
livenessForward _ _ [] = []
livenessForward platform rsLiveEntry (li@(LiveInstr instr mLive) : lis)
| Nothing <- mLive
= li : livenessForward platform rsLiveEntry lis
| Just live <- mLive
, RU _ written <- regUsageOfInstr platform instr
= let
RU _ written = regUsageOfInstr platform instr
-- Regs that are written to but weren't live on entry to this instruction
-- are recorded as being born here.
rsBorn = mkUniqSet
......@@ -915,6 +912,9 @@ livenessForward platform rsLiveEntry (li@(LiveInstr instr mLive) : lis)
in LiveInstr instr (Just live { liveBorn = rsBorn })
: livenessForward platform rsLiveNext lis
| otherwise
= li : livenessForward platform rsLiveEntry lis
-- | Calculate liveness going backwards,
-- filling in when regs die, and what regs are live across each instruction
......
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