on master help sign in
Eliminate unused inputs to erasure analysis
7e308ddMatus Tejiscak
src/IRTS/Compiler.hs+1−1
@@ -51,7 +51,7 @@ compile codegen f tm
51
51
52 -- TODO: DEBUG-ONLY, remove
52 -- TODO: DEBUG-ONLY, remove
53 ist <- getIState
53 ist <- getIState
54− let depMap = buildDepMap (tt_ctxt ist) (idris_callgraph ist) used
54+ let depMap = buildDepMap (tt_ctxt ist) used
55 let printCond (ctors, cond) = "if " ++ show (S.toList cond) ++ " -ctors- " ++ show (S.toList ctors)
55 let printCond (ctors, cond) = "if " ++ show (S.toList cond) ++ " -ctors- " ++ show (S.toList ctors)
56 let printDep (i, conds) = unlines . map (" "++) $ (show i : map printCond (S.toList conds))
56 let printDep (i, conds) = unlines . map (" "++) $ (show i : map printCond (S.toList conds))
57 let printItem (fn, (deps, depns)) = unlines ((show fn ++ " <- " ++ show (S.toList depns)) : map printDep (IM.toList deps))
57 let printItem (fn, (deps, depns)) = unlines ((show fn ++ " <- " ++ show (S.toList depns)) : map printDep (IM.toList deps))
src/Idris/Erasure.hs+7−2
@@ -58,8 +58,13 @@ type Vars = Map Name Var
58type PatVar = Ctors -> Var
58type PatVar = Ctors -> Var
59type PatVars = Map Name PatVar
59type PatVars = Map Name PatVar
60
60
61+minimalUsage :: DepMap -> UseMap
62+minimalUsage dmap = undefined
63+
64+-- Build the dependency graph,
65+-- starting the depth-first search from a list of Names.
61−buildDepMap :: Context -> Ctxt CGInfo -> [Name] -> DepMap
66+buildDepMap :: Context -> [Name] -> DepMap
62−buildDepMap ctx cg ns = dfs M.empty ns
67+buildDepMap ctx ns = dfs M.empty ns
63 where
68 where
64 -- perform depth-first search
69 -- perform depth-first search
65 -- to discover all the names used in the program
70 -- to discover all the names used in the program