X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FhsSyn%2FHsDecls.lhs;fp=compiler%2FhsSyn%2FHsDecls.lhs;h=3712cbd9f72c6777d5beafe3ff108d857dd37c57;hp=c05f26a5fc85eb6e1844fabd705602d982eda3e3;hb=c1c2c25355bc462e521b2c5fb41ac79307da22ff;hpb=eced7db98b3a8c7050196c619b5f7427a51417fd diff --git a/compiler/hsSyn/HsDecls.lhs b/compiler/hsSyn/HsDecls.lhs index c05f26a..3712cbd 100644 --- a/compiler/hsSyn/HsDecls.lhs +++ b/compiler/hsSyn/HsDecls.lhs @@ -28,6 +28,7 @@ module HsDecls ( collectRuleBndrSigTys, -- ** @VECTORISE@ declarations VectDecl(..), LVectDecl, + lvectDeclName, -- ** @default@ declarations DefaultDecl(..), LDefaultDecl, -- ** Top-level template haskell splice @@ -1005,10 +1006,11 @@ instance OutputableBndr name => Outputable (RuleBndr name) where %* * %************************************************************************ -A vectorisation pragma +A vectorisation pragma, one of - {-# VECTORISE f = closure1 g (scalar_map g) #-} OR + {-# VECTORISE f = closure1 g (scalar_map g) #-} {-# VECTORISE SCALAR f #-} + {-# NOVECTORISE f #-} Note [Typechecked vectorisation pragmas] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1029,14 +1031,23 @@ data VectDecl name = HsVect (Located name) (Maybe (LHsExpr name)) -- 'Nothing' => SCALAR declaration + | HsNoVect + (Located name) deriving (Data, Typeable) - + +lvectDeclName :: LVectDecl name -> name +lvectDeclName (L _ (HsVect (L _ name) _)) = name +lvectDeclName (L _ (HsNoVect (L _ name))) = name + instance OutputableBndr name => Outputable (VectDecl name) where - ppr (HsVect v rhs) + ppr (HsVect v Nothing) + = sep [text "{-# VECTORISE SCALAR" <+> ppr v <+> text "#-}" ] + ppr (HsVect v (Just rhs)) = sep [text "{-# VECTORISE" <+> ppr v, - nest 4 (case rhs of - Nothing -> text "SCALAR #-}" - Just rhs -> pprExpr (unLoc rhs) <+> text "#-}") ] + nest 4 $ + pprExpr (unLoc rhs) <+> text "#-}" ] + ppr (HsNoVect v) + = sep [text "{-# NOVECTORISE" <+> ppr v <+> text "#-}" ] \end{code} %************************************************************************