[project @ 2001-09-26 15:11:50 by simonpj]
authorsimonpj <unknown>
Wed, 26 Sep 2001 15:11:51 +0000 (15:11 +0000)
committersimonpj <unknown>
Wed, 26 Sep 2001 15:11:51 +0000 (15:11 +0000)
commit5cd3527da623a25b9ace2995f9d2e7f6c90c611f
tree85ea7dfbca2c214fd4485d6952bd3714698ca601
parent03aa2ef64390090c64d0fcf81b1050a9f3a4a452
[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.)
14 files changed:
ghc/compiler/absCSyn/AbsCSyn.lhs
ghc/compiler/absCSyn/PprAbsC.lhs
ghc/compiler/codeGen/CgCase.lhs
ghc/compiler/codeGen/CgClosure.lhs
ghc/compiler/codeGen/CgCon.lhs
ghc/compiler/codeGen/CgConTbls.lhs
ghc/compiler/codeGen/CgExpr.lhs
ghc/compiler/codeGen/CgLetNoEscape.lhs
ghc/compiler/codeGen/CgMonad.lhs
ghc/compiler/codeGen/ClosureInfo.lhs
ghc/compiler/codeGen/CodeGen.lhs
ghc/compiler/nativeGen/MachCode.lhs
ghc/compiler/nativeGen/StixInfo.lhs
ghc/compiler/stgSyn/CoreToStg.lhs