DIRECTORY IntCodeDefs USING [Node], Rope USING [ROPE]; C2CDefs: CEDAR DEFINITIONS = BEGIN Precedence: TYPE = { notExpressionPrecedence, commaPrecedence, assignPrecedence, questionColonPrecedence, logicalOrPrecedence, logicalAndPrecedence, bitOrPrecedence, bitXorPrecedence, bitAndPrecedence, equalityPrecedence, orderPrecedence, shiftPrecedence, additionPrecedence, multiplicationPrecedence, unaryPrecedence, primaryPrecedence, identPrecedence, parenPrecedence, allwaysPutParanthesisPrecedence }; lowestCPrecedence: Precedence = commaPrecedence; Code: TYPE = REF CodeRep; CodeRep: TYPE; CodeOrRope: TYPE = REF; CodeCont: TYPE = RECORD [ sc: Code ¬ NIL, --statement code ec: Code ¬ NIL, --expression code xbc: Code ¬ NIL --bit address code; used only in getBitAdr mode; NIL means "0" ]; Mode: TYPE = REF ModeRep; ModeRep: TYPE = ModeRec; -- Should be opaque, but debugging opaque types is to painfull AddressMode: TYPE = { dummy, skip, --On proposal: Does not return a value --On generation: Need not return a value value, --not necessarily addressable, assignable (fits into single word) plain, --addressable, assignable if single arithmetic unit, no odd bit numbers assBitAddr, --for arbitrary bit position getBitAddr, --for arbitrary bit position getAddr, assAddr, assUnits, assBits, maskNShift, --bit position, no word boundary crossing lHSMaskNShift, --Used for lhs of assignment to packed array --Used for lhs of packed record bad }; AddressContainer: TYPE = RECORD [words, bits: Rope.ROPE ¬ NIL]; noAddress: AddressContainer = AddressContainer[NIL, NIL]; ModeRec: TYPE = <> RECORD [ am: AddressMode ¬ bad, ac: AddressContainer ¬ [NIL, NIL], baseSz: INT ¬ -1, containerSz: INT ¬ -1, unitSz: INT ¬ -1, --used for lHSMaskNShift only lHSMaskNShiftNode: IntCodeDefs.Node ¬ NIL, --used for lHSMaskNShift only lhs: BOOL, -- TRUE iff node is used as lhs expr: BOOL, -- TRUE iff node is used in expression mode illegal: BOOL ¬ FALSE --for detection of caching error ]; END. Έ C2CDefs.mesa Copyright Σ 1987, 1988, 1990, 1991, 1993 by Xerox Corporation. All rights reserved. Christian Jacobi, 1987 Christian Jacobi, January 25, 1993 7:09 pm PST --special, low --standard C precedences --special, high --On proposal: a dummy location --On generation: DO NOT USE --requested even without proposal, but only if size is known --Requestor is responsible for alignment correctness --On generation: Returned code has no value itself but assigns address into the reserved AdressContainer --returns word address in ec; bit address in xbc; NIL for 0 bit address. --On generation: Returned code is address of node --Requestor is responsible for alignment correctness --Requestor guarantees: -- either: argument could be gotten also using plain [to find alignment] -- or: argument appears on right side of mesa addr [alignment does not matter] --On generation: Returned code has no value itself but its address is assigned into a template --Requestor is responsible for alignment correctness --Requestor guarantees: -- either: argument could be gotten also using plain [to find alignment] -- or: argument appears on right side of mesa addr [alignment does not matter] --On generation: Returned code has no value itself but is assigned into a template; -- template must be addressable -- size [of template] assumed to be defined with ContainerSize -- size must fit pointeebits -- if smaller value assigned: right adjusted, 0 or sign extend depending on type -- currently only single word implemented --On generation: Returned code has no value itself but is assigned into a template; -- template is bit address described by AdressContainer -- size assumed to be defined with ContainerSize -- size must be exact; other bits won't be touched; left adjusted in templates --generation mostly defaults to value -- unit size is multiple of element size -- base must be addressable -- base must be addressed plain assumed full word indexing --template is rhs, must be evaluated only once; right adjusted left filled with zeros --may generate statement code --lHSMaskNShiftNode optionally available --never occurs... ModeRec used to be declared in private interface -- [FALSE iff in statement mode] Κύ•NewlineDelimiter –(cedarcode) style™šœ ™ Icodešœ ΟeœI™TK™K™.K˜—šΟk ˜ Kšœ žœ˜Kšœžœžœ˜K˜—KšΟnœžœž œ˜Kšž˜Iimp˜šœ žœ˜KšΟc™Kšœ˜Kš ™Kšœ₯˜₯Kš ™KšœA˜AKšœ˜—K˜Kšœ0˜0K˜Kšœžœžœ ˜Kšœ žœ˜Kšœ žœžœ˜K˜šœ žœžœ˜Kšœ žœ ˜ Kšœ žœ ˜!Kšœ žœ >˜NK˜—K˜Kšœžœžœ ˜Kšœ žœ  >˜WK˜šœ žœ˜šœ˜Kšœ™Kšœ™—šœ˜Kš &˜&Kš (˜(—šœ˜Kš A˜AK™<—šœ˜Kš G˜GKš œ5™7—šœ ˜ Kš ˜Kšœi™i—šœ ˜ Kš ˜Kš œF ™I—šœ ˜ Kš 3™3Kš 7™7Kš ™Kš H™HKšœ L™N—šœ ˜ Kšœa™aKšœ7™7Kš ™Kš H™HKšœ L™N—šœ ˜ Kš T™TKš ™Kš ?™?Kš ™Kš P™PKšœ)™)—šœ ˜ KšœT™TKšœ7™7Kšœ !™0Kš œK™N—šœ ˜ Kš )˜)Kš œ#™%—šœ˜Kš ,˜,Kš œ&™(Kš œ™Kš ˜Kš œ8™:Kš œS™UKš œ™Kš œ'™)—˜Kšœ™—K˜—K˜Kš œžœžœžœžœ˜?Kšœ/žœžœ˜9K˜K™0šœ žœžœ˜$K˜Kšœžœžœ˜"Kšœžœ˜Kšœ žœ˜Kšœžœ ˜/Kšœ&žœ ˜HKšœžœ ˜*Kšœžœ +˜7Kšœ  ™!Kšœ žœžœ  ˜6K˜K˜—Kšžœ˜K˜—…—؍