Commit b87a8ec2 authored by rl@cse.unsw.edu.au's avatar rl@cse.unsw.edu.au
Browse files

Teach vectorisation about tuple datacons

parent 0ad143e1
......@@ -31,7 +31,8 @@ import OccName
import TypeRep ( funTyCon )
import Type ( Type )
import TysPrim
import TysWiredIn ( unitTyCon, tupleTyCon,
import TysWiredIn ( unitTyCon, unitDataCon,
tupleTyCon,
intTyCon, intTyConName,
doubleTyCon, doubleTyConName,
boolTyCon, boolTyConName, trueDataCon, falseDataCon,
......@@ -205,7 +206,7 @@ initBuiltinVars bi
(umods, ufs, vmods, vfs) = unzip4 preludeVars
defaultDataConWorkers :: [DataCon]
defaultDataConWorkers = [trueDataCon, falseDataCon]
defaultDataConWorkers = [trueDataCon, falseDataCon, unitDataCon]
preludeVars :: [(Module, FastString, Module, FastString)]
preludeVars
......@@ -253,7 +254,7 @@ initBuiltinDataCons :: Builtins -> [(Name, DataCon)]
initBuiltinDataCons bi = [(dataConName dc, dc)| dc <- defaultDataCons]
defaultDataCons :: [DataCon]
defaultDataCons = [trueDataCon, falseDataCon]
defaultDataCons = [trueDataCon, falseDataCon, unitDataCon]
initBuiltinDicts :: [(Name, Module, FastString)] -> DsM [(Name, Var)]
initBuiltinDicts ps
......
......@@ -376,7 +376,9 @@ defTyCon tc tc' = updGEnv $ \env ->
env { global_tycons = extendNameEnv (global_tycons env) (tyConName tc) tc' }
lookupDataCon :: DataCon -> VM (Maybe DataCon)
lookupDataCon dc = readGEnv $ \env -> lookupNameEnv (global_datacons env) (dataConName dc)
lookupDataCon dc
| isTupleTyCon (dataConTyCon dc) = return (Just dc)
| otherwise = readGEnv $ \env -> lookupNameEnv (global_datacons env) (dataConName dc)
defDataCon :: DataCon -> DataCon -> VM ()
defDataCon dc dc' = updGEnv $ \env ->
......
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