diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2016-10-05 23:37:03 -0400 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2016-10-06 17:47:46 -0400 |
commit | a2bedb5c67b8d0d20dfb22fdeac3fcd07fe5452e (patch) | |
tree | 7639bbb62540f4c42d948b065c7183a5c20c88a3 /compiler/nativeGen | |
parent | 4a03012aeb4cb6685221b30aea2b1a78145d902b (diff) | |
download | haskell-a2bedb5c67b8d0d20dfb22fdeac3fcd07fe5452e.tar.gz |
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
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r-- | compiler/nativeGen/RegAlloc/Graph/Main.hs | 3 | ||||
-rw-r--r-- | compiler/nativeGen/RegAlloc/Liveness.hs | 10 |
2 files changed, 8 insertions, 5 deletions
diff --git a/compiler/nativeGen/RegAlloc/Graph/Main.hs b/compiler/nativeGen/RegAlloc/Graph/Main.hs index 97c2b42e82..e819fe8870 100644 --- a/compiler/nativeGen/RegAlloc/Graph/Main.hs +++ b/compiler/nativeGen/RegAlloc/Graph/Main.hs @@ -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 diff --git a/compiler/nativeGen/RegAlloc/Liveness.hs b/compiler/nativeGen/RegAlloc/Liveness.hs index ea010a52e9..988bda05a8 100644 --- a/compiler/nativeGen/RegAlloc/Liveness.hs +++ b/compiler/nativeGen/RegAlloc/Liveness.hs @@ -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 + | Just live <- mLive = 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 |