* Copyright (c) 1980 The Regents of the University of California.
* This module is believed to contain source code proprietary to AT&T.
* Use and redistribution is subject to the Berkeley Software License
* Agreement and your Software Agreement with AT&T (Western Electric).
static char sccsid
[] = "@(#)put.c 5.3 (Berkeley) 4/12/91";
* Intermediate code generation procedures common to both
* Johnson (Portable) and Ritchie families of second passes
* University of Utah CS Dept modification history:
* Revision 3.2 85/05/04 15:41:24 mckusick
* Fix alignment problem -- change code to match comment...
* Revision 3.2 85/04/29 21:36:07 donn
* Fix alignment problem -- change code to match comment...
* Revision 3.1 85/02/27 19:12:04 donn
* Changed to use pcc.h instead of pccdefs.h.
* Revision 2.1 84/07/19 12:04:21 donn
* Changed comment headers for UofU.
* Revision 1.2 84/04/02 14:40:21 donn
* Added fixes from Conrad Huang at UCSF for calculating the length of a
* concatenation of strings correctly.
"??", "+", "-", "*", "/", "**", "-",
"OR", "AND", "EQV", "NEQV", "NOT",
"<", "==", ">", "<=", "!=", ">=",
" of ", " ofC ", " = ", " += ", " *= ", " CONV ", " << ", " % ",
" abs ", " min ", " max ", " addr ", " indirect ",
" bitor ", " bitand ", " bitxor ", " bitnot ", " >> ", " () "
PCC_ERROR
, PCC_PLUS
, PCC_MINUS
, PCC_MUL
, PCC_DIV
, PCC_ERROR
, PCC_UMINUS
,
PCC_OROR
, PCC_ANDAND
, PCC_EQ
, PCC_NE
, PCC_NOT
,
PCC_LT
, PCC_EQ
, PCC_GT
, PCC_LE
, PCC_NE
, PCC_GE
,
PCC_CALL
, PCC_CALL
, PCC_ASSIGN
, PCC_PLUSEQ
, PCC_MULEQ
, PCC_SCONV
, PCC_LS
, PCC_MOD
,
PCC_COMOP
, PCC_QUEST
, PCC_COLON
,
PCC_ERROR
, PCC_ERROR
, PCC_ERROR
, PCC_ERROR
, PCC_DEREF
,
PCC_OR
, PCC_AND
, PCC_ER
, PCC_COMPL
, PCC_RS
, PCC_ERROR
PCC_ERROR
, PCCT_INT
|PCCTM_PTR
, PCCT_SHORT
, PCCT_LONG
, PCCT_FLOAT
, PCCT_DOUBLE
,
PCC_ERROR
, PCC_ERROR
, PCCT_LONG
, PCCT_CHAR
, PCCT_INT
, PCC_ERROR
PCCT_FLOAT
, PCCT_DOUBLE
, PCCT_LONG
, PCCT_CHAR
, PCCT_INT
, PCC_ERROR
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
)) ));
if( ISCOMPLEX(p
->vtype
) )
q
->vtype
+= (TYREAL
-TYCOMPLEX
);
if (ISCOMPLEX(p
->constblock
.vtype
))
return(mkrealcon(p
->constblock
.vtype
== TYCOMPLEX
?
p
->constblock
.constant
.cd
[1]));
else if (p
->constblock
.vtype
== TYDREAL
)
return(mkrealcon(TYDREAL
, 0.0));
return(mkrealcon(TYREAL
, 0.0));
else if (p
->tag
== TADDR
)
if( ISCOMPLEX(p
->addrblock
.vtype
) )
q
->vtype
+= (TYREAL
-TYCOMPLEX
);
q
->memoffset
= mkexpr(OPPLUS
, q
->memoffset
,
ICON(typesize
[q
->vtype
]));
return( mkrealcon( ISINT(p
->addrblock
.vtype
) ?
TYDREAL
: p
->addrblock
.vtype
, 0.0));
badtag("imagpart", p
->tag
);
if(p
->tag
==TEXPR
&& p
->exprblock
.opcode
==OPCONCAT
)
return( ncat(p
->exprblock
.leftp
) + ncat(p
->exprblock
.rightp
) );
if(p
->tag
==TEXPR
&& p
->exprblock
.opcode
==OPCONCAT
)
return( lencat(p
->exprblock
.leftp
) + lencat(p
->exprblock
.rightp
) );
else if( p
->headblock
.vleng
!=NULL
&& ISICON(p
->headblock
.vleng
) )
return(p
->headblock
.vleng
->constblock
.constant
.ci
);
else if(p
->tag
==TADDR
&& p
->addrblock
.varleng
!=0)
return(p
->addrblock
.varleng
);
else if(p
->tag
==TTEMP
&& p
->tempblock
.varleng
!=0)
return(p
->tempblock
.varleng
);
err("impossible element in concatenation");
struct Literal
*litp
, *lastlit
;
badtag("putconst", p
->tag
);
q
->vtype
= ( type
==TYADDR
? TYINT
: type
);
q
->vleng
= (expptr
) cpexpr(p
->vleng
);
/* check for value in literal pool, and update pool if necessary */
if(p
->vleng
->constblock
.constant
.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
.constant
.ci
!= litp
->litval
.litcval
.litclen
)
if(! eqn( (int) p
->vleng
->constblock
.constant
.ci
, p
->constant
.ccp
,
litp
->litval
.litcval
.litcstr
) )
if(p
->constant
.cd
[0] == litp
->litval
.litdval
)
if(p
->constant
.ci
== litp
->litval
.litival
)
if(nliterals
< MAXLITERALS
)
litp
->litval
.litcval
.litclen
=
p
->vleng
->constblock
.constant
.ci
;
cpn( (int) litp
->litval
.litcval
.litclen
,
litp
->litval
.litcval
.litcstr
);
litp
->litval
.litdval
= p
->constant
.cd
[0];
litp
->litval
.litival
= p
->constant
.ci
;
preven(typealign
[ type
==TYCHAR
? TYLONG
: type
]);
prlabel(asmfile
, q
->memno
);
prconi(asmfile
, type
, p
->constant
.ci
);
prconr(asmfile
, type
, p
->constant
.cd
[i
]);
putstr(asmfile
, p
->constant
.ccp
,
(int) (p
->vleng
->constblock
.constant
.ci
) );
prcona(asmfile
, p
->constant
.ci
);
badtype("putconst", p
->vtype
);
* put out a character string constant. begin every one on
* a long integer boundary, and pad with nulls