MimP4.mesa
Copyright Ó 1985, 1986, 1987, 1988, 1989, 1991 by Xerox Corporation. All rights reserved.
Satterthwaite, June 19, 1986 9:31:18 am PDT
Russ Atkinson (RRA) October 11, 1989 6:43:38 pm PDT
JKF August 15, 1988 2:40:09 pm PDT
DIRECTORY
Alloc USING [Notifier],
ConstArith USING [Const],
Literals USING [LitDescriptor],
MobDefs USING [Link, ModuleIndex],
OSMiscOps USING [WordAnd],
Symbols,
Tree USING [Index, Link, Map, NodeName, Scan];
MimP4: DEFINITIONS
IMPORTS OSMiscOps = {
OPEN Symbols;
mark: BOOL = FALSE;
ownGfi: MobDefs.ModuleIndex = 1;
Bias: TYPE = ConstArith.Const;
representations (interim)
Repr: TYPE = MACHINE DEPENDENT {
none (0), signed (1), unsigned (2), either (3), real (4), addr (8), other (16), all (31)
};
CommonRep: PROC [r1: Repr, r2: Repr] RETURNS [Repr] = INLINE {
RETURN [LOOPHOLE [OSMiscOps.WordAnd[LOOPHOLE[r1, WORD], LOOPHOLE[r2, WORD]]]];
};
properties (synthesized)
Prop: TYPE = MACHINE DEPENDENT RECORD [
noAssign: BOOL,
noXfer: BOOL,
noSelect: BOOL,
noFreeVar: BOOL,
immutable: BOOL];
fullProp: Prop = [
noAssign: TRUE, noXfer: TRUE, noSelect: TRUE, noFreeVar: TRUE, immutable: TRUE];
emptyProp: Prop = [
noAssign: FALSE, noXfer: FALSE, noSelect: FALSE, noFreeVar: FALSE, immutable: FALSE];
voidProp: Prop = fullProp;
CommonProp: PROC [p1: Prop, p2: Prop] RETURNS [Prop] = INLINE {
RETURN [LOOPHOLE [OSMiscOps.WordAnd[LOOPHOLE[p1, WORD], LOOPHOLE[p2, WORD]]]];
};
attributes
Attr: TYPE = PACKED RECORD [prop: Prop, rep: Repr];
voidAttr: Attr = [prop: voidProp, rep: none];
CommonAttr: PROC [a1: Attr, a2: Attr] RETURNS [Attr] = INLINE {
RETURN [LOOPHOLE [OSMiscOps.WordAnd[LOOPHOLE[a1, WORD], LOOPHOLE[a2, WORD]]]];
};
notifiers
LayoutNotify, StmtNotify: Alloc.Notifier;
OpsNotify, ExpANotify, ExpBNotify, ExpCNotify: Alloc.Notifier;
variables exported by Pass4B
tTRUE: READONLY Tree.Link;
tFALSE: READONLY Tree.Link;
intermediate result bookkeeping
returnRecord: RecordSEIndex;
resumeRecord: RecordSEIndex;
implicit: ImplicitRecord;
ImplicitRecord: TYPE = RECORD [
bias: Bias, -- assumed bias of empty
lb: Bias, -- assumed lb of empty (if meaningful)
ub: Bias, -- assumed ub of empty (if meaningful)
type: Type, -- assumed type of empty
attr: Attr, -- assumed attributes of empty
sef: BOOL-- assumed sense of SideEffectFree for empty
];
nullBias: READONLY Bias; -- constant bias of zero
lockNode: Tree.Index;
resident: BOOL;
procs exported by Pass4B
AssignImports: Tree.Scan;
InitMob: PROC [Tree.Link];
FinishMob: Tree.Scan;
MakeEPLink: PROC [ep: CARDINAL, gfi: MobDefs.ModuleIndex] RETURNS [MobDefs.Link];
MatchMob: PROC RETURNS [BOOL];
ProcessSymLiterals: PROC;
exported by Pass4D
BiasForType: PROC [Type] RETURNS [Bias];
CanonicalType: PROC [Type] RETURNS [Type];
ClearType: PROC [Type] RETURNS [CSEIndex];
ComparableType: PROC [Type] RETURNS [BOOL];
DeclItem: Tree.Scan;
DeclUpdate: Tree.Map;
DefaultBasicOps: PROC [Type, BitCount] RETURNS [BOOL];
MaxCardinality: PROC [Type, BOOL, CARD] RETURNS [CARD];
RepForType: PROC [Type] RETURNS [Repr];
TypeExp: PROC [typeExp: Tree.Link, body: BOOL ¬ FALSE, avoidId: BOOL ¬ FALSE];
TypeForTree: PROC [Tree.Link] RETURNS [Type];
VarInit: SIGNAL RETURNS [BOOL];
exported by Pass4L
AssignEntries: PROC [BTIndex];
AUsForType: PROC [Type] RETURNS [CARD];
BitsForType: PROC [Type] RETURNS [BitCount];
CheckBlock: PROC [BTIndex];
CheckFields: PROC [RecordSEIndex, BitCount];
LayoutArgs: PROC [RecordSEIndex, BitCount, BOOL] RETURNS [BitCount];
LayoutBlock: PROC [BTIndex, BitCount] RETURNS [BitCount];
LayoutFields: PROC [RecordSEIndex, BitCount];
LayoutGlobals: PROC [bti: CBTIndex] RETURNS [BitCount];
LayoutInterface: PROC [bti: CBTIndex] RETURNS [nEntries: CARDINAL];
LayoutLocals: PROC [CBTIndex] RETURNS [BitCount];
MarkArgs: PROC [Type];
Performs Pass4 processing on a transfer type
WordsForType: PROC [Type] RETURNS [CARD];
exported by Pass4S
currentLevel: VAR ContextLevel;
checked: VAR BOOL;
BindCase: PROC
[Tree.Index, Tree.NodeName, PROC [Tree.Link, Bias] RETURNS [Tree.Link]]
RETURNS [Tree.Link];
BindType: PROC [Tree.Index, Tree.Map] RETURNS [Tree.Link];
Body: PROC [CBTIndex];
CaseDriver: PROC [Tree.Index, Tree.Map, Bias] RETURNS [Tree.Link];
CatchNest: PROC [Tree.Link];
KillTree: PROC [t: Tree.Link] RETURNS [Tree.Link];
kills off the given true, returning Tree.Null;
will disable any procedure declarations found within the tree as well
MarkString: PROC [local: BOOL¬TRUE];
Subst: PROC [Tree.Index] RETURNS [Tree.Link];
exported by Pass4Ops
RelOp: TYPE = Tree.NodeName [relE .. relLE];
BoolTest: PROC [Tree.Link] RETURNS [BOOL];
FoldExpr: PROC [Tree.Index, Repr] RETURNS [Tree.Link];
LiteralRep: PROC [Tree.Link, Repr] RETURNS [Repr];
LongToShort: PROC [Tree.Index, Repr] RETURNS [Tree.Link];
MakeTreeLiteralCard: PROC [CARD] RETURNS [Tree.Link];
MakeTreeLiteralInt: PROC [INT] RETURNS [Tree.Link];
RelTest: PROC [l,r: Tree.Link, op: RelOp, rep: Repr] RETURNS [BOOL];
ShortToLong: PROC [Tree.Index, Repr] RETURNS [Tree.Link];
StructuredLiteral: PROC [Tree.Link] RETURNS [BOOL];
TreeLiteral: PROC [t: Tree.Link, allowLong: BOOL ¬ FALSE] RETURNS [BOOL];
TreeLiteralConst: PROC [Tree.Link] RETURNS [ConstArith.Const];
TreeLiteralDesc: PROC [Tree.Link] RETURNS [Literals.LitDescriptor];
TreeLiteralCard: PROC [Tree.Link] RETURNS [CARD];
TreeLiteralInt: PROC [Tree.Link] RETURNS [INT];
ZeroP: PROC [Tree.Link] RETURNS [BOOL];
exported by Pass4Xa
ConsState: TYPE = {init, first, rest};
Covering: TYPE = {none, partial, full};
All: PROC [node: Tree.Index, cs: ConsState¬$init] RETURNS [Tree.Link];
Assignment: PROC [Tree.Index] RETURNS [Tree.Link];
Bounds: PROC [Type, Repr] RETURNS [lb, ub: ConstArith.Const];
Call: PROC [Tree.Index] RETURNS [Tree.Link];
CheckRange: PROC [Tree.Link, CARD, Type] RETURNS [Tree.Link];
Construct: PROC [node: Tree.Index, cs: ConsState¬$init] RETURNS [Tree.Link];
Cover: PROC [lType: Type, lRep: Repr, rType: Type, rRep: Repr] RETURNS [Covering];
Dollar: PROC [Tree.Index] RETURNS [Tree.Link];
Dot: PROC [Tree.Index, Repr] RETURNS [Tree.Link];
Extract: PROC [Tree.Index] RETURNS [Tree.Link];
Index: PROC [Tree.Index] RETURNS [Tree.Link];
ListCons: PUBLIC PROC [Tree.Index] RETURNS [Tree.Link];
MakeArgRecord: PROC [RecordSEIndex, Tree.Link] RETURNS [Tree.Link];
Narrow: PROC [Tree.Index] RETURNS [Tree.Link];
New: PROC [Tree.Index] RETURNS [Tree.Link];
OperandStruct: PROC [t: Tree.Link, clear: BOOL] RETURNS [CSEIndex];
PadRecord: PROC [t: Tree.Link, lType: Type] RETURNS [Tree.Link];
RewriteAssign: PROC [Tree.Index, Type] RETURNS [Tree.Link];
Reloc: PROC [Tree.Index] RETURNS [Tree.Link];
Rhs: PROC [exp: Tree.Link, lhsType: Type, cs: ConsState¬$init, voidOK: BOOL¬FALSE]
RETURNS [Tree.Link];
RowConstruct: PROC [node: Tree.Index, cs: ConsState¬$init] RETURNS [Tree.Link];
SeqIndex: PROC [Tree.Index] RETURNS [Tree.Link];
SetSubInfo: PROC [t: Tree.Link, type: Type];
SetType: PROC [Type];
Substx: PROC [Tree.Index] RETURNS [Tree.Link];
UnbiasedOffset: PROC [type: Type] RETURNS [INT];
Union: PROC [node: Tree.Index, cs: ConsState¬$init] RETURNS [Tree.Link];
exported by Pass4Xb
ExpInit: PROC;
ExpReset: PROC;
AdjustBias: PROC [t: Tree.Link, rep: Repr, bias: Bias, negateBias: BOOL] RETURNS [Tree.Link];
BoolValue: PROC [t: Tree.Link] RETURNS [Tree.Link];
CheckSign: PROC [Tree.Link, Type] RETURNS [Tree.Link];
ConstMax: PROC [c1, c2: ConstArith.Const] RETURNS [ConstArith.Const];
ConstMin: PROC [c1, c2: ConstArith.Const] RETURNS [ConstArith.Const];
Exp: PROC [Tree.Link, Repr] RETURNS [Tree.Link];
ExpArith: PROC
[exp: Tree.Link, target: Repr, removeBias: BOOL ¬ FALSE] RETURNS [Tree.Link];
ForceType: PROC [Tree.Link, Type] RETURNS [Tree.Link];
LiteralAttr: PROC [Repr] RETURNS [Attr];
MakeStructuredCard: PROC [val: CARD, type: Type] RETURNS [Tree.Link];
MakeStructuredInt: PROC [val: INT, type: Type] RETURNS [Tree.Link];
NeutralExp: Tree.Map;
OperandType: PROC [Tree.Link] RETURNS [Type];
RValue: PROC [exp: Tree.Link, bias: Bias, target: Repr] RETURNS [Tree.Link];
SideEffectFree: PROC [t: Tree.Link] RETURNS [BOOL];
Returns a conservative estimate as to whether or not the tree will evaluate without side effects (memory changes, signals, and the like).
TreeBounds: PROC [t: Tree.Link, rep: Repr] RETURNS [lb, ub: ConstArith.Const];
VAttr: PROC RETURNS [Attr];
VBias: PROC RETURNS [Bias];
VPop: PROC;
VProp: PROC RETURNS [Prop];
VPush: PROC [bias: Bias, attr: Attr];
VRep: PROC RETURNS [Repr];
VSetTop: PROC [bias: Bias, attr: Attr, nPops: NAT];
the same as {THROUGH [0..nPops) VPop[]; ENDLOOP; VPush[bias, attr]}
exported by Pass4Xc
AddrOp: PROC [Tree.Index] RETURNS [Tree.Link];
ConstantInterval: PROC [Tree.Link] RETURNS [origin, range: Bias];
Interval: PROC [Tree.Link, Bias, Repr] RETURNS [const: BOOL];
IsSize: PROC [Tree.Link] RETURNS [BOOL];
Indicates whether the expression denotes addressing units. Quite conservative. Must be invoked prior to Pass4 Exp processing (or the constants go away).
Nil: PROC [Tree.Index] RETURNS [Tree.Link];
NormalizeRange: PROC [Tree.Link] RETURNS [Tree.Link];
MiscXfer: PROC [Tree.Index] RETURNS [Tree.Link];
TypeOp: PROC [Tree.Index] RETURNS [Tree.Link];
EmptyInterval: SIGNAL;
}.