Commit f2506c8c authored by simonpj's avatar simonpj
Browse files

[project @ 2005-07-28 14:45:55 by simonpj]

Restore costant folding
parent bb026cba
...@@ -39,10 +39,9 @@ import Name ( Name, NamedThing(..), nameOccName ) ...@@ -39,10 +39,9 @@ import Name ( Name, NamedThing(..), nameOccName )
import NameEnv import NameEnv
import Unify ( tcMatchTyX, MatchEnv(..) ) import Unify ( tcMatchTyX, MatchEnv(..) )
import BasicTypes ( Activation, CompilerPhase, isActive ) import BasicTypes ( Activation, CompilerPhase, isActive )
import Outputable import Outputable
import FastString import FastString
import Maybe ( isJust ) import Maybes ( isJust, orElse )
import Bag import Bag
import Util ( singleton ) import Util ( singleton )
import List ( isPrefixOf ) import List ( isPrefixOf )
...@@ -198,10 +197,13 @@ lookupRule :: (Activation -> Bool) -> InScopeSet ...@@ -198,10 +197,13 @@ lookupRule :: (Activation -> Bool) -> InScopeSet
lookupRule is_active in_scope rule_base fn args lookupRule is_active in_scope rule_base fn args
= matchRules is_active in_scope fn args rules = matchRules is_active in_scope fn args rules
where where
rules | isLocalId fn = idCoreRules fn -- The rules for an Id come from two places:
| otherwise = case lookupNameEnv rule_base (idName fn) of -- (a) the ones it is born with (idCoreRules fn)
Just rules -> rules -- (b) rules added in subsequent modules (extra_rules)
Nothing -> [] -- PrimOps, for example, are born with a bunch of rules under (a)
rules = extra_rules ++ idCoreRules fn
extra_rules | isLocalId fn = []
| otherwise = lookupNameEnv rule_base (idName fn) `orElse` []
matchRules :: (Activation -> Bool) -> InScopeSet matchRules :: (Activation -> Bool) -> InScopeSet
-> Id -> [CoreExpr] -> Id -> [CoreExpr]
......
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