X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fvectorise%2FVectCore.hs;fp=compiler%2Fvectorise%2FVectCore.hs;h=63178bd5d7d1b7fdcaccf12c2776135e0e4afc9d;hb=a63ba966cf8f0f12e303102d3241445579f77043;hp=0000000000000000000000000000000000000000;hpb=7834c4dc26ceea202f358a851479a6ead3e764ff;p=ghc-hetmet.git diff --git a/compiler/vectorise/VectCore.hs b/compiler/vectorise/VectCore.hs new file mode 100644 index 0000000..63178bd --- /dev/null +++ b/compiler/vectorise/VectCore.hs @@ -0,0 +1,41 @@ +module VectCore ( + Vect, VVar, VExpr, + + vectorised, lifted, + mapVect, + + vVar, mkVLams, mkVVarApps +) where + +#include "HsVersions.h" + +import CoreSyn +import Var + +type Vect a = (a,a) +type VVar = Vect Var +type VExpr = Vect CoreExpr + +vectorised :: Vect a -> a +vectorised = fst + +lifted :: Vect a -> a +lifted = snd + +mapVect :: (a -> b) -> Vect a -> Vect b +mapVect f (x,y) = (f x, f y) + +vVar :: VVar -> VExpr +vVar = mapVect Var + +mkVLams :: [VVar] -> VExpr -> VExpr +mkVLams vvs (ve,le) = (mkLams vs ve, mkLams ls le) + where + (vs,ls) = unzip vvs + +mkVVarApps :: Var -> VExpr -> [VVar] -> VExpr +mkVVarApps lc (ve, le) vvs = (ve `mkVarApps` vs, le `mkVarApps` (lc : ls)) + where + (vs,ls) = unzip vvs + +