Changes between Version 21 and Version 22 of Commentary/Compiler/StackAreas


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

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/StackAreas

    v21 v22  
    3232A 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.
    3333
    34 For example, if we want to spill a variable ''x'', we use a regular store instruction to a stack slot at address ''stack<x>'':
     34For example, if we want to spill a variable {{{x}}}, we use a regular store instruction to a stack slot at address {{{stack<x>}}}:
    3535
    3636{{{
     
    3838}}}
    3939
    40 where ''m[e]'' refers to an address ''e'' in memory.
     40where {{{m[e]}}} refers to an address {{{e}}} in memory.
    4141
    4242But what about parameter passing? We use a similar technique, but this time we describe the slot for each location as an offset within the area where the parameters are passed. For example, we compile a function call