MimP5U.mesa
Copyright Ó 1985, 1986, 1987, 1988, 1989, 1991 by Xerox Corporation. All rights reserved.
Sweet, May 31, 1986 9:57:19 pm PDT
Satterthwaite, November 14, 1985 11:43:28 am PST
Russ Atkinson (RRA) December 3, 1989 11:42:07 am PST
DIRECTORY
Alloc USING [Handle],
ConstArith USING [Const],
IntCodeDefs USING [ArithClass, ArithSelector, CaseList, CedarSelector, Comparator, Count, Label, Location, LogicalId, MesaSelector, Node, NodeList, nullVariableId, Var, VarList],
MimCode USING [BitAddress, BitCount, CodeList, VLoc],
RCMap USING [Base, Index],
Symbols USING [Alignment, CSEIndex, CTXIndex, ISEIndex, RecordSEIndex, Type, typeANY],
Target: TYPE MachineParms USING [bitsPerWord],
Tree USING [Index, Link];
MimP5U: CEDAR DEFINITIONS = {
OPEN IntCodeDefs, MimCode, Symbols, Target;
Temp replacement for SymbolOps.RecField & SymbolOps.FnField
RecOrFnProc: TYPE = UNSAFE PROC
[ise: ISEIndex] RETURNS [offset: MimCode.BitAddress, size: INT];
RecField: RecOrFnProc;
FnField: RecOrFnProc;
Normal operations
Address: PROC [node: Node] RETURNS [Node];
AddrExtend: PROC [n: Node, to: BitCount ¬ bitsPerWord] RETURNS [Node];
AdjustLoc: UNSAFE PROC [vl: VLoc, rSei: RecordSEIndex, fSei: ISEIndex, tBits: BitCount]
RETURNS [VLoc];
AlignmentFromTree: UNSAFE PROC [t: Tree.Link, needsDeref: BOOL ¬ FALSE]
RETURNS [Symbols.Alignment];
AlignmentFromType: UNSAFE PROC [type: Type, needsDeref: BOOL ¬ FALSE]
RETURNS [Symbols.Alignment];
AllocLabel: PROC [id: LogicalId ¬ LAST[LogicalId]] RETURNS [Label];
AppendNodeList: PROC [cl: CodeList, nodes: NodeList];
ApplyOp: PROC [oper: Node, args: NodeList, bits: Count ¬ 0] RETURNS [Node];
ArithClassForTree: UNSAFE PROC [node: Tree.Index] RETURNS [ac: ArithClass];
ArithClassForType: UNSAFE PROC [type: Type] RETURNS [ac: ArithClass];
ArithOp: PROC [op: ArithSelector, ac: ArithClass] RETURNS [Node];
ArithOpForTree: UNSAFE PROC [node: Tree.Index, op: ArithSelector] RETURNS [Node];
Assign: PROC [lhs: Var, rhs: Node] RETURNS [Node];
AssignRC: UNSAFE PROC
[lhs: Var, rhs: Node, type: Type, init: BOOL ¬ FALSE] RETURNS [Node];
BinaryArithOp: PROC [op: ArithSelector, ac: ArithClass, n1, n2: Node] RETURNS [Node];
BitsForOperand: UNSAFE PROC [t: Tree.Link] RETURNS [INT];
BitsForType: UNSAFE PROC [sei: Type] RETURNS [INT];
BoolTest: PROC [exp: Node] RETURNS [BoolTestValue];
BoolTestValue: TYPE = {true, false, unknown};
BoundsCheck: PROC [exp, bound: Node] RETURNS [Node];
CedarOpNode: PROC [op: CedarSelector, info: INT ¬ 0] RETURNS [Node];
CgenUtilInit: UNSAFE PROC [ownTable: Alloc.Handle];
CJump: PROC [cl: CodeList, test: Comparator, op1, op2: Node, ac: ArithClass, target: Label, backwards: BOOL ¬ FALSE];
CompareOp: PROC [sense: Comparator, ac: ArithClass] RETURNS [Node];
ConvertOpNode: PROC [from, to: ArithClass] RETURNS [Node];
CreateTemp: UNSAFE PROC [bits: BitCount, type: Type ¬ typeANY]
RETURNS [var: Var, sei: ISEIndex];
Declare: PROC [cl: CodeList, var: Var, init: Node ¬ NIL];
Deref: PROC [n: Node, bits: Count, align: Symbols.Alignment] RETURNS [Var];
EqualTest: PROC [n1: Node, n2: Node, negate: BOOL ¬ FALSE] RETURNS [Node];
Extend: UNSAFE PROC [n: Node, bits: BitCount, type: Type] RETURNS [Node];
ExtractList: PROC [cl: CodeList] RETURNS [NodeList];
ForceBool: PROC [n: Node, negate: BOOL ¬ FALSE] RETURNS [Node];
Forces the given node to be a clean boolean test, with optional negation.
NIL is ignored as an input, though.
FormalVar: PROC [bits: BitCount] RETURNS [Var];
FullWordBits: PROC [bits: BitCount] RETURNS [BitCount];
GetRCMapBase: UNSAFE PROC RETURNS [RCMap.Base];
Returns the base needed to interpret RC maps
InsertLabel: PROC [cl: CodeList, lbl: Label];
IsZero: PROC [n: Node] RETURNS [BOOL];
Jump: PROC [cl: CodeList, target: Label, backwards: BOOL ¬ FALSE];
LabelAddress: PROC [label: Label, direct: BOOL ¬ FALSE] RETURNS [Node];
MakeArgList2: PROC [first: Node, second: Node] RETURNS [NodeList];
MakeArgList: PROC [first: Node, last: NodeList ¬ NIL] RETURNS [NodeList];
MakeBlock: PROC [cl: CodeList, bits: BitCount ¬ 0] RETURNS [Node];
MakeCaseList: PROC [tests: NodeList, body: Node, rest: CaseList ¬ NIL] RETURNS [CaseList];
MakeComposite: PROC [parts: NodeList, bits: BitCount ¬ 0] RETURNS [Var];
If bits = 0 then the bits are calculated from the parts
MakeConstCard: PROC [card: CARD, bits: BitCount ¬ bitsPerWord] RETURNS [Node];
MakeConstInt: PROC [int: INT, bits: BitCount ¬ bitsPerWord] RETURNS [Node];
MakeDummy: PROC [bits: BitCount ¬ bitsPerWord] RETURNS [Node];
MakeGoTo: PROC [label: Label, backwards: BOOL ¬ FALSE] RETURNS [Node];
MakeNodeList2: PROC [first, second: Node] RETURNS [NodeList];
MakeNodeList: PROC [first: Node, last: NodeList ¬ NIL] RETURNS [NodeList];
MakeReturn: PROC [rets: NodeList] RETURNS [Node];
MakeTemp: UNSAFE PROC [cl: CodeList, bits: BitCount, init: Node ¬ NIL, type: Type ¬ typeANY] RETURNS [var: Var, sei: ISEIndex];
MakeVar: PROC [bits: Count, id: LogicalId ¬ nullVariableId, loc: Location] RETURNS [Var];
MakeVarList: PROC [first: Var, last: VarList ¬ NIL] RETURNS [VarList];
MaybeBlock: PROC [cl: CodeList, l: Node] RETURNS [Node];
MesaOpNode: PROC [op: MesaSelector, info: INT ¬ 0, bits: INT ¬ 0] RETURNS [Node];
MoreCode: PROC [cl: CodeList, n: Node];
NewCodeList: PROC RETURNS [CodeList];
NextVar: UNSAFE PROC [sei: ISEIndex] RETURNS [ISEIndex];
NilConst: UNSAFE PROC [type: CSEIndex] RETURNS [Node];
NodeAnd: PROC [n1, n2: Node] RETURNS [Node];
NodeForType: UNSAFE PROC [type: Type] RETURNS [Node];
NodeIf: PROC [test, then, else: Node] RETURNS [Node];
NodeOr: PROC [n1, n2: Node] RETURNS [Node];
OperandType: UNSAFE PROC [t: Tree.Link] RETURNS [sei: CSEIndex];
PadArgList: PROC [args: NodeList] RETURNS [NodeList];
ProcessSafens: UNSAFE PROC
[cl: CodeList, t: Tree.Link, ignore: BOOL ¬ FALSE] RETURNS [Tree.Link];
RCMapForType: UNSAFE PROC [type: Symbols.Type] RETURNS [RCMap.Index];
Returns the RC map index for the given type
RealExtend: PROC [n: Node, to: BitCount ¬ bitsPerWord] RETURNS [Node];
ReferentType: UNSAFE PROC [type: Type] RETURNS [Type];
SignExtend: PROC [n: Node, to: BitCount ¬ bitsPerWord] RETURNS [Node];
Simplify: PROC [cl: CodeList, node: Node] RETURNS [Node];
Returns a simple node (side-effect free) for the original node. Any temps needed are declared in the given code list.
TakeField: PROC [n: Node, start: INT, bits: INT] RETURNS [Node];
TakeFieldVar: PROC [n: Node, start: INT, bits: INT] RETURNS [Var];
= NARROW[TakeField[n, start, bits]]
TreeLiteralValue: UNSAFE PROC [t: Tree.Link] RETURNS [ConstArith.Const];
TypeForTree: UNSAFE PROC [t: Tree.Link] RETURNS [Type];
VariantTag: UNSAFE PROC [type: Type, ctx: CTXIndex] RETURNS [CARD];
WordsForBits: PROC [b: INT] RETURNS [INT];
WordsForOperand: UNSAFE PROC [t: Tree.Link] RETURNS [INT];
WordsForSei: UNSAFE PROC [sei: Type] RETURNS [INT];
Computes the # of words for the symbol given by sei.
ZeroExtend: PROC [n: Node, to: BitCount ¬ bitsPerWord, forceLeft: BOOL ¬ FALSE]
RETURNS [cvt: Node];
Extends the value described by n to be at least to bits long. No zeros are added if n.bits >= to. Zeros are added to the left if forceLeft or to < bitsPerWord. Otherwise, zero bits are added on the right.
}.