DIRECTORY IntCodeTarget USING [BitOrder], Rope USING [ROPE], Target: TYPE MachineParms USING [BitOrder, bitOrder, bitsPerAU, bitsPerByte, bitsPerWord]; IntCodeTargetImpl: CEDAR PROGRAM EXPORTS IntCodeTarget = BEGIN ROPE: TYPE = Rope.ROPE; name: PUBLIC ROPE ¬ "Sun-3/4"; bitsPerAU: PUBLIC NAT ¬ Target.bitsPerAU; logBitsPerAU: PUBLIC NAT ¬ ExactLog2[bitsPerAU]; bytesPerAU: PUBLIC NAT ¬ Target.bitsPerAU/Target.bitsPerByte; logBytesPerAU: PUBLIC NAT ¬ ExactLog2[bytesPerAU]; bitOrder: PUBLIC IntCodeTarget.BitOrder ¬ SELECT Target.bitOrder FROM $msBit => $msBit, $lsBit => $lsBit, ENDCASE => ERROR; maxBitsArgumentRecord: PUBLIC NAT ¬ 16*Target.bitsPerWord; minBitsPerArgument: PUBLIC NAT ¬ Target.bitsPerWord; logMinBitsPerArgument: PUBLIC NAT ¬ ExactLog2[minBitsPerArgument]; maxBitsReturnRecord: PUBLIC NAT ¬ 1*Target.bitsPerWord; minBitsPerReturn: PUBLIC NAT ¬ Target.bitsPerWord; logMinBitsPerReturn: PUBLIC NAT ¬ ExactLog2[minBitsPerReturn]; bitsPerGlobal: PUBLIC NAT ¬ Target.bitsPerWord; logBitsPerGlobal: PUBLIC NAT ¬ ExactLog2[bitsPerGlobal]; firstGlobalOffset: PUBLIC NAT ¬ 4*Target.bitsPerWord; directGlobals: PUBLIC BOOL ¬ FALSE; lastRegister: PUBLIC NAT ¬ 0; lastStack: PUBLIC NAT ¬ 0; bitsPerLocal: PUBLIC NAT ¬ Target.bitsPerWord; logBitsPerLocal: PUBLIC NAT ¬ ExactLog2[bitsPerLocal]; bitsPerLink: PUBLIC NAT ¬ Target.bitsPerWord; logBitsPerLink: PUBLIC NAT ¬ ExactLog2[bitsPerLink]; ExactLog2: PROC [n: NAT] RETURNS [log2: NAT ¬ 2] = { RETURN [SELECT n FROM 1 => 0, 2 => 1, 4 => 2, 8 => 3, 16 => 4, 32 => 5, 64 => 6, 128 => 7, 256 => 8, 512 => 9, 1024 => 10, 2048 => 11, 4096 => 12, 8192 => 13, 16384 => 14 ENDCASE => ERROR]; }; END. $ IntCodeTargetImpl.mesa Copyright Σ 1986, 1987, 1991 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) December 4, 1987 3:35:18 pm PST JKF July 27, 1988 8:17:08 am PDT This file has definitions that allow us to be parameterized according to the target. Most of the variables are not constants to allow us to share more code without recompilation. Machine description Gives a human-readable name for the target machine. Useful for messages. Addressing units Bit order Arguments & returns gives the max # of direct argument words Gives the minimum # of bits for an argument (to get the bits for an argument, round up & shift by logMinBitsPerArgument) gives the max # of direct return words Gives the minimum # of bits for an return value Global frame Gives the minimum # of bits for an global variable (can be different than locals) First offset usable for global variables (in bits) (what should this be?) TRUE => target supports direct use of global variables FALSE => target requires global frame pointer Local frame & stack Gives # of registers to be used for local variables Gives last stack location to be used for passing arguments Gives the minimum # of bits for a local variable Gives the minimum # of bits for a link (uniform for static link, global link, & frame extension if any). ΚU•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ Οeœ=™HK™3K™ K˜šΟk ˜ Kšœžœ ˜Kšœžœžœ˜KšœžœN˜Z——headšœžœž˜ Kšžœ˜Kšœž˜K˜Kšžœžœžœ˜K˜K™³K˜—head2™šœžœžœ ˜KšœI™I——™šœ žœžœ˜)Kšœžœžœ˜0—šœ žœžœ'˜=Kšœžœžœ˜2——™ šœ žœžœž˜EKšœ˜Kšœ˜Kšžœžœ˜——™šœžœžœ˜:K™(—šœžœžœ˜4Kšœžœžœ!˜Bšœ+™+KšœL™L——šœžœžœ˜7K™&—šœžœžœ˜2Kšœžœžœ˜>Kšœ/™/—K˜—™ šœžœžœ˜/Kšœžœžœ˜8šœ2™2K™—K˜—šœžœžœ˜5šœ2™2K™—K™—šœžœžœžœ˜#Kšžœ2™6Kšžœ(™-—K˜—™šœžœžœ˜Kšœ3™3—šœ žœžœ˜Kšœ:™:K™—šœžœžœ˜.Kšœžœžœ˜6Kšœ0™0K˜—šœ žœžœ˜-Kšœžœžœ˜4šœ&™&KšœA™A——K˜—š Οn œžœžœžœžœ ˜4šžœžœž˜KšœD˜DKšœO˜OKšžœžœ˜—K˜K˜—Kšžœ˜˜K˜K˜—K˜K˜—…—‚ϋ