Commit 9193629a authored by Edward Z. Yang's avatar Edward Z. Yang

Move usage calculation to desugaring, simplifying ModGuts.

Summary:
(This patch was excised from the fat interfaces patch, which
has been put indefinitely on hold.)
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1469
parent 3d88e899
...@@ -353,7 +353,7 @@ pprStrictness sig = ppr sig ...@@ -353,7 +353,7 @@ pprStrictness sig = ppr sig
Note [Specialisations and RULES in IdInfo] Note [Specialisations and RULES in IdInfo]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Generally speaking, a GlobalIdshas an *empty* RuleInfo. All their Generally speaking, a GlobalId has an *empty* RuleInfo. All their
RULES are contained in the globally-built rule-base. In principle, RULES are contained in the globally-built rule-base. In principle,
one could attach the to M.f the RULES for M.f that are defined in M. one could attach the to M.f the RULES for M.f that are defined in M.
But we don't do that for instance declarations and so we just treat But we don't do that for instance declarations and so we just treat
......
This diff is collapsed.
This diff is collapsed.
...@@ -141,7 +141,6 @@ import CmmPipeline ...@@ -141,7 +141,6 @@ import CmmPipeline
import CmmInfo import CmmInfo
import CodeOutput import CodeOutput
import NameEnv ( emptyNameEnv ) import NameEnv ( emptyNameEnv )
import NameSet ( emptyNameSet )
import InstEnv import InstEnv
import FamInstEnv import FamInstEnv
import Fingerprint ( Fingerprint ) import Fingerprint ( Fingerprint )
...@@ -1747,9 +1746,8 @@ mkModGuts mod safe binds = ...@@ -1747,9 +1746,8 @@ mkModGuts mod safe binds =
mg_loc = mkGeneralSrcSpan (moduleNameFS (moduleName mod)), mg_loc = mkGeneralSrcSpan (moduleNameFS (moduleName mod)),
-- A bit crude -- A bit crude
mg_exports = [], mg_exports = [],
mg_usages = [],
mg_deps = noDependencies, mg_deps = noDependencies,
mg_dir_imps = emptyModuleEnv,
mg_used_names = emptyNameSet,
mg_used_th = False, mg_used_th = False,
mg_rdr_env = emptyGlobalRdrEnv, mg_rdr_env = emptyGlobalRdrEnv,
mg_fix_env = emptyFixityEnv, mg_fix_env = emptyFixityEnv,
...@@ -1769,8 +1767,7 @@ mkModGuts mod safe binds = ...@@ -1769,8 +1767,7 @@ mkModGuts mod safe binds =
mg_inst_env = emptyInstEnv, mg_inst_env = emptyInstEnv,
mg_fam_inst_env = emptyFamInstEnv, mg_fam_inst_env = emptyFamInstEnv,
mg_safe_haskell = safe, mg_safe_haskell = safe,
mg_trust_pkg = False, mg_trust_pkg = False
mg_dependent_files = []
} }
......
...@@ -1051,9 +1051,7 @@ data ModGuts ...@@ -1051,9 +1051,7 @@ data ModGuts
mg_exports :: ![AvailInfo], -- ^ What it exports mg_exports :: ![AvailInfo], -- ^ What it exports
mg_deps :: !Dependencies, -- ^ What it depends on, directly or mg_deps :: !Dependencies, -- ^ What it depends on, directly or
-- otherwise -- otherwise
mg_dir_imps :: !ImportedMods, -- ^ Directly-imported modules; used to mg_usages :: ![Usage], -- ^ What was used? Used for interfaces.
-- generate initialisation code
mg_used_names:: !NameSet, -- ^ What the module needed (used in 'MkIface.mkIface')
mg_used_th :: !Bool, -- ^ Did we run a TH splice? mg_used_th :: !Bool, -- ^ Did we run a TH splice?
mg_rdr_env :: !GlobalRdrEnv, -- ^ Top-level lexical environment mg_rdr_env :: !GlobalRdrEnv, -- ^ Top-level lexical environment
...@@ -1092,11 +1090,9 @@ data ModGuts ...@@ -1092,11 +1090,9 @@ data ModGuts
-- one); c.f. 'tcg_fam_inst_env' -- one); c.f. 'tcg_fam_inst_env'
mg_safe_haskell :: SafeHaskellMode, -- ^ Safe Haskell mode mg_safe_haskell :: SafeHaskellMode, -- ^ Safe Haskell mode
mg_trust_pkg :: Bool, -- ^ Do we need to trust our mg_trust_pkg :: Bool -- ^ Do we need to trust our
-- own package for Safe Haskell? -- own package for Safe Haskell?
-- See Note [RnNames . Trust Own Package] -- See Note [RnNames . Trust Own Package]
mg_dependent_files :: [FilePath] -- ^ Dependencies from addDependentFile
} }
-- The ModGuts takes on several slightly different forms: -- The ModGuts takes on several slightly different forms:
......
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