In order to support the calling convention, the SPIM equivalent of a C-- program must contain an instruction that establishes the stack frame by subtracting the frame size from the stack pointer. The frame size must therefore be available in a convenient place for use by the action mapping task.
Section 2.3 of the SPIM Manual describes the available addressing modes. In order to generate an addressing mode appropriate for accessing a variable in the stack frame, the action mapping task must have access to the offset of that variable's storage within the stack frame.
The data mapping task should store an integer-valued Offset property in the definition table for every parameter and variable defined in the source program. That value is the address of the storage for the parameter or variable relative to the base address of the activation record.
In addition, the data mapping task should store the total size of the activation record as an attribute of the Source node. Your data mapping must take advantage of the limited extent of C-- variables to minimize the size of the activation record.
Verify your implementation by applying it to several programs that illustrate different variable extents, printing the total activation record size and a list of the parameter and variable names in each program with their associated Offset values. Hand in listings of your test programs and the resulting printouts.
A directory containing the complete source code (or specifications, if you used tools) for your compiler must be permitted for world read by 1700 on the due date for this assignment. You need not make it available to be read by others before that time. Hand in the location of this directory (machine and path name).
Complete your personal postmortem for this assignment and your personal project plan for the next assignment, and submit them via the web before class on the due date of this assignment.
|Instructor||Revision 1.8 (1998/10/06 15:09:06)|