[ivy]<Satterthwaite>Modula>M2I.mesa!2

FILE: M2I.mesa
Modula-2 Code-Generator, Part 3
Last Edited by: Gutknecht, September 19, 1985 10:57:15 pm PDT
Satterthwaite December 9, 1985 1:33:55 pm PST
DIRECTORY
Rope USING [ROPE],
M2D USING [ObjPtr];
M2I: CEDAR DEFINITIONS = BEGIN
Relation: TYPE = { false, NE, LS, LE, GE, GT, EQ, true };
inv: ARRAY Relation OF Relation = [true, EQ, GE, GT, LS, LE, NE, false];
pc: VAR CARDINAL;
InitGenerator, Reloc: PROC;
Entry: PROC [no: CARDINAL];
AllocString: PROC [id: CARDINAL] RETURNS [adr, length: CARDINAL];
elementary operations
PutOI: PROC [op: CARDINAL];
PutOB: PROC [op, lit: CARDINAL];
PutODB: PROC [op, lit: CARDINAL];
PutOQB: PROC [op: CARDINAL, lit: LONG INTEGER];
PutJBB: PROC [op: CARDINAL, dist: INTEGER, lit: CARDINAL];
PutLR: PROC [op: CARDINAL];
PutLRB: PROC [op, dsp: CARDINAL];
PutLRRB: PROC [op, dsp: CARDINAL, reg1, reg2: [0..15]];
PutRR: PROC [op: CARDINAL, cOpt, aOpt, bOpt, aux: [0..1], c, a, b: [0..15]];
PutQR: PROC [op: CARDINAL, bOpt, aux: [0..1], b: [0..15]];
PutRJB: PROC [op: CARDINAL, sdd, sd, opt, aux: [0..1], reg: [0..15], dist: INTEGER];
PutExch: PROC;
generic operations
PutLod: PROC [lit: LONG INTEGER]; --load literal
PutAdd: PROC [lit: LONG INTEGER]; --add literal
PutSub: PROC [lit: LONG INTEGER]; --sub literal
PutSOp: PROC [opr, opt1, reg1, opt2, reg2: CARDINAL]; --result on stack
PutROp: PROC [opr, resReg, opt1, reg1, opt2, reg2: CARDINAL]; --result in reg
PutBJ: PROC [rel: Relation, opt, reg, loc: CARDINAL]; -- back jmp
PutFJ: PROC [rel: Relation, opt, reg, loc: CARDINAL] RETURNS [Loc: CARDINAL]; --forw jmp
fixup operations
FixByte: PROC [byte: CARDINAL];
FixInt: PROC [loc: CARDINAL, i: INTEGER];
FixLong: PROC [loc: CARDINAL, i: LONG INTEGER];
FixAD: PROC [loc, LMF, size: CARDINAL]; --alloc/dealloc FRX
FixSL: PROC [loc, SL: CARDINAL]; --stat link in FRX
FixDO: PROC [loc, off: CARDINAL]; --data offset in FRX
FixLR: PROC [loc, cell, cell1: CARDINAL]; --local reg init
FixJmp: PROC [loc, dest: CARDINAL];
FixLink: PROC [loc, dest: CARDINAL];
MergedLinks: PROC [L0, L1: CARDINAL] RETURNS [CARDINAL];
CheckCode: PROC;
OutCodeFile: PROC [name: Rope.ROPE, np, size, modNo: CARDINAL, mod: M2D.ObjPtr];
END.