Changes between Version 9 and Version 10 of Commentary/Compiler/StackAreas


Ignore:
Timestamp:
Jun 5, 2008 3:01:15 PM (6 years ago)
Author:
dias
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/StackAreas

    v9 v10  
    1111A better approach is to introduce a unique name for each stack slot, then treat the name as the addressing expression for the slot. At the end of the pipeline, we choose a stack layout, then replace each stack slot with its offset from the stack pointer. The benefit is that we break the phase-ordering problem: any phase of the compiler can name a stack slot. 
    1212 
    13 For example 
     13For example, if we want to spill a variable ''x'', we use a regular store instruction to a stack slot ''Stack<x>'': 
     14 
     15{{{ 
     16m[Stack<x>] := x; 
     17}}} 
     18 
     19where ''m[e]'' refers to an address ''e'' in memory. 
     20If the  
     21 
     22{{{ 
     23data Area 
     24  = RegSlot  LocalReg 
     25  | CallArea BlockId Int Int 
     26  deriving (Eq, Ord) 
     27 
     28data CmmExpr 
     29  = CmmLit CmmLit 
     30  ... 
     31  | CmmStackSlot Area Int 
     32  deriving Eq 
     33}}} 
     34 
    1435 
    1536The current conversion from STG to CMM leaves stack management completely implicit. The consequence is that a number of things must happen all at once: