DIRECTORY Rope; C2CTarget: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; bigEndian: BOOL = TRUE; runtimePrefix: READONLY ROPE; bitsPerWord: NAT = 32; word: READONLY ROPE; --= "word" wordCast: READONLY ROPE; --= "(word)" signedWord: READONLY ROPE; unsignedWord: READONLY ROPE; signedWordCast: READONLY ROPE; unsignedWordCast: READONLY ROPE; wordPtr: READONLY ROPE; wordPtrCast: READONLY ROPE; hasBytes: BOOL = TRUE; byte: READONLY ROPE; byteCast: READONLY ROPE; bytePtr: READONLY ROPE; bytePtrCast: READONLY ROPE; unsignedByteCast: READONLY ROPE; signedByte: READONLY ROPE; signedByteCast: READONLY ROPE; hasHalfWords: BOOL = TRUE; bitsPerHalfWord: NAT = 16; halfWord: READONLY ROPE; halfWordCast: READONLY ROPE; halfWordPtr: READONLY ROPE; halfWordPtrCast: READONLY ROPE; unsignedHalfCast: READONLY ROPE; signedHalf: READONLY ROPE; signedHalfCast: READONLY ROPE; bitsPerDoubleWord: NAT = 64; bitsPerAddressUnit: NAT = 8; addressUnitsPerWord: NAT = 4; charsPerWordInString: NAT = 4; --like bytesPerWord, but independent of having bytes bestAlignment: NAT = 32; maxBitsForReturns: READONLY INT; maxBitsForSimpleStructs: READONLY INT; maxBitsForValueParams: READONLY INT; maxWordsForInlineFillWords: READONLY INT; firstOfINT: READONLY CARD; maxBitsForFastLiterals: READONLY INT; maxBitsForFastAnd: READONLY INT; idMaxLength: READONLY NAT; BitsToWords: PROC [b: INT] RETURNS [w: INT]; RoundUpToWordBoundary: PROC [b: INT] RETURNS [bits: INT]; RoundUpToBestAlignment: PROC [b: INT] RETURNS [bits: INT]; RoundUpCharsToWords: PROC [cn: INT] RETURNS [chars: INT]; PointeeBits: PROC [usedBits: INT] RETURNS [INT]; TemporaryBits: PROC [usedBits: INT] RETURNS [INT]; definitions: READONLY ROPE; rightShiftSignedIsOk: READONLY BOOL; maskNShiftLikeSun: BOOL = TRUE; takingAddressIsExpensive: BOOL; consecutiveStringsAllocedAdj: READONLY BOOL; --true for C compilers that allocate space for consecutive string literals consecutively. END. \ C2CTarget.mesa Copyright Σ 1987, 1988, 1989, 1990, 1991 by Xerox Corporation. All rights reserved. Christian Jacobi, 1987 Christian Jacobi, January 29, 1993 10:55 am PST Defining the target architecture. Target is aimed at the Sun4 (SPARC processor). It is also working for Sun3, or, M68000, or, AMD29000 based architectures, but presenting slightly too strict alignments. There are multiple C2CTarget definitions (sources) defining multiple target architectures. C2C generates code for a particular target architecture by selecting the particular C2CTarget module and recompiling all of it. All C2CTarget definitions are supposed to export the same abstractions, only the values might be different. When editing C2CTarget, please do it for all versions on all target architectures. The following conventions hold Local variables have a size and are aligned at a multiple of bitsPerWord bits Global variables have a size and are aligned at a multiple of bitsPerWord bits for Sparc: The type double is never generated, soo double will not cause any alignment constraints. Some numbers are real constants for speed reasons... logically they should be READONLY VAR's prefix put in front of runtime system names This number is nicely parametrized, but not completely honest on all places. Type for an arithmetic memory unit and pointers. One of "int", "unsigned", or "long int"... which is best to hold pointers Cast into word type Type for a pointer to word Cast into word pointer type Byte adressing is possible and pointers can be cast between word pointers and byte pointers without loss, if alignment fits both. Type for a pointer to a byte Cast into pointer to a byte Type for a pointer to a half word Cast into pointer to a half word If something is aligned to bestAlignment, its adress can be used for any size object --as RISC machines often do not have load-literal instructions with full word range --literals of that many bits can be packed into an and instruction Id's shorter than idMaxLength are always distingushed rounds bits up to full number of words rounds bits up to full number of words rounds bits up to full number of units with the best alignment rounds char number up to full number of words --pointee: the guy sombody is pointing at --finds bits of unit a pointer is pointing at --finds bits to be used for a temporary --= MAX[bitsPerWord, PointeeBits[usedBits]] these definitions will define the types and constants otherwise mentioned --fills left with sign bits True for sun4 and mips Check this eventually; maybe we could get rid of it --true in architectures which put local variables in register ΚU•NewlineDelimiter –(cedarcode) style™šœ™Icodešœ ΟeœI™TKšœ™K™/K˜—šΟk ˜ K˜K˜—Jšœ!™!J™Jšœ.™.Jšœy™yJ™JšœΚ™ΚJ™JšœR™RK˜KšΟn œžœž œ˜Kšž˜K˜šœ™KšœM™MKšœN™NK™šœ/™/K™4—K™™4K™'——K˜Kšžœžœžœ˜K˜Kšœ žœžœ˜K˜šœžœžœ˜Kšœ+™+—K˜šœ žœ˜InothingšœL™L—šœžœžœΟc ˜K™0J™I—šœ žœžœ  ˜%K™—Kšœ žœžœ˜Kšœžœžœ˜Kšœžœžœ˜Kšœžœžœ˜ K˜K˜šœ žœžœ˜K™—šœ žœžœ˜K™—K˜šœ žœžœ˜K™KK™7—Kšœžœžœ˜Kšœ žœžœ˜šœ žœžœ˜K™—šœ žœžœ˜K™—K˜Kšœžœžœ˜ Kšœ žœžœ˜Kšœžœžœ˜K™K˜Kšœžœžœ˜Kšœžœ˜Kšœ žœžœ˜Kšœžœžœ˜šœ žœžœ˜K™!—šœžœžœ˜ K™ —K˜Kšœžœžœ˜ Kšœ žœžœ˜Kšœžœžœ˜K˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœžœ 4˜SK˜šœžœ˜KšœT™T—K˜Kšœžœžœ˜ Kšœžœžœ˜&Kšœžœžœ˜$Kšœžœžœ˜)Kšœ žœžœ˜K˜šœžœžœ˜%KšœU™U—šœžœžœ˜ KšœD™D—K˜šœ žœžœ˜Jšœ5™5—K˜š Ÿ œžœžœžœžœ˜,K™&—K˜š Ÿœžœžœžœžœ˜9K™&—K˜š Ÿœžœžœžœžœ˜:K™>—K˜š Ÿœžœžœžœ žœ˜9K™-—K˜š Ÿ œžœ žœžœžœ˜0Kš )™)Kš -™-—K˜š Ÿ œžœ žœžœžœ˜2Kš '™'Kš œŸ œ ™+—K˜šœ žœžœ˜KšœI™I—K˜šœžœžœ˜$Kšœ™—K˜šœžœžœ˜ K™KšΟs3™3—K˜šœžœ˜Kšœ>™>—K˜šœžœžœ˜,Kšœ W˜YK˜—Kšžœ˜K˜—…—²c