summaryrefslogtreecommitdiff
path: root/ghc/compiler
diff options
context:
space:
mode:
authorsimonpj <unknown>1999-06-28 16:40:18 +0000
committersimonpj <unknown>1999-06-28 16:40:18 +0000
commit9a734fe7d3d782dbce16b7f2b629f18f7b8a01cd (patch)
treeec1105eabde4dadfd8598214aab31c57d5d77a3d /ghc/compiler
parentb01ae32e7a41883bea4e3085c492f1ed02a2ae6e (diff)
downloadhaskell-9a734fe7d3d782dbce16b7f2b629f18f7b8a01cd.tar.gz
[project @ 1999-06-28 16:40:18 by simonpj]
Add explanatory comments
Diffstat (limited to 'ghc/compiler')
-rw-r--r--ghc/compiler/simplCore/SimplCore.lhs15
1 files changed, 15 insertions, 0 deletions
diff --git a/ghc/compiler/simplCore/SimplCore.lhs b/ghc/compiler/simplCore/SimplCore.lhs
index 2f4aecf856..e3ab3d493a 100644
--- a/ghc/compiler/simplCore/SimplCore.lhs
+++ b/ghc/compiler/simplCore/SimplCore.lhs
@@ -209,6 +209,21 @@ simplifyPgm (imported_rule_ids, rule_lhs_fvs)
-- Glom all binds together in one Rec, in case any
-- transformations have introduced any new dependencies
+ --
+ -- NB: the global invariant is this:
+ -- *** the top level bindings are never cloned, and are always unique ***
+ --
+ -- We sort them into dependency order, but applying transformation rules may
+ -- make something at the top refer to something at the bottom:
+ -- f = \x -> p (q x)
+ -- h = \y -> 3
+ --
+ -- RULE: p (q x) = h x
+ --
+ -- Applying this rule makes f refer to h, although it doesn't appear to in the
+ -- source program. Our solution is to do this occasional glom-together step,
+ -- just once per overall simplfication step.
+
let { recd_binds = [Rec (flattenBinds binds)] };
(termination_msg, it_count, counts_out, binds') <- iteration us 1 zeroSimplCount recd_binds;