-val optimization

This commit is contained in:
aarne
2005-01-11 15:06:12 +00:00
parent bb3d2e1d42
commit 87b55df10f
32 changed files with 825 additions and 581 deletions

View File

@@ -252,9 +252,12 @@ generateModuleCode :: Options -> InitPath -> SourceModule -> IOE GFC.CanonModule
generateModuleCode opts path minfo@(name,info) = do
let pname = prefixPathName path (prt name)
minfo0 <- ioeErr $ redModInfo minfo
minfo' <- return $ if optim
then shareModule fullOpt minfo0 -- parametrization and sharing
else shareModule basicOpt minfo0 -- sharing only
minfo' <- return $
if optim
then shareModule fullOpt minfo0 -- parametrization and sharing
else if values
then shareModule valOpt minfo0 -- tables as courses-of-values
else shareModule basicOpt minfo0 -- sharing only
-- for resource, also emit gfr
case info of
@@ -279,6 +282,7 @@ generateModuleCode opts path minfo@(name,info) = do
nomulti = not $ oElem makeMulti opts
emit = oElem emitCode opts && not (oElem notEmitCode opts)
optim = oElem optimizeCanon opts
values = oElem optimizeValues opts
-- for old GF: sort into modules, write files, compile as usual

View File

@@ -198,6 +198,10 @@ redCTerm t = case t of
ps' <- mapM redPatt ps
ts' <- mapM redCTerm ts
return $ G.T ty' $ map (uncurry G.Cas) $ zip (map singleton ps') ts'
V ty ts -> do
ty' <- redCType ty
ts' <- mapM redCTerm ts
return $ G.V ty' ts'
S u v -> liftM2 G.S (redCTerm u) (redCTerm v)
K s -> return $ G.K (G.KS s)
EInt i -> return $ G.EInt $ toInteger i

View File

@@ -188,6 +188,7 @@ evalPrintname gr c ppr lin =
Abs _ b -> oneBranch b
R (r:_) -> oneBranch $ snd $ snd r
T _ (c:_) -> oneBranch $ snd c
V _ (c:_) -> oneBranch c
FV (t:_) -> oneBranch t
C x y -> C (oneBranch x) (oneBranch y)
S x _ -> oneBranch x