Changes between Version 11 and Version 12 of Commentary/Compiler/StackAreas


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

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/StackAreas

    v11 v12  
    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, if we want to spill a variable ''x'', we use a regular store instruction to a stack slot ''Stack<x>'': 
     13For example, if we want to spill a variable ''x'', we use a regular store instruction to a stack slot at address ''stack<x>'': 
    1414 
    1515{{{ 
    16 m[Stack<x>] := x; 
     16m[stack<x>] := x; 
    1717}}} 
    1818 
    1919where ''m[e]'' refers to an address ''e'' in memory. 
    20 If the  
     20 
     21But what about parameter passing? We use a similar technique, but we maintain the relative positions of the arguments. For example, consider a function call: 
     22 
     23{{{ 
     24x, y = f(a, b, c); 
     25}}} 
     26 
     27 
     28 
     29We use the following types: 
    2130 
    2231{{{ 
     
    3544 
    3645 
     46== ToDo == 
     47 
     48 * Explain the stack layout algorithm. 
     49 * State the invariants. 
     50 * Say something about aliasing. 
     51 
     52 
     53== Old Text == 
    3754 
    3855The current CMM code-generation path leaves stack management completely implicit until the end of the pipeline. The consequence is that a number of things must happen all at once: