HandCodingComfortsImpl.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Peter Kessler, February 20, 1986 3:36:59 pm PST
Russ Atkinson (RRA) September 10, 1986 11:57:14 pm PDT
DIRECTORY
DragOpsCrossUtils USING [IntToWord],
HandCoding USING [const0, const1, const3, const4, constN1, constN2, constNI, drDFC, drJB, drJEBBJ, drJNEBBJ, drLC0, drLC1, drLC2, drLC3, drLC4, drLC5, drLC6, drLC7, drLFC, drLIB, drLIDB, drLIQB, drRJEBJ, drRJGBJ, drRJGEBJ, drRJLBJ, drRJLEBJ, drRJNEBJ, drRVSUB, drWRI, Lit8, pushDst, RegSpec, ShortRegSpec],
HandCodingComforts USING [],
HandCodingPseudos USING [Label, MakeLabelGlobal, ProcedureEntry, UseLabel16, UseLabel32, UseLabel8A, UseLabel8B],
Rope USING [ROPE];
HandCodingComfortsImpl: CEDAR PROGRAM
IMPORTS DragOpsCrossUtils, HandCoding, HandCodingPseudos
EXPORTS HandCodingComforts = {
OPEN HandCoding, HandCodingPseudos;
Prologue: PUBLIC PROC [name: Rope.ROPE, label: Label, args: INT] = {
associates the name with the label, defines the label and makes it global
ProcedureEntry[label, args];
MakeLabelGlobal[name, label];
};
Instructions that use labels
iDFC: PUBLIC PROC [dest: Label] = {
drDFC[UseLabel32[dest]];
};
iLFC: PUBLIC PROC [dest: Label] = {
drLFC[UseLabel16[dest]];
};
iJB: PUBLIC PROC [dest: Label] = {
drJB[UseLabel8A[dest]];
};
iJEQj: PUBLIC PROC [AlphaZ: Lit8, dest: Label] = {
drJEBBJ[AlphaZ, UseLabel8B[dest]];
};
iJNEj: PUBLIC PROC [AlphaZ: Lit8, dest: Label] = {
drJNEBBJ[AlphaZ, UseLabel8B[dest]];
};
iRJGTj: PUBLIC PROC [a: ShortRegSpec, b: RegSpec, dest: Label] = {
drRJGBJ[a, b, UseLabel8B[dest]];
};
iRJGEj: PUBLIC PROC [a: ShortRegSpec, b: RegSpec, dest: Label] = {
drRJGEBJ[a, b, UseLabel8B[dest]];
};
iRJEQj: PUBLIC PROC [a: ShortRegSpec, b: RegSpec, dest: Label] = {
drRJEBJ[a, b, UseLabel8B[dest]];
};
iRJNEj: PUBLIC PROC [a: ShortRegSpec, b: RegSpec, dest: Label] = {
drRJNEBJ[a, b, UseLabel8B[dest]];
};
iRJLEj: PUBLIC PROC [a: ShortRegSpec, b: RegSpec, dest: Label] = {
drRJLEBJ[a, b, UseLabel8B[dest]];
};
iRJLTj: PUBLIC PROC [a: ShortRegSpec, b: RegSpec, dest: Label] = {
drRJLBJ[a, b, UseLabel8B[dest]];
};
Miscellaneous other instructions
iWRI: PUBLIC PROC [BetaR: RegSpec, AlphaZ: Lit8, BetaL: RegSpec] = {
This just shuffles the operands around to make them appear in a reasonable order.
drWRI[BetaL, BetaR, AlphaZ];
};
``Macro''s
LoadConstant: PUBLIC PROC [value: INT ← 0] = {
with lookup by value
SELECT value FROM
The known register values
0 => drLC0[];
1 => drLC1[];
2 => drLC2[];
3 => drLC3[];
4 => drLC4[];
-2 => drLC5[];
-1 => drLC6[];
FIRST[INT] => drLC7[];
Synthetic values (smaller than LIQB)
-3 => drRVSUB[pushDst, const0, const3];
-4 => drRVSUB[pushDst, const0, const4];
-5 => drRVSUB[pushDst, constN1, const4];
-6 => drRVSUB[pushDst, constN2, const4];
LAST[INT] => drRVSUB[pushDst, constNI, const1];
ENDCASE =>
SELECT value FROM
IN [0..255] => drLIB[value];
IN [256..65535] => drLIDB[value];
ENDCASE => drLIQB[DragOpsCrossUtils.IntToWord[value]];
};
}.