package IRT; import Frame.Access; /** * Information about accessing variables in the current frame, * computed during the Tiger compilation process. *

* History *

*
8 December 1998 (version 0.1) *
16 December 1998 *
Added the constructor *
Added the exp method. *
* * @author Samuel A. Rebelsky * @author Andrew Appel * @version 0.2 of 16 December 1998 */ public class InFrame extends Access { // +--------+-------------------------------------------------- // | Fields | // +--------+ /** * The offset from the start of the frame, in words. */ int offset; // +--------------+-------------------------------------------- // | Constructors | // +--------------+ /** * Create a new in-frame access, using a particular offset. */ public InFrame(int offset) { this.offset = offset; } // InFrame(int) // +---------+------------------------------------------------- // | Methods | // +---------+ /** * Build the tree expression used to get the variable. * Use the pointer to the frame that includes the variable. *

* Red book, p. 163. */ public Tree.Exp exp(Tree.Exp framePtr) { return new Tree.MEM(new Tree.BINOP(Tree.BINOP.MINUS, framePtr, new Tree.CONST(offset))); } // exp(Tree.Exp) } // class InFrame