TargetArchitecture.mesa
Copyright Ó 1989 by Xerox Corporation. All rights reserved.
Peter B. Kessler, April 9, 1990 3:48:35 pm PDT
Target-independent definitions. To be implemented by a corresponding target-dependent implementation module.
Not quite target-independent, since this knows about 32 bit words.
TargetArchitecture: CEDAR DEFINITIONS ~ {
Types
Address: TYPE[SIZE[CARD32]];
nullAddress: Address ~ LOOPHOLE[FIRST[CARD32]];
Displacement: TYPE ~ INT32 ← nullDisplacement;
nullDisplacement: Displacement ~ 0;
Contents: TYPE[SIZE[CARD32]];
nullContents: Contents ~ LOOPHOLE[FIRST[CARD32]];
zeroContents: Contents ~ LOOPHOLE[CARD32[0]];
The claim here is that a zero is a zero is a zero, regardless of architecture.
Instruction: TYPE[SIZE[CARD32]];
nullInstruction: Instruction ~ LOOPHOLE[FIRST[CARD32]];
RegisterClass: TYPE ~ MACHINE DEPENDENT {
none (0), all (LAST[INT16])
} ← nullRegisterClass;
nullRegisterClass: RegisterClass ~ RegisterClass.none;
Mostly you don't use TargetArchitecture.RegisterClass, you use a transfer proc from machine specific register classes to a TargetArchitecture.RegisterClass.
Procedures.
IsNullAddress: PROCEDURE [address: Address] RETURNS [BOOLEAN];
AddressFromDisplacement: PROCEDURE [
address: Address, displacement: Displacement]
RETURNS [Address];
DisplacementFromAddresses: PROCEDURE [here: Address, there: Address]
RETURNS
[Displacement];
NextInstruction: PROCEDURE [pc: Address] RETURNS [Address];
PrevInstruction: PROCEDURE [pc: Address] RETURNS [Address];
InstructionFromContents: PROCEDURE [contents: Contents] RETURNS [Instruction];
ContentsFromInstruction: PROCEDURE [instruction: Instruction]
RETURNS
[Contents];
}.