Commit a2cc9611 authored by rl@cse.unsw.edu.au's avatar rl@cse.unsw.edu.au

Use emptyPA in vectorisation

parent 6f0160d0
......@@ -65,6 +65,7 @@ data Builtins = Builtins {
, applyClosurePVar :: Var
, lengthPAVar :: Var
, replicatePAVar :: Var
, emptyPAVar :: Var
}
paDictTyCon :: Builtins -> TyCon
......@@ -83,6 +84,7 @@ initBuiltins
applyClosurePVar <- dsLookupGlobalId applyClosurePName
lengthPAVar <- dsLookupGlobalId lengthPAName
replicatePAVar <- dsLookupGlobalId replicatePAName
emptyPAVar <- dsLookupGlobalId emptyPAName
return $ Builtins {
parrayTyCon = parrayTyCon
......@@ -94,6 +96,7 @@ initBuiltins
, applyClosurePVar = applyClosurePVar
, lengthPAVar = lengthPAVar
, replicatePAVar = replicatePAVar
, emptyPAVar = emptyPAVar
}
data GlobalEnv = GlobalEnv {
......
......@@ -3,7 +3,7 @@ module VectUtils (
splitClosureTy,
mkPADictType, mkPArrayType,
paDictArgType, paDictOfType,
paMethod, lengthPA, replicatePA,
paMethod, lengthPA, replicatePA, emptyPA,
lookupPArrayFamInst,
hoistExpr, takeHoisted
) where
......@@ -123,6 +123,9 @@ replicatePA :: CoreExpr -> CoreExpr -> VM CoreExpr
replicatePA len x = liftM (`mkApps` [len,x])
(paMethod replicatePAVar (exprType x))
emptyPA :: Type -> VM CoreExpr
emptyPA = paMethod emptyPAVar
lookupPArrayFamInst :: Type -> VM (TyCon, [Type])
lookupPArrayFamInst ty = builtin parrayTyCon >>= (`lookupFamInst` [ty])
......
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