diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2018-06-02 11:56:58 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-02 16:21:12 -0400 |
commit | faee23bb69ca813296da484bc177f4480bcaee9f (patch) | |
tree | 28e1c99f0de9d505c1df81ae7459839f5db4121c /compiler/parser | |
parent | 13a86606e51400bc2a81a0e04cfbb94ada5d2620 (diff) | |
download | haskell-faee23bb69ca813296da484bc177f4480bcaee9f.tar.gz |
vectorise: Put it out of its misery
Poor DPH and its vectoriser have long been languishing; sadly it seems there is
little chance that the effort will be rekindled. Every few years we discuss
what to do with this mass of code and at least once we have agreed that it
should be archived on a branch and removed from `master`. Here we do just that,
eliminating heaps of dead code in the process.
Here we drop the ParallelArrays extension, the vectoriser, and the `vector` and
`primitive` submodules.
Test Plan: Validate
Reviewers: simonpj, simonmar, hvr, goldfire, alanz
Reviewed By: simonmar
Subscribers: goldfire, rwbarton, thomie, mpickering, carter
Differential Revision: https://phabricator.haskell.org/D4761
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/Lexer.x | 23 | ||||
-rw-r--r-- | compiler/parser/Parser.y | 68 | ||||
-rw-r--r-- | compiler/parser/RdrHsSyn.hs | 5 |
3 files changed, 9 insertions, 87 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 83beef210d..fc8b988332 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -371,11 +371,6 @@ $tab { warnTab } -- "special" symbols <0> { - "[:" / { ifExtension parrEnabled } { token ITopabrack } - ":]" / { ifExtension parrEnabled } { token ITcpabrack } -} - -<0> { "[|" / { ifExtension thQuotesEnabled } { token (ITopenExpQuote NoE NormalSyntax) } "[||" / { ifExtension thQuotesEnabled } { token (ITopenTExpQuote NoE) } @@ -665,9 +660,6 @@ data Token | IToptions_prag String | ITinclude_prag String | ITlanguage_prag - | ITvect_prag SourceText - | ITvect_scalar_prag SourceText - | ITnovect_prag SourceText | ITminimal_prag SourceText | IToverlappable_prag SourceText -- instance overlap mode | IToverlapping_prag SourceText -- instance overlap mode @@ -2230,7 +2222,6 @@ data ExtBits = FfiBit | InterruptibleFfiBit | CApiFfiBit - | ParrBit | ArrowsBit | ThBit | ThQuotesBit @@ -2271,8 +2262,6 @@ data ExtBits always :: ExtsBitmap -> Bool always _ = True -parrEnabled :: ExtsBitmap -> Bool -parrEnabled = xtest ParrBit arrowsEnabled :: ExtsBitmap -> Bool arrowsEnabled = xtest ArrowsBit thEnabled :: ExtsBitmap -> Bool @@ -2357,7 +2346,6 @@ mkParserFlags flags = bitmap = FfiBit `setBitIf` xopt LangExt.ForeignFunctionInterface flags .|. InterruptibleFfiBit `setBitIf` xopt LangExt.InterruptibleFFI flags .|. CApiFfiBit `setBitIf` xopt LangExt.CApiFFI flags - .|. ParrBit `setBitIf` xopt LangExt.ParallelArrays flags .|. ArrowsBit `setBitIf` xopt LangExt.Arrows flags .|. ThBit `setBitIf` xopt LangExt.TemplateHaskell flags .|. ThQuotesBit `setBitIf` xopt LangExt.TemplateHaskellQuotes flags @@ -2878,8 +2866,6 @@ oneWordPrags = Map.fromList [ ("unpack", strtoken (\s -> ITunpack_prag (SourceText s))), ("nounpack", strtoken (\s -> ITnounpack_prag (SourceText s))), ("ann", strtoken (\s -> ITann_prag (SourceText s))), - ("vectorize", strtoken (\s -> ITvect_prag (SourceText s))), - ("novectorize", strtoken (\s -> ITnovect_prag (SourceText s))), ("minimal", strtoken (\s -> ITminimal_prag (SourceText s))), ("overlaps", strtoken (\s -> IToverlaps_prag (SourceText s))), ("overlappable", strtoken (\s -> IToverlappable_prag (SourceText s))), @@ -2890,7 +2876,7 @@ oneWordPrags = Map.fromList [ ("column", columnPrag) ] -twoWordPrags = Map.fromList([ +twoWordPrags = Map.fromList [ ("inline conlike", strtoken (\s -> (ITinline_prag (SourceText s) Inline ConLike))), ("notinline conlike", @@ -2898,9 +2884,8 @@ twoWordPrags = Map.fromList([ ("specialize inline", strtoken (\s -> (ITspec_inline_prag (SourceText s) True))), ("specialize notinline", - strtoken (\s -> (ITspec_inline_prag (SourceText s) False))), - ("vectorize scalar", - strtoken (\s -> ITvect_scalar_prag (SourceText s)))]) + strtoken (\s -> (ITspec_inline_prag (SourceText s) False))) + ] dispatch_pragmas :: Map String Action -> Action dispatch_pragmas prags span buf len = case Map.lookup (clean_pragma (lexemeToString buf len)) prags of @@ -2922,8 +2907,6 @@ clean_pragma prag = canon_ws (map toLower (unprefix prag)) canonical prag' = case prag' of "noinline" -> "notinline" "specialise" -> "specialize" - "vectorise" -> "vectorize" - "novectorise" -> "novectorize" "constructorlike" -> "conlike" _ -> prag' canon_ws s = unwords (map canonical (words s)) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index c6face8be2..533e21d0d1 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -79,7 +79,7 @@ import TysPrim ( eqPrimTyCon ) import PrelNames ( eqTyCon_RDR ) import TysWiredIn ( unitTyCon, unitDataCon, tupleTyCon, tupleDataCon, nilDataCon, unboxedUnitTyCon, unboxedUnitDataCon, - listTyCon_RDR, parrTyCon_RDR, consDataCon_RDR ) + listTyCon_RDR, consDataCon_RDR ) -- compiler/utils import Util ( looksLikePackageName ) @@ -88,7 +88,7 @@ import GhcPrelude import qualified GHC.LanguageExtensions as LangExt } -%expect 233 -- shift/reduce conflicts +%expect 229 -- shift/reduce conflicts {- Last updated: 14 Apr 2018 @@ -502,9 +502,6 @@ are the most common patterns, rewritten as regular expressions for clarity: '{-# UNPACK' { L _ (ITunpack_prag _) } '{-# NOUNPACK' { L _ (ITnounpack_prag _) } '{-# ANN' { L _ (ITann_prag _) } - '{-# VECTORISE' { L _ (ITvect_prag _) } - '{-# VECTORISE_SCALAR' { L _ (ITvect_scalar_prag _) } - '{-# NOVECTORISE' { L _ (ITnovect_prag _) } '{-# MINIMAL' { L _ (ITminimal_prag _) } '{-# CTYPE' { L _ (ITctype _) } '{-# OVERLAPPING' { L _ (IToverlapping_prag _) } @@ -1040,33 +1037,6 @@ topdecl :: { LHsDecl GhcPs } [mo $1,mc $3] } | '{-# RULES' rules '#-}' {% ams (sLL $1 $> $ RuleD noExt (HsRules noExt (getRULES_PRAGs $1) (fromOL $2))) [mo $1,mc $3] } - | '{-# VECTORISE' qvar '=' exp '#-}' {% ams (sLL $1 $> $ VectD noExt (HsVect noExt (getVECT_PRAGs $1) $2 $4)) - [mo $1,mj AnnEqual $3 - ,mc $5] } - | '{-# NOVECTORISE' qvar '#-}' {% ams (sLL $1 $> $ VectD noExt (HsNoVect noExt (getNOVECT_PRAGs $1) $2)) - [mo $1,mc $3] } - | '{-# VECTORISE' 'type' gtycon '#-}' - {% ams (sLL $1 $> $ - VectD noExt (HsVectType (VectTypePR (getVECT_PRAGs $1) $3 Nothing) False)) - [mo $1,mj AnnType $2,mc $4] } - - | '{-# VECTORISE_SCALAR' 'type' gtycon '#-}' - {% ams (sLL $1 $> $ - VectD noExt (HsVectType (VectTypePR (getVECT_SCALAR_PRAGs $1) $3 Nothing) True)) - [mo $1,mj AnnType $2,mc $4] } - - | '{-# VECTORISE' 'type' gtycon '=' gtycon '#-}' - {% ams (sLL $1 $> $ - VectD noExt (HsVectType (VectTypePR (getVECT_PRAGs $1) $3 (Just $5)) False)) - [mo $1,mj AnnType $2,mj AnnEqual $4,mc $6] } - | '{-# VECTORISE_SCALAR' 'type' gtycon '=' gtycon '#-}' - {% ams (sLL $1 $> $ - VectD noExt (HsVectType (VectTypePR (getVECT_SCALAR_PRAGs $1) $3 (Just $5)) True)) - [mo $1,mj AnnType $2,mj AnnEqual $4,mc $6] } - - | '{-# VECTORISE' 'class' gtycon '#-}' - {% ams (sLL $1 $> $ VectD noExt (HsVectClass (VectClassPR (getVECT_PRAGs $1) $3))) - [mo $1,mj AnnClass $2,mc $4] } | annotation { $1 } | decl_no_th { $1 } @@ -1968,9 +1938,8 @@ atype :: { LHsType GhcPs } [mo $1,mc $3] } | '(#' bar_types2 '#)' {% ams (sLL $1 $> $ HsSumTy noExt $2) [mo $1,mc $3] } - | '[' ctype ']' {% ams (sLL $1 $> $ HsListTy noExt $2) [mos $1,mcs $3] } - | '[:' ctype ':]' {% ams (sLL $1 $> $ HsPArrTy noExt $2) [mo $1,mc $3] } - | '(' ctype ')' {% ams (sLL $1 $> $ HsParTy noExt $2) [mop $1,mcp $3] } + | '[' ctype ']' {% ams (sLL $1 $> $ HsListTy noExt $2) [mos $1,mcs $3] } + | '(' ctype ')' {% ams (sLL $1 $> $ HsParTy noExt $2) [mop $1,mcp $3] } | '(' ctype '::' kind ')' {% ams (sLL $1 $> $ HsKindSig noExt $2 $4) [mop $1,mu AnnDcolon $3,mcp $5] } | quasiquote { sL1 $1 (HsSpliceTy noExt (unLoc $1) ) } @@ -2628,7 +2597,6 @@ aexp2 :: { LHsExpr GhcPs } ; ams (sLL $1 $> e) ((mo $1:fst $2) ++ [mc $3]) } } | '[' list ']' {% ams (sLL $1 $> (snd $2)) (mos $1:mcs $3:(fst $2)) } - | '[:' parr ':]' {% ams (sLL $1 $> (snd $2)) (mo $1:mc $3:(fst $2)) } | '_' { sL1 $1 $ EWildPat noExt } -- Template Haskell Extension @@ -2834,28 +2802,6 @@ transformqual :: { Located ([AddAnn],[LStmt GhcPs (LHsExpr GhcPs)] -> Stmt GhcPs -- in by choosing the "group by" variant, which is what we want. ----------------------------------------------------------------------------- --- Parallel array expressions - --- The rules below are little bit contorted; see the list case for details. --- Note that, in contrast to lists, we only have finite arithmetic sequences. --- Moreover, we allow explicit arrays with no element (represented by the nil --- constructor in the list case). - -parr :: { ([AddAnn],HsExpr GhcPs) } - : { ([],ExplicitPArr noExt []) } - | texp { ([],ExplicitPArr noExt [$1]) } - | lexps { ([],ExplicitPArr noExt (reverse (unLoc $1))) } - | texp '..' exp { ([mj AnnDotdot $2] - ,PArrSeq noExt (FromTo $1 $3)) } - | texp ',' exp '..' exp - { ([mj AnnComma $2,mj AnnDotdot $4] - ,PArrSeq noExt (FromThenTo $1 $3 $5)) } - | texp '|' flattenedpquals - { ([mj AnnVbar $2],mkHsComp PArrComp (unLoc $3) $1) } - --- We are reusing `lexps' and `flattenedpquals' from the list case. - ------------------------------------------------------------------------------ -- Guards guardquals :: { Located [LStmt GhcPs (LHsExpr GhcPs)] } @@ -3114,8 +3060,6 @@ gen_qcon :: { Located RdrName } | '(' qconsym ')' {% ams (sLL $1 $> (unLoc $2)) [mop $1,mj AnnVal $2,mcp $3] } --- The case of '[:' ':]' is part of the production `parr' - con :: { Located RdrName } : conid { $1 } | '(' consym ')' {% ams (sLL $1 $> (unLoc $2)) @@ -3175,7 +3119,6 @@ ntgtycon :: { Located RdrName } -- A "general" qualified tycon, excluding unit | '(' '->' ')' {% ams (sLL $1 $> $ getRdrName funTyCon) [mop $1,mu AnnRarrow $2,mcp $3] } | '[' ']' {% ams (sLL $1 $> $ listTyCon_RDR) [mos $1,mcs $2] } - | '[:' ':]' {% ams (sLL $1 $> $ parrTyCon_RDR) [mo $1,mc $2] } | '(' '~#' ')' {% ams (sLL $1 $> $ getRdrName eqPrimTyCon) [mop $1,mj AnnTildehsh $2,mcp $3] } @@ -3555,9 +3498,6 @@ getCORE_PRAGs (L _ (ITcore_prag src)) = src getUNPACK_PRAGs (L _ (ITunpack_prag src)) = src getNOUNPACK_PRAGs (L _ (ITnounpack_prag src)) = src getANN_PRAGs (L _ (ITann_prag src)) = src -getVECT_PRAGs (L _ (ITvect_prag src)) = src -getVECT_SCALAR_PRAGs (L _ (ITvect_scalar_prag src)) = src -getNOVECT_PRAGs (L _ (ITnovect_prag src)) = src getMINIMAL_PRAGs (L _ (ITminimal_prag src)) = src getOVERLAPPABLE_PRAGs (L _ (IToverlappable_prag src)) = src getOVERLAPPING_PRAGs (L _ (IToverlapping_prag src)) = src diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index b887440389..dfcccd369e 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -1012,11 +1012,10 @@ checkAPat msg loc e0 = do OpApp {} -> patFail msg loc e0 - HsPar _ e -> checkLPat msg e >>= (return . (ParPat noExt)) ExplicitList _ _ es -> do ps <- mapM (checkLPat msg) es return (ListPat noExt ps) - ExplicitPArr _ es -> do ps <- mapM (checkLPat msg) es - return (PArrPat noExt ps) + + HsPar _ e -> checkLPat msg e >>= (return . (ParPat noExt)) ExplicitTuple _ es b | all tupArgPresent es -> do ps <- mapM (checkLPat msg) |