P3:
DEFINITIONS
IMPORTS PrincOpsUtils = {
OPEN Symbols;
mark: BOOL = TRUE; -- mark in tree as set by pass 3
text literals
TextForm: TYPE = {text, rope, ropeText};
attributes
Attr:
TYPE =
RECORD [
noAssign: BOOL,
noXfer: BOOL,
const: BOOL];
emptyAttr: Attr = [noAssign:FALSE, noXfer:FALSE, const:FALSE];
fullAttr: Attr = [noAssign:TRUE, noXfer:TRUE, const:TRUE];
voidAttr: Attr = [noAssign:TRUE, noXfer:TRUE, const:FALSE];
And: PROC [Attr, Attr] RETURNS [Attr] = LOOPHOLE[PrincOpsUtils.BITAND];
safety (Cedar)
Safety: TYPE = {none, asserted, checked};
narrowing operations
NarrowOp:
TYPE =
RECORD [
error, indirect, rtTest, tagTest, computed, unImpl: BOOL←FALSE];
parameter use bookkeeping (for subst by name)
NPUse: TYPE = {none, ref, set, refset, unsafe}; -- (name) param use
NPMap: TYPE = ARRAY NPUse OF ARRAY NPUse OF NPUse;
SetNP: ARRAY NPUse OF NPUse = [set, refset, set, refset, unsafe];
MergeNP: NPMap =
[[ none, ref, set, refset, unsafe],
[ ref, ref, unsafe, unsafe, unsafe],
[ set, unsafe, set, unsafe, unsafe],
[refset, unsafe, unsafe, unsafe, unsafe],
[unsafe, unsafe, unsafe, unsafe, unsafe]];
SequenceNP: NPMap =
[[ none, ref, set, refset, unsafe],
[ ref, ref, refset, refset, unsafe],
[ set, unsafe, set, unsafe, unsafe],
[refset, unsafe, refset, unsafe, unsafe],
[unsafe, unsafe, unsafe, unsafe, unsafe]];
BoundNP: NPMap =
[[ none, ref, set, refset, unsafe],
[ ref, ref, unsafe, refset, unsafe],
[ set, unsafe, set, refset, unsafe],
[refset, refset, refset, refset, unsafe],
[unsafe, unsafe, unsafe, unsafe, unsafe]];
notifiers
DeclNotify, MiscNotify, StmtNotify, VRNotify: Alloc.Notifier;
ExpANotify, ExpBNotify, ExpCNotify: Alloc.Notifier;
exported by Pass3B
Header: PROC [node: Tree.Index];
SetDefaultImport: PROC [iCtx: IncludedCTXIndex, implicitOK: BOOL←FALSE];
exported by Pass3D
DeclList: Tree.Scan;
FirstId: PROC [Tree.Index] RETURNS [ISEIndex];
InitialExp: PROC [Tree.Link, SEIndex] RETURNS [v: Tree.Link, extended: BOOL];
MakeLongType: PROC [SEIndex, CSEIndex] RETURNS [CSEIndex];
MakeRefType:
PROC [cType: SEIndex, hint: CSEIndex, readOnly,counted,var:
BOOL←
FALSE]
RETURNS [RefSEIndex];
ResolveType: PROC [ISEIndex];
ResolveValue: PROC [ISEIndex];
TypeAppl: Tree.Map;
TypeExp: Tree.Map;
exported by Pass3I
IdInit: PROC [UNCOUNTED ZONE];
IdReset: Tree.Scan;
ArrangeKeys:
PROC [
expList: Tree.Link,
nextKey: PROC RETURNS [HTIndex],
omittedValue: PROC RETURNS [Tree.Link]]
RETURNS [CARDINAL];
BaseTree: PROC [Tree.Link, CSEIndex] RETURNS [Tree.Link];
BindTree: PROC [Tree.Link, PROC [ISEIndex] RETURNS [Tree.Link]] RETURNS [Tree.Link];
BumpCount: PROC [ISEIndex];
CheckDisjoint: PROC [ctx1, ctx2: CTXIndex];
ClearRefStack: PROC;
CloseBase: PROC [Tree.Link, HTIndex];
ClusterId: PROC [HTIndex, CTXIndex] RETURNS [found: BOOL, sei: ISEIndex];
CompleteRecord: PROC [rSei: RecordSEIndex, depth: Closure←$unit];
CopyTree: Tree.Map;
EnterIdList: PROC [IncludedCTXIndex, Tree.Link];
EnterComposite: PROC [type: CSEIndex, t: Tree.Link, init: BOOL];
EnterType: PROC [type: SEIndex, canonical: BOOL←TRUE];
FieldId: PROC [HTIndex, RecordSEIndex] RETURNS [CARDINAL, ISEIndex];
FindSe: PROC [HTIndex] RETURNS [symbol: ISEIndex, base: Tree.Link, indirect: BOOL];
Id: PROC [HTIndex] RETURNS [Tree.Link];
InterfaceId: PROC [HTIndex, CTXIndex] RETURNS [found: BOOL, sei: ISEIndex];
MainIncludedCtx: PROC [MDIndex] RETURNS [IncludedCTXIndex];
MakeIdTable: PROC [CARDINAL];
OpenBase: PROC [Tree.Link, HTIndex] RETURNS [Tree.Link];
OpenPointer: PROC [Tree.Link, CSEIndex] RETURNS [Tree.Link, CSEIndex];
PopCtx: PROC;
PushCtx: PROC [CTXIndex];
PushHtCtx: PROC [HTIndex, Tree.Link, BOOL];
PushRecordCtx: PROC [RecordSEIndex, Tree.Link, BOOL];
RecordLhs: PROC [ISEIndex];
RecordMention: PROC [ISEIndex];
SealRefStack: PROC;
SearchCtxList: PROC [HTIndex, CTXIndex] RETURNS [found: BOOL, sei: ISEIndex];
Shared: PROC [CTXIndex] RETURNS [BOOL];
TopCtx: PROC RETURNS [CTXIndex];
UnsealRefStack: PROC;
UpdateTreeAttr: PROC [Tree.Link] RETURNS [attr: Attr];
exported by Pass3M
CatchPhrase: PROC [Tree.Link] RETURNS [unwindCaught: BOOL];
CopyLock: PROC RETURNS [Tree.Link];
FindLockParams: PROC RETURNS [formal, actual: ISEIndex];
LockVar: PROC [Tree.Link] RETURNS [Tree.Link];
MakeFrameRecord: PROC [Tree.Link] RETURNS [CSEIndex];
MiscStmt: PROC [Tree.Index] RETURNS [Tree.Link];
MiscXfer: PROC [Tree.Index, CSEIndex] RETURNS [Tree.Link];
TextRep: PROC [SEIndex] RETURNS [TextForm];
XferForFrame: PROC [CTXIndex] RETURNS [CSEIndex];
InsertCatchLabel: SIGNAL [catchSeen, exit: BOOL];
exported by Pass3S
pathNP: VAR NPUse;
BodyList: PROC [firstBti: BTIndex];
BumpArgRefs: PROC [record: RecordSEIndex, write: BOOL];
Case: PROC [Tree.Index, Tree.Map];
CheckLocals: PROC [Tree.Link] RETURNS [localsOnly: BOOL];
SafetyAttr: PROC [Tree.Index] RETURNS [Safety];
SetSafety: PROC [Safety];
Scope: PROC [Tree.Index, Tree.Map];
Stmt: Tree.Map;
exported by Pass3V
DiscriminatedType: PROC [CSEIndex, Tree.Link] RETURNS [CSEIndex];
Discrimination: PROC [Tree.Index, Tree.Map];
Narrowing: PROC [type, target: CSEIndex] RETURNS [NarrowOp];
SelectVariantType: PROC [SEIndex, HTIndex] RETURNS [ISEIndex];
SequenceField: PROC [RecordSEIndex] RETURNS [ISEIndex];
VariantUnionType: PROC [SEIndex] RETURNS [CSEIndex];
exported by Pass3Xa
phraseNP: VAR NPUse;
All: PROC [node: Tree.Index, target: CSEIndex, init: BOOL←FALSE];
Apply: PROC [Tree.Index, CSEIndex, BOOL] RETURNS [Tree.Index];
Assignment: PROC [Tree.Index];
CheckScope: PROC [Tree.Link, CSEIndex] RETURNS [Tree.Link];
Dot: PROC [Tree.Index, CSEIndex] RETURNS [Tree.Index];
Extract: PROC [Tree.Index];
FieldDefault: PROC [ISEIndex] RETURNS [Tree.Link];
Initialization: PROC [CSEIndex, Tree.Link] RETURNS [Tree.Link];
InterfaceCtx: PROC [CSEIndex, Tree.Link] RETURNS [CTXIndex];
MatchFields:
PROC [
record: RecordSEIndex, expList: Tree.Link,
init: BOOL←FALSE, scopeCheck: BOOL←TRUE]
RETURNS [Tree.Link];
exported by Pass3Xb
ExpInit: PROC [UNCOUNTED ZONE];
ExpReset: PROC;
Exp: PROC [Tree.Link, CSEIndex] RETURNS [Tree.Link];
Interval: PROC [Tree.Link, CSEIndex, BOOL];
ForceType: PROC [Tree.Link, CSEIndex] RETURNS [Tree.Link];
RAttr: PROC RETURNS [Attr];
Rhs: PROC [Tree.Link, CSEIndex] RETURNS [Tree.Link];
RPop: PROC;
RPush: PROC [CSEIndex, Attr];
RType: PROC RETURNS [CSEIndex];
VoidExp: Tree.Map;
exported by Pass3Xc
AddrOp: PROC [Tree.Index, CSEIndex];
Range: PROC [Tree.Link, CSEIndex] RETURNS [Tree.Link];
Span: PROC [CSEIndex] RETURNS [first, last: Copier.SEToken];
}.