Commit d361262b authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Make -firrefutable-tuples a dynamic flag

parent ee7c4f43
...@@ -38,7 +38,6 @@ import DynFlags ...@@ -38,7 +38,6 @@ import DynFlags
import UniqFM import UniqFM
import UniqSupply import UniqSupply
import CostCentre import CostCentre
import StaticFlags
import Panic import Panic
import Binary import Binary
import SrcLoc import SrcLoc
......
...@@ -269,6 +269,7 @@ data DynFlag ...@@ -269,6 +269,7 @@ data DynFlag
| Opt_PedanticBottoms -- Be picky about how we treat bottom | Opt_PedanticBottoms -- Be picky about how we treat bottom
| Opt_LlvmTBAA -- Use LLVM TBAA infastructure for improving AA (hidden flag) | Opt_LlvmTBAA -- Use LLVM TBAA infastructure for improving AA (hidden flag)
| Opt_RegLiveness -- Use the STG Reg liveness information (hidden flag) | Opt_RegLiveness -- Use the STG Reg liveness information (hidden flag)
| Opt_IrrefutableTuples
-- Interface files -- Interface files
| Opt_IgnoreInterfacePragmas | Opt_IgnoreInterfacePragmas
...@@ -1975,6 +1976,7 @@ fFlags = [ ...@@ -1975,6 +1976,7 @@ fFlags = [
( "regs-iterative", Opt_RegsIterative, nop ), ( "regs-iterative", Opt_RegsIterative, nop ),
( "llvm-tbaa", Opt_LlvmTBAA, nop), -- hidden flag ( "llvm-tbaa", Opt_LlvmTBAA, nop), -- hidden flag
( "regs-liveness", Opt_RegLiveness, nop), -- hidden flag ( "regs-liveness", Opt_RegLiveness, nop), -- hidden flag
( "irrefutable-tuples", Opt_IrrefutableTuples, nop ),
( "gen-manifest", Opt_GenManifest, nop ), ( "gen-manifest", Opt_GenManifest, nop ),
( "embed-manifest", Opt_EmbedManifest, nop ), ( "embed-manifest", Opt_EmbedManifest, nop ),
( "ext-core", Opt_EmitExternalCore, nop ), ( "ext-core", Opt_EmitExternalCore, nop ),
......
...@@ -48,7 +48,6 @@ module StaticFlags ( ...@@ -48,7 +48,6 @@ module StaticFlags (
-- language opts -- language opts
opt_DictsStrict, opt_DictsStrict,
opt_IrrefutableTuples,
opt_Parallel, opt_Parallel,
-- optimisation opts -- optimisation opts
...@@ -266,9 +265,6 @@ opt_Hpc = lookUp (fsLit "-fhpc") ...@@ -266,9 +265,6 @@ opt_Hpc = lookUp (fsLit "-fhpc")
opt_DictsStrict :: Bool opt_DictsStrict :: Bool
opt_DictsStrict = lookUp (fsLit "-fdicts-strict") opt_DictsStrict = lookUp (fsLit "-fdicts-strict")
opt_IrrefutableTuples :: Bool
opt_IrrefutableTuples = lookUp (fsLit "-firrefutable-tuples")
opt_Parallel :: Bool opt_Parallel :: Bool
opt_Parallel = lookUp (fsLit "-fparallel") opt_Parallel = lookUp (fsLit "-fparallel")
......
...@@ -469,6 +469,8 @@ tc_pat penv (TuplePat pats boxity _) pat_ty thing_inside ...@@ -469,6 +469,8 @@ tc_pat penv (TuplePat pats boxity _) pat_ty thing_inside
; (coi, arg_tys) <- matchExpectedPatTy (matchExpectedTyConApp tc) pat_ty ; (coi, arg_tys) <- matchExpectedPatTy (matchExpectedTyConApp tc) pat_ty
; (pats', res) <- tc_lpats penv pats arg_tys thing_inside ; (pats', res) <- tc_lpats penv pats arg_tys thing_inside
; dflags <- getDynFlags
-- Under flag control turn a pattern (x,y,z) into ~(x,y,z) -- Under flag control turn a pattern (x,y,z) into ~(x,y,z)
-- so that we can experiment with lazy tuple-matching. -- so that we can experiment with lazy tuple-matching.
-- This is a pretty odd place to make the switch, but -- This is a pretty odd place to make the switch, but
...@@ -477,7 +479,7 @@ tc_pat penv (TuplePat pats boxity _) pat_ty thing_inside ...@@ -477,7 +479,7 @@ tc_pat penv (TuplePat pats boxity _) pat_ty thing_inside
-- pat_ty /= pat_ty iff coi /= IdCo -- pat_ty /= pat_ty iff coi /= IdCo
unmangled_result = TuplePat pats' boxity pat_ty' unmangled_result = TuplePat pats' boxity pat_ty'
possibly_mangled_result possibly_mangled_result
| opt_IrrefutableTuples && | dopt Opt_IrrefutableTuples dflags &&
isBoxed boxity = LazyPat (noLoc unmangled_result) isBoxed boxity = LazyPat (noLoc unmangled_result)
| otherwise = unmangled_result | otherwise = unmangled_result
......
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