* INTERMEDIATE CODE GENERATION PROCEDURES COMMON TO BOTH
* JOHNSON AND RITCHIE FAMILIES OF SECOND PASSES
"??", "+", "-", "*", "/", "**", "-",
"OR", "AND", "EQV", "NEQV", "NOT",
"<", "==", ">", "<=", "!=", ">=",
" of ", " ofC ", " = ", " += ", " *= ", " CONV ", " << ", " % ",
" abs ", " min ", " max ", " addr ", " indirect ",
" bitor ", " bitand ", " bitxor ", " bitnot ", " >> ",
P2BAD
, P2PLUS
, P2MINUS
, P2STAR
, P2SLASH
, P2BAD
, P2NEG
,
P2OROR
, P2ANDAND
, P2EQ
, P2NE
, P2NOT
,
P2LT
, P2EQ
, P2GT
, P2LE
, P2NE
, P2GE
,
P2CALL
, P2CALL
, P2ASSIGN
, P2PLUSEQ
, P2STAREQ
, P2CONV
, P2LSHIFT
, P2MOD
,
P2COMOP
, P2QUEST
, P2COLON
,
P2BAD
, P2BAD
, P2BAD
, P2BAD
, P2BAD
,
P2BITOR
, P2BITAND
, P2BITXOR
, P2BITNOT
, P2RSHIFT
P2BAD
, P2INT
|P2PTR
, P2SHORT
, P2LONG
, P2REAL
, P2DREAL
,
P2BAD
, P2BAD
, P2LONG
, P2CHAR
, P2INT
, P2BAD
P2REAL
, P2DREAL
, P2LONG
, P2CHAR
, P2INT
, P2BAD
types2
[TYLOGICAL
] = types2
[tylogical
];
typesize
[TYLOGICAL
] = typesize
[tylogical
];
typealign
[TYLOGICAL
] = typealign
[tylogical
];
templist
= hookup(templist
, holdtemps
);
putx( fixexpr( mkexpr(OPASSIGN
, lp
, rp
) ));
putexpr( mkexpr(OPASSIGN
, lp
, rp
) );
/* put code for a *= b */
putx( fixexpr( mkexpr(OPSTAREQ
, cpexpr(a
), cpexpr(b
)) ));
struct Addrblock
*realpart(p
)
register struct Addrblock
*p
;
register struct Addrblock
*q
;
if( ISCOMPLEX(p
->vtype
) )
q
->vtype
+= (TYREAL
-TYCOMPLEX
);
struct Addrblock
*imagpart(p
)
register struct Addrblock
*p
;
register struct Addrblock
*q
;
struct Constblock
*mkrealcon();
if( ISCOMPLEX(p
->vtype
) )
q
->vtype
+= (TYREAL
-TYCOMPLEX
);
q
->memoffset
= mkexpr(OPPLUS
, q
->memoffset
, ICON(typesize
[q
->vtype
]));
q
= mkrealcon( ISINT(p
->vtype
) ? TYDREAL
: p
->vtype
, 0.0);
struct Addrblock
*putconst(p
)
register struct Constblock
*p
;
register struct Addrblock
*q
;
struct Literal
*litp
, *lastlit
;
fatali("putconst: bad tag %d", p
->tag
);
q
->vtype
= ( type
==TYADDR
? TYINT
: type
);
q
->vleng
= cpexpr(p
->vleng
);
/* check for value in literal pool, and update pool if necessary */
if(p
->vleng
->constblock
.const.ci
> XL
)
break; /* too long for literal table */
lastlit
= litpool
+ nliterals
;
for(litp
= litpool
; litp
<lastlit
; ++litp
)
if(type
== litp
->littype
) switch(litflavor
)
if(p
->vleng
->constblock
.const.ci
!= litp
->litval
.litcval
.litclen
)
if(! eqn( (int) p
->vleng
->constblock
.const.ci
, p
->const.ccp
,
litp
->litval
.litcval
.litcstr
) )
if(p
->const.cd
[0] == litp
->litval
.litdval
)
if(p
->const.ci
== litp
->litval
.litival
)
if(nliterals
< MAXLITERALS
)
litp
->litval
.litcval
.litclen
=
p
->vleng
->constblock
.const.ci
;
cpn( (int) litp
->litval
.litcval
.litclen
,
litp
->litval
.litcval
.litcstr
);
litp
->litval
.litdval
= p
->const.cd
[0];
litp
->litval
.litival
= p
->const.ci
;
preven(typealign
[ type
==TYCHAR
? TYLONG
: type
]);
prlabel(asmfile
, q
->memno
);
prconi(asmfile
, type
, p
->const.ci
);
prconr(asmfile
, type
, p
->const.cd
[i
]);
putstr(asmfile
, p
->const.ccp
, p
->vleng
->constblock
.const.ci
);
prcona(asmfile
, p
->const.ci
);
fatali("putconst: bad type %d", p
->vtype
);
* put out a character string constant. begin every one on
* a long integer boundary, and pad with nulls