diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2018-08-06 12:53:06 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-08-07 15:56:53 -0400 |
commit | aab8656ba0561e56048a1222c396d2d117aca5a7 (patch) | |
tree | 8d14345e7f042ba5700b4275950e44dcc0ca1be9 /compiler/nativeGen/SPARC | |
parent | f22baa424aed66cd75ea05d4db7efdcd0e021217 (diff) | |
download | haskell-aab8656ba0561e56048a1222c396d2d117aca5a7.tar.gz |
Turn on MonadFail desugaring by default
Summary:
This contains two commits:
----
Make GHC's code-base compatible w/ `MonadFail`
There were a couple of use-sites which implicitly used pattern-matches
in `do`-notation even though the underlying `Monad` didn't explicitly
support `fail`
This refactoring turns those use-sites into explicit case
discrimations and adds an `MonadFail` instance for `UniqSM`
(`UniqSM` was the worst offender so this has been postponed for a
follow-up refactoring)
---
Turn on MonadFail desugaring by default
This finally implements the phase scheduled for GHC 8.6 according to
https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail#Transitionalstrategy
This also preserves some tests that assumed MonadFail desugaring to be
active; all ghc boot libs were already made compatible with this
`MonadFail` long ago, so no changes were needed there.
Test Plan: Locally performed ./validate --fast
Reviewers: bgamari, simonmar, jrtc27, RyanGlScott
Reviewed By: bgamari
Subscribers: bgamari, RyanGlScott, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D5028
Diffstat (limited to 'compiler/nativeGen/SPARC')
-rw-r--r-- | compiler/nativeGen/SPARC/CodeGen.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs index 90d6b0d67b..98e062df62 100644 --- a/compiler/nativeGen/SPARC/CodeGen.hs +++ b/compiler/nativeGen/SPARC/CodeGen.hs @@ -423,7 +423,10 @@ genCCall target dest_regs args return (unitOL (CALL (Left (litToImm (CmmLabel lbl))) n_argRegs_used False)) ForeignTarget expr _ - -> do (dyn_c, [dyn_r]) <- arg_to_int_vregs expr + -> do (dyn_c, dyn_rs) <- arg_to_int_vregs expr + let dyn_r = case dyn_rs of + [dyn_r'] -> dyn_r' + _ -> panic "SPARC.CodeGen.genCCall: arg_to_int" return (dyn_c `snocOL` CALL (Right dyn_r) n_argRegs_used False) PrimTarget mop @@ -433,7 +436,10 @@ genCCall target dest_regs args return (unitOL (CALL (Left (litToImm (CmmLabel lbl))) n_argRegs_used False)) Right mopExpr -> do - (dyn_c, [dyn_r]) <- arg_to_int_vregs mopExpr + (dyn_c, dyn_rs) <- arg_to_int_vregs mopExpr + let dyn_r = case dyn_rs of + [dyn_r'] -> dyn_r' + _ -> panic "SPARC.CodeGen.genCCall: arg_to_int" return (dyn_c `snocOL` CALL (Right dyn_r) n_argRegs_used False) return lblOrMopExpr |