on master help sign in
Don't erase from unknown names.
commite866fa6b03ad34a3cdd21c59a11148caff918e42 authorMatus Tejiscak <ziman@functor.sk> dateThu 6 Feb 2014, 17:09 (13 years ago) parent589bb4b
3 files changed+14−12
src/IRTS/Compiler.hs+9−11 src/IRTS/Simplified.hs−1 src/Idris/Erasure.hs+5
src/IRTS/Compiler.hs+9−11
@@ -60,7 +60,7 @@ compile codegen f tm
6060 let (residDeps, (reachableNames', minUse)) = minimalUsage depMap
6161 reachableNames = sUN "prim__subBigInt" : sUN "prim__addBigInt" : S.toList reachableNames'
6262 iLOG $ "RESIDUAL DEPS:\n" ++ unlines (map printItem . M.toList $ residDeps)
63− iLOG $ "REACHABLE NAMES: " ++ show reachableNames
63+ iLOG $ "REACHABLE NAMES:\n" ++ unlines (map show reachableNames)
6464
6565 let fmtDepMap = unlines . map (\(n,is) -> show n ++ " -> " ++ show (IS.toList is)) . M.toList
6666 iLOG $ "MINIMAL USAGE:\n" ++ fmtDepMap minUse
@@ -276,16 +276,13 @@ instance ToIR (TT Name) where
276276 Just tm -> return tm
277277 _ -> do
278278 let collapse
279− = case lookupCtxtExact n
280− (idris_optimisation i) of
279+ = case lookupCtxtExact n (idris_optimisation i) of
281280 Just oi -> collapsible oi
282281 _ -> False
283282 let used
284− = case lookupCtxtExact n
285− (idris_callgraph i) of
286− Just (CGInfo _ _ _ _ usedpos) ->
287− usedpos
288− _ -> [] -- TODO: is this correct?
283+ = case lookupCtxtExact n (idris_callgraph i) of
284+ Just (CGInfo _ _ _ _ usedpos) -> Just usedpos
285+ _ -> Nothing
289286 if collapse
290287 then return LNothing
291288 else do
@@ -296,9 +293,10 @@ instance ToIR (TT Name) where
296293 = do f' <- ir' env f
297294 args' <- mapM (ir' env) args
298295 return (LApp False f' args')
299− where mkUsed u i [] = []
300− mkUsed u i (x : xs) | i `elem` u = x : mkUsed u (i + 1) xs
301− | otherwise = LNothing : mkUsed u (i + 1) xs
296+ where mkUsed (Just u) i [] = []
297+ mkUsed (Just u) i (x : xs) | i `elem` u = x : mkUsed (Just u) (i + 1) xs
298+ | otherwise = LNothing : mkUsed (Just u) (i + 1) xs
299+ mkUsed Nothing _ xs = xs
302300-- ir' env (P _ (NS (UN "Z") ["Nat", "Prelude"]) _)
303301-- = return $ LConst (BI 0)
304302 ir' env (P _ n _) = return $ LV (Glob n)
src/IRTS/Simplified.hs−1
@@ -123,7 +123,6 @@ checkDefs ctxt [] = return []
123123checkDefs ctxt (con@(n, DConstructor _ _ _) : xs)
124124 = do xs' <- checkDefs ctxt xs
125125 return xs'
126−checkDefs ctxt ((n, DFun n' args exp) : xs) | ("CHECK DEF", n, n', args, exp) `traceShow` False = undefined
127126checkDefs ctxt ((n, DFun n' args exp) : xs)
128127 = do let sexp = evalState (simplify True exp) (ctxt, 0)
129128 (exp', locs) <- runStateT (scopecheck ctxt (zip args [0..]) sexp) (length args)
src/Idris/Erasure.hs+5
@@ -100,11 +100,16 @@ buildDepMap ci ctx ns = addPostulates $ dfs S.empty M.empty ns
100100 , it "mkForeign" [1]
101101 , it "prim__toStrBigInt" [0]
102102 , it "prim__addBigInt" [0,1]
103+ , it "prim__subBigInt" [0,1]
103104 , it "prim__sextInt_BigInt" [0]
104105 , it "prim__zextInt_BigInt" [0]
105106 , it "prim__eqString" [0,1]
106107 , it "prim__eqChar" [0,1]
107108 , it "prim__eqBigInt" [0,1]
109+ , it "prim__charToInt" [0]
110+ , it "prim__sltBigInt" [0,1]
111+ , it "prim__sltChar" [0,1]
112+ , it "prim__toStrInt" [0,1]
108113 , mn "__MkPair" [0,1]
109114 ]
110115 ]