on master help sign in
Add some debug printouts.
commitd403d4730019a4f0977041a5e79021d1e3b04d07 authorMatus Tejiscak <ziman@functor.sk> dateWed 29 Jan 2014, 10:56 (13 years ago) parentd4562c4
2 files changed+8−6
src/IRTS/Compiler.hs+5−5 src/Idris/Erasure.hs+3−1
src/IRTS/Compiler.hs+5−5
@@ -47,9 +47,6 @@ compile codegen f tm
4747 let tmnames = namesUsed (STerm tm)
4848 usedIn <- mapM (allNames []) tmnames
4949 let used = sUN "prim__subBigInt" : sUN "prim__addBigInt" : concat usedIn
50− defsIn <- mkDecls tm used
51−
52− -- TODO: traverse all names correctly
5350
5451 -- TODO: DEBUG-ONLY, remove
5552 ctx <- tt_ctxt <$> getIState
@@ -65,11 +62,14 @@ compile codegen f tm
6562 -- END TODO
6663
6764 maindef <- irMain tm
65+ iLOG $ "MAIN: " ++ show maindef
66+ iLOG $ "USED: " ++ show used
6867 objs <- getObjectFiles codegen
6968 libs <- getLibs codegen
7069 flags <- getFlags codegen
7170 hdrs <- getHdrs codegen
7271 impdirs <- allImportDirs
72+ defsIn <- mkDecls tm used
7373 let defs = defsIn ++ [(sMN 0 "runMain", maindef)]
7474 -- iputStrLn $ showSep "\n" (map show defs)
7575 let (nexttag, tagged) = addTags 65536 (liftAll defs)
@@ -278,8 +278,8 @@ instance ToIR (TT Name) where
278278 args' <- mapM (ir' env) args
279279 return (LApp False f' args')
280280 where mkUsed u i [] = []
281− mkUsed u i (x : xs) | i `notElem` u = LNothing : mkUsed u (i + 1) xs
282− | otherwise = x : mkUsed u (i + 1) xs
281+ mkUsed u i (x : xs) | i `elem` u = x : mkUsed u (i + 1) xs
282+ | otherwise = LNothing : mkUsed u (i + 1) xs
283283-- ir' env (P _ (NS (UN "Z") ["Nat", "Prelude"]) _)
284284-- = return $ LConst (BI 0)
285285 ir' env (P _ n _) = return $ LV (Glob n)
src/Idris/Erasure.hs+3−1
@@ -143,7 +143,7 @@ buildDepMap ctx ns = addPostulates $ dfs S.empty M.empty ns
143143
144144 -- the variables that arose as function arguments only depend on (n, i)
145145 varMap = M.fromList [(v, S.singleton (fn, Arg i)) | (v,i) <- zip vars [0..]]
146− (vars, sc) = cases_compiletime cdefs -- TODO: or cases_runtime?
146+ (vars, sc) = cases_runtime cdefs -- TODO: or cases_runtime?
147147
148148 etaExpand :: [Name] -> Term -> Term
149149 etaExpand [] t = t
@@ -215,6 +215,8 @@ buildDepMap ctx ns = addPostulates $ dfs S.empty M.empty ns
215215 Bind n ( Let ty t') t -> getDepsTerm vs bs cd (App (Bind n (Lam ty) t) t')
216216 Bind n (NLet ty t') t -> getDepsTerm vs bs cd (App (Bind n (Lam ty) t) t')
217217
218+ Proj t i -> error $ "cannot analyse applied projection: " ++ show t ++ " !! " ++ show i
219+
218220 _ -> error $ "cannot analyse application of: " ++ show fun
219221 where
220222 ins = M.insertWith S.union cd