• simonpj's avatar
    [project @ 2001-09-26 15:11:50 by simonpj] · 5cd3527d
    simonpj authored
    	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.)