Changes between Version 59 and Version 60 of Commentary/Compiler/StackAreas


Ignore:
Timestamp:
Jun 30, 2008 3:38:53 PM (7 years ago)
Author:
dias
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/StackAreas

    v59 v60  
    4444data Area
    4545  = RegSlot  LocalReg
    46   | CallArea BlockId Int Int
     46  | CallArea BlockId
    4747  deriving (Eq, Ord)
    4848
     
    5454}}}
    5555
    56 An `Area` represents space on the stack; it may use either the `RegSlot` constructor to represent a single stack slot for a register or the `CallArea` constructor to represent parameters passed to/from a function call/return. In a `CallArea`, the `BlockId` is the label of the function call's continuation, and the two integers are the sizes of the outgoing and incoming parameter-passing areas.
     56An `Area` represents space on the stack; it may use either the `RegSlot` constructor to represent a single stack slot for a register or the `CallArea` constructor to represent parameters passed to/from a function call/return. In a `CallArea`, the `BlockId` is the label of the function call's continuation. Each `Area` grows down, with offset 0 pointing to the old end of the `Area`.
    5757
    5858To name a specific location on the stack, we represent its address with a new kind of `CmmExpr`: the `CmmStackSlot`.
    5959A `CmmStackSlot` is just an integer offset into an `Area`. [[BR]]
     60To address a 4-byte object at the old end of the `Area`, we use the offset 4.
    6061
    6162Notice that a `CmmStackSlot` is an ''address'', so we can say
    6263{{{
    63   Sp = SS(a+0)
     64  Sp = SS(a+4)
    6465}}}
    65 to make `Sp` point to an particular area.   Use a `CmmLoad` to load from the stack.
    66 
    67 Each stack area grows down, with offset 0 pointing to the old end of the area. If we wanted to place a 4-byte object at the old end of the area, we would address it using the offset 4.
     66to make `Sp` point to a particular stack slot.   Use a `CmmLoad` to load from the stack slot.
    6867
    6968