diff options
author | simonpj <unknown> | 2001-09-26 15:11:51 +0000 |
---|---|---|
committer | simonpj <unknown> | 2001-09-26 15:11:51 +0000 |
commit | 5cd3527da623a25b9ace2995f9d2e7f6c90c611f (patch) | |
tree | 85ea7dfbca2c214fd4485d6952bd3714698ca601 /ghc/compiler/codeGen/CodeGen.lhs | |
parent | 03aa2ef64390090c64d0fcf81b1050a9f3a4a452 (diff) | |
download | haskell-5cd3527da623a25b9ace2995f9d2e7f6c90c611f.tar.gz |
[project @ 2001-09-26 15:11:50 by simonpj]
-------------------------------
Code generation and SRT hygiene
-------------------------------
This is a big tidy up commit. I don't think it breaks anything,
but it certainly makes the code clearer (to me).
I'm not certain that you can use it without sucking in my other
big commit... they come from the same tree.
Core-to-STG, live variables and Static Reference Tables (SRTs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I did a big tidy-up of the live-variable computation in CoreToStg.
The key idea is that the live variables consist of two parts:
dynamic live vars
static live vars (CAFs)
These two always travel round together, but they were always
treated separately by the code until now. Now it's a new data type:
type LiveInfo = (StgLiveVars, -- Dynamic live variables;
-- i.e. ones with a nested (non-top-level) binding
CafSet) -- Static live variables;
-- i.e. top-level variables that are CAFs or refer to them
There's lots of documentation in CoreToStg.
Code generation
~~~~~~~~~~~~~~~
Arising from this, I found that SRT labels were stored in
a LambdaFormInfo during code generation, whereas they *ought*
to be in the ClosureInfo (which in turn contains a LambdaFormInfo).
This led to lots of changes in ClosureInfo, and I took the opportunity
to make it into a labelled record.
Similarly, I made the data type in AbstractC a bit more explicit:
-- C_SRT is what StgSyn.SRT gets translated to...
-- we add a label for the table, and expect only the 'offset/length' form
data C_SRT = NoC_SRT
| C_SRT CLabel !Int{-offset-} !Int{-length-}
(Previously there were bottoms lying around.)
Diffstat (limited to 'ghc/compiler/codeGen/CodeGen.lhs')
-rw-r--r-- | ghc/compiler/codeGen/CodeGen.lhs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/ghc/compiler/codeGen/CodeGen.lhs b/ghc/compiler/codeGen/CodeGen.lhs index 2b15e21547..d6b5d0f2cb 100644 --- a/ghc/compiler/codeGen/CodeGen.lhs +++ b/ghc/compiler/codeGen/CodeGen.lhs @@ -50,8 +50,6 @@ import ErrUtils ( dumpIfSet_dyn, showPass ) import Panic ( assertPanic ) #ifdef DEBUG -import Id ( idCafInfo ) -import IdInfo ( mayHaveCafRefs ) import Outputable #endif \end{code} @@ -266,11 +264,9 @@ cgTopRhs bndr (StgRhsCon cc con args) srt cgTopRhs bndr (StgRhsClosure cc bi fvs upd_flag args body) srt = -- There should be no free variables ASSERT(null fvs) - - getSRTLabel `thenFC` \srt_label -> - let lf_info = - mkClosureLFInfo bndr TopLevel [{-no fvs-}] upd_flag args srt_label srt + let + lf_info = mkClosureLFInfo bndr TopLevel [{-no fvs-}] upd_flag args in - maybeGlobaliseId bndr `thenFC` \ bndr' -> - forkStatics (cgTopRhsClosure bndr' cc bi args body lf_info) + maybeGlobaliseId bndr `thenFC` \ bndr' -> + forkStatics (cgTopRhsClosure bndr' cc bi srt args body lf_info) \end{code} |