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];
}.