C2CMode.mesa
Copyright Ó 1987, 1988, 1990, 1991, 1993 by Xerox Corporation. All rights reserved.
Christian Jacobi, 1987
Christian Jacobi, January 22, 1993 1:43 pm PST
DIRECTORY
C2CAddressing,
C2CDefs USING [Mode],
IntCodeDefs USING [Node],
Rope;
C2CMode: CEDAR DEFINITIONS =
BEGIN
Mode: TYPE = C2CDefs.Mode;
Basic access procedures
All set procedures without leading D create a new mode
All set procedures without D reuse mode if not nil
FreeMode: PROC [Mode];
A guarantee that this mode won't be used anymore
ExpMode: PROC [Mode] RETURNS [BOOL];
SetExpr: PROC [m: Mode¬NIL, expr: BOOL ¬ TRUE] RETURNS [Mode];
LHSMode: PROC [Mode] RETURNS [BOOL];
SetLHS: PROC [m: Mode¬NIL, lhs: BOOL ¬ TRUE] RETURNS [Mode];
GetAMode: PROC [m: Mode] RETURNS [am: C2CAddressing.AddressMode];
SetAMode: PROC [m: Mode¬NIL, am: C2CAddressing.AddressMode] RETURNS [Mode];
DSetAMode: PROC [m: Mode¬NIL, am: C2CAddressing.AddressMode] RETURNS [Mode];
GetAddrContainer: PROC [m: Mode] RETURNS [ac: C2CAddressing.AddressContainer];
SetAddrContainer: PROC [m: Mode¬NIL, ac: C2CAddressing.AddressContainer] RETURNS [Mode];
GetTemplate: PROC [m: Mode] RETURNS [Rope.ROPE];
SetTemplate: PROC [m: Mode¬NIL, tmp: Rope.ROPE] RETURNS [Mode];
ContainerSize: PROC [m: Mode] RETURNS [INT];
SetContainerSize: PROC [m: Mode, sz: INT] RETURNS [Mode];
the size of the template
BaseSize: PROC [m: Mode] RETURNS [INT];
SetBaseSize: PROC [m: Mode, sz: INT] RETURNS [Mode];
DSetBaseSize: PROC [m: Mode, sz: INT] RETURNS [Mode];
Size of bits actually "used"; 0 if size and alignment do not matter
UnitSize: PROC [m: Mode] RETURNS [INT];
SetUnitSize: PROC [m: Mode, sz: INT] RETURNS [Mode];
DSetUnitSize: PROC [m: Mode, sz: INT] RETURNS [Mode];
Unit size to be used for mask and shift to extract fields
Required for modes maskNShift, lHSMaskNShift
Not defined for other modes
LHSMaskNShiftNode: PROC [m: Mode] RETURNS [IntCodeDefs.Node];
SetLHSMaskNShiftNode: PROC [m: Mode, node: IntCodeDefs.Node] RETURNS [Mode];
Optionally, the right hand side node.
Not defined for other modes
Relation of sz fields:
BaseSize: the size of the "leaf" node [where bits are used]
ContainerSize: the size of a template;
ContainerSize>=BaseSize
If node.bits is defined then ContainerSize>=node.bits
UnitSize: separate concept. Separation to ease understanding.
Shortcuts
Like: PROC [m: Mode¬NIL, lhs, rhs, expr, stat: BOOL ¬ FALSE] RETURNS [Mode];
returns new mode with appropriate field changed
false parameter won't change the field
SetAModeNC: PROC [m: Mode¬NIL, am: C2CAddressing.AddressMode] RETURNS [Mode];
addr ← am; addrcont ← NIL
SetAssBitAddr: PROC [m: Mode¬NIL, ac: C2CAddressing.AddressContainer] RETURNS [Mode];
addr ← assBitAdr; addrcont ← ac;
SetAssAddr: PROC [m: Mode¬NIL, tmp: Rope.ROPE] RETURNS [Mode];
addr ← assAddr; addrcont ← [tmp, NIL];
SetAssUnits: PROC [m: Mode¬NIL, tmp: Rope.ROPE, sz: INT] RETURNS [Mode];
addr ← assUnits; addrcont ← [tmp, TRASH]; ContainerSize ← sz
SetAssBits: PROC [m: Mode¬NIL, ac: C2CAddressing.AddressContainer, sz: INT] RETURNS [Mode];
addr ← AssBits; addrcont ← ac; ContainerSize ← sz
UseValue: PROC [sz: INT, m: Mode¬NIL] RETURNS [Mode];
shortcut for expr ← TRUE; lhs ← FALSE; addr ← value; addrcont ← NIL, and, SetBaseSize
sz: leaf size for deref info
END.