Skip to content

Commit

Permalink
remove silly identity function
Browse files Browse the repository at this point in the history
fixes #195
  • Loading branch information
tmcdonell committed Sep 3, 2014
1 parent afe6988 commit 88af4cd
Showing 1 changed file with 4 additions and 44 deletions.
48 changes: 4 additions & 44 deletions Data/Array/Accelerate/Trafo/Fusion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -392,54 +392,14 @@ embedPreAcc fuseAcc embedAcc elimAcc pacc
stencil x f a = Stencil f x a
stencil2 x y f a b = Stencil2 f x a y b

-- Conversions for closed scalar functions and expressions, with
-- pre-simplification. We don't bother traversing array-valued terms in
-- scalar expressions, as these are guaranteed to only be array variables.
-- Conversions for closed scalar functions and expressions. This just
-- applies scalar simplifications.
--
cvtF :: PreFun acc aenv t -> PreFun acc aenv t
cvtF = cvtF' . simplify
cvtF = simplify

cvtE :: PreExp acc aenv' t -> PreExp acc aenv' t
cvtE = cvtE' . simplify

-- Conversions for scalar functions and expressions without
-- pre-simplification. Hence we can operate on open expressions.
--
cvtF' :: PreOpenFun acc env aenv' t -> PreOpenFun acc env aenv' t
cvtF' (Lam f) = Lam (cvtF' f)
cvtF' (Body b) = Body (cvtE' b)

cvtE' :: PreOpenExp acc env aenv' t -> PreOpenExp acc env aenv' t
cvtE' exp =
case exp of
Let bnd body -> Let (cvtE' bnd) (cvtE' body)
Var ix -> Var ix
Const c -> Const c
Tuple tup -> Tuple (cvtT tup)
Prj tup ix -> Prj tup (cvtE' ix)
IndexNil -> IndexNil
IndexCons sh sz -> IndexCons (cvtE' sh) (cvtE' sz)
IndexHead sh -> IndexHead (cvtE' sh)
IndexTail sh -> IndexTail (cvtE' sh)
IndexAny -> IndexAny
IndexSlice x ix sh -> IndexSlice x (cvtE' ix) (cvtE' sh)
IndexFull x ix sl -> IndexFull x (cvtE' ix) (cvtE' sl)
ToIndex sh ix -> ToIndex (cvtE' sh) (cvtE' ix)
FromIndex sh ix -> FromIndex (cvtE' sh) (cvtE' ix)
Cond p t e -> Cond (cvtE' p) (cvtE' t) (cvtE' e)
While p f x -> While (cvtF' p) (cvtF' f) (cvtE' x)
PrimConst c -> PrimConst c
PrimApp f x -> PrimApp f (cvtE' x)
Index a sh -> Index a (cvtE' sh)
LinearIndex a i -> LinearIndex a (cvtE' i)
Shape a -> Shape a
ShapeSize sh -> ShapeSize (cvtE' sh)
Intersect s t -> Intersect (cvtE' s) (cvtE' t)
Foreign ff f e -> Foreign ff (cvtF' f) (cvtE' e)

cvtT :: Tuple (PreOpenExp acc env aenv') t -> Tuple (PreOpenExp acc env aenv') t
cvtT NilTup = NilTup
cvtT (SnocTup tup e) = cvtT tup `SnocTup` cvtE' e
cvtE = simplify

-- Helpers to embed and fuse delayed terms
--
Expand Down

0 comments on commit 88af4cd

Please sign in to comment.