C2CDRunTimeImpl.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Christian Jacobi, March 15, 1989 11:41:46 am PST
Christian Jacobi, November 8, 1989 5:42:57 pm PST
DIRECTORY
C2CBasics, C2CDefs, C2CEmit, C2CTarget, C2CDRunTime, IntCodeDefs, Rope;
C2CDRunTimeImpl: CEDAR PROGRAM
IMPORTS C2CBasics, C2CEmit, C2CTarget
EXPORTS C2CDRunTime =
BEGIN
ROPE: TYPE = Rope.ROPE;
Code: TYPE = C2CDefs.Code;
CodeOrRope: TYPE = REF;
ArithClassKind: TYPE = IntCodeDefs.ArithClassKind;
BadArithClass: PROC [] RETURNS [ROPE] = {
C2CBasics.CantHappen;
RETURN ["BAD-BAD"]
};
Call: PROC [c: Code] RETURNS [Code] = INLINE {
RETURN [C2CEmit.SetPrecedence[c, primaryPrecedence]]
};
MyCat: PROC [key, p1, p2, p3, p4, p5, p6: CodeOrRope¬NIL] RETURNS [Code] = {
--original in C2CRuntimeImpl
r: Code ¬ C2CEmit.Cat[p1];
IF p2#NIL THEN r ¬ C2CEmit.Cat[r, ", ", p2];
IF p3#NIL THEN r ¬ C2CEmit.Cat[r, ", ", p3];
IF p4#NIL THEN r ¬ C2CEmit.Cat[r, ", ", p4];
IF p5#NIL THEN r ¬ C2CEmit.Cat[r, ", ", p5];
IF p6#NIL THEN r ¬ C2CEmit.Cat[r, ", ", p6];
RETURN [C2CEmit.Cat[C2CTarget.runtimePrefix, key, C2CEmit.Parentize[r]]];
};
DFloatInt: PUBLIC PROC [resAddr, i: Code] RETURNS [Code] = {
RETURN [MyCat["DFloatInt", resAddr, i]];
};
DFloatCard: PUBLIC PROC [resAddr, c: Code] RETURNS [Code] = {
RETURN [MyCat["DFloatCard", resAddr, c]];
};
DFloatReal: PUBLIC PROC [resAddr, f: Code] RETURNS [Code] = {
RETURN [MyCat["DFloatReal", resAddr, f]];
};
DFloatDIntI: PUBLIC PROC [resAddr, iAddr: Code] RETURNS [Code] = {
RETURN [MyCat["DFloatDIntI", resAddr, iAddr]];
};
DCardDIntI: PUBLIC PROC [resAddr, iAddr: Code] RETURNS [Code] = {
RETURN [MyCat["DCardDIntI", resAddr, iAddr]];
};
DIntDCardI: PUBLIC PROC [resAddr, cAddr: Code] RETURNS [Code] = {
RETURN [MyCat["DIntDCardI", resAddr, cAddr]];
};
DFloatDCardI: PUBLIC PROC [resAddr, cAddr: Code] RETURNS [Code] = {
RETURN [MyCat["DFloatDCardI", resAddr, cAddr]];
};
DIntInt: PUBLIC PROC [resAddr, i: Code] RETURNS [Code] = {
RETURN [MyCat["DIntInt", resAddr, i]];
};
DIntCard: PUBLIC PROC [resAddr, c: Code] RETURNS [Code] = {
RETURN [MyCat["DIntCard", resAddr, c]];
};
DCardCard: PUBLIC PROC [resAddr, c: Code] RETURNS [Code] = {
RETURN [MyCat["DCardCard", resAddr, c]];
};
DCardInt: PUBLIC PROC [resAddr, c: Code] RETURNS [Code] = {
RETURN [MyCat["DCardInt", resAddr, c]];
};
IntDIntI: PUBLIC PROC [dAddr: Code] RETURNS [Code] = {
RETURN [Call[MyCat["IntDIntI", dAddr]]];
};
IntDCardI: PUBLIC PROC [dAddr: Code] RETURNS [Code] = {
RETURN [Call[MyCat["IntDCardI", dAddr]]];
};
CardDCardI: PUBLIC PROC [dAddr: Code] RETURNS [Code] = {
RETURN [Call[MyCat["CardDCardI", dAddr]]];
};
CardDIntI: PUBLIC PROC [dAddr: Code] RETURNS [Code] = {
RETURN [Call[MyCat["CardDIntI", dAddr]]];
};
FloatDIntI: PUBLIC PROC [dAddr: Code] RETURNS [Code] = {
RETURN [Call[MyCat["FloatDIntI", dAddr]]];
};
FloatDCardI: PUBLIC PROC [dAddr: Code] RETURNS [Code] = {
RETURN [Call[MyCat["FloatDCardI", dAddr]]];
};
FloatDRealI: PUBLIC PROC [dAddr: Code] RETURNS [Code] = {
RETURN [Call[MyCat["FloatDRealI", dAddr]]];
};
DNegI: PUBLIC PROC [kind: ArithClassKind, resAddr, dAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntNegI",
unsigned => "DCardNegI",
real => "DRealNegI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, dAddr]];
};
DAddI: PUBLIC PROC [kind: ArithClassKind, resAddr, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntAddI",
unsigned => "DCardAddI",
real => "DRealAddI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, aAddr, bAddr]];
};
DSubI: PUBLIC PROC [kind: ArithClassKind, resAddr, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntSubI",
unsigned => "DCardSubI",
real => "DRealSubI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, aAddr, bAddr]];
};
DMulI: PUBLIC PROC [kind: ArithClassKind, resAddr, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntMulI",
unsigned => "DCardMulI",
real => "DRealMulI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, aAddr, bAddr]];
};
DDivI: PUBLIC PROC [kind: ArithClassKind, resAddr, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntDivI",
unsigned => "DCardDivI",
real => "DRealDivI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, aAddr, bAddr]];
};
DModI: PUBLIC PROC [kind: ArithClassKind, resAddr, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntModI",
unsigned => "DCardModI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, aAddr, bAddr]];
};
DGtI: PUBLIC PROC [kind: ArithClassKind, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntGtI",
unsigned => "DCardGtI",
real => "DRealGtI",
ENDCASE => BadArithClass[];
RETURN [Call[MyCat[key, aAddr, bAddr]]];
};
DGeI: PUBLIC PROC [kind: ArithClassKind, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntGeI",
unsigned => "DCardGeI",
real => "DRealGeI",
ENDCASE => BadArithClass[];
RETURN [Call[MyCat[key, aAddr, bAddr]]];
};
DEqI: PUBLIC PROC [kind: ArithClassKind, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DEqI",
unsigned => "DEqI",
real => "DRealEqI",
ENDCASE => BadArithClass[];
RETURN [Call[MyCat[key, aAddr, bAddr]]];
};
DAbsI: PUBLIC PROC [kind: ArithClassKind, resAddr, dAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntAbsI",
real => "DRealAbsI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, dAddr]];
};
DMinI: PUBLIC PROC [kind: ArithClassKind, resAddr, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntMinI",
unsigned => "DCardMinI",
real => "DRealMinI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, aAddr, bAddr]];
};
DMaxI: PUBLIC PROC [kind: ArithClassKind, resAddr, aAddr, bAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntMinI",
unsigned => "DCardMinI",
real => "DRealMinI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, aAddr, bAddr]];
};
DPwrI: PUBLIC PROC [kind: ArithClassKind, resAddr, baseAddr, expAddr: Code] RETURNS [Code] = {
key: ROPE ¬ SELECT kind FROM
signed => "DIntPwrI",
unsigned => "DCardPwrI",
real => "DRealPwrI",
ENDCASE => BadArithClass[];
RETURN [MyCat[key, resAddr, baseAddr, expAddr]];
};
END.