Changes between Version 21 and Version 22 of Commentary/Compiler/StackAreas
- Timestamp:
- 06/06/08 08:35:15 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Commentary/Compiler/StackAreas
v21 v22 32 32 A 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. 33 33 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>'':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>}}}: 35 35 36 36 {{{ … … 38 38 }}} 39 39 40 where ''m[e]'' refers to an address ''e''in memory.40 where {{{m[e]}}} refers to an address {{{e}}} in memory. 41 41 42 42 But 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
