Doxygen Source Code Documentation
put.c File Reference
#include "defs.h"#include "names.h"#include "pccdefs.h"#include "p1defs.h"Go to the source code of this file.
Defines | |
| #define | LIT_CHAR 1 |
| #define | LIT_FLOAT 2 |
| #define | LIT_INT 3 |
Functions | |
| void | putexpr (expptr p) |
| expptr | putassign (expptr lp, expptr rp) |
| void | puteq (expptr lp, expptr rp) |
| expptr | putsteq (Addrp a, Addrp b) |
| Addrp | mkfield (register Addrp res, char *f, int ty) |
| Addrp | realpart (register Addrp p) |
| expptr | imagpart (register Addrp p) |
| int | ncat (register expptr p) |
| ftnint | lencat (register expptr p) |
| Addrp | putconst (register Constp p) |
Variables | |
| int | ops2 [] |
Define Documentation
|
|
Definition at line 36 of file put.c. Referenced by putconst(). |
|
|
Definition at line 37 of file put.c. Referenced by putconst(). |
|
|
Definition at line 38 of file put.c. Referenced by putconst(). |
Function Documentation
|
|
Definition at line 189 of file put.c. References cds(), CNULL, cpexpr(), dtos(), ISCOMPLEX, ISINT, mkfield(), mkrealcon(), p, q, TADDR, and UNAM_CONST. Referenced by putcx1(), putcxcmp(), and putcxeq().
00191 {
00192 register Addrp q;
00193
00194 if( ISCOMPLEX(p->vtype) )
00195 {
00196 if (p->tag == TADDR && p->uname_tag == UNAM_CONST)
00197 return mkrealcon (p -> vtype + TYREAL - TYCOMPLEX,
00198 p->user.kludge.vstg1 ? p->user.Const.cds[1]
00199 : cds(dtos(p->user.Const.cd[1]),CNULL));
00200 q = (Addrp) cpexpr((expptr) p);
00201 q = mkfield (q, "i", p -> vtype + TYREAL - TYCOMPLEX);
00202 return( (expptr) q );
00203 }
00204 else
00205
00206 /* Cast an integer type onto a Double Real type */
00207
00208 return( mkrealcon( ISINT(p->vtype) ? TYDREAL : p->vtype , "0"));
00209 }
|
|
|
Definition at line 241 of file put.c. References err, ISICON, OPCONCAT, p, TADDR, and TEXPR. Referenced by doiolist(), and putch1().
00243 {
00244 if(p->tag==TEXPR && p->exprblock.opcode==OPCONCAT)
00245 return( lencat(p->exprblock.leftp) + lencat(p->exprblock.rightp) );
00246 else if( p->headblock.vleng!=NULL && ISICON(p->headblock.vleng) )
00247 return(p->headblock.vleng->constblock.Const.ci);
00248 else if(p->tag==TADDR && p->addrblock.varleng!=0)
00249 return(p->addrblock.varleng);
00250 else
00251 {
00252 err("impossible element in concatenation");
00253 return(0);
00254 }
00255 }
|
|
||||||||||||||||
|
Definition at line 148 of file put.c. Referenced by imagpart(), and realpart().
00150 {
00151 res -> vtype = ty;
00152 res -> Field = f;
00153 return res;
00154 } /* mkfield */
|
|
|
Definition at line 222 of file put.c. References OPCONCAT, p, and TEXPR. Referenced by putcat().
|
|
||||||||||||
|
Definition at line 99 of file put.c. References fixexpr(), mkexpr(), OPASSIGN, and putx(). Referenced by intdouble(), krput(), putcall(), putct1(), putcx1(), putcxeq(), putmnmx(), putpower(), and suboffset().
|
|
|
Definition at line 271 of file put.c. References ALLOC, BAD_MEMNO, badtag(), badtype(), Literal::cds, cds(), Addrblock::Const, copys(), cpexpr(), dtos(), frexpr(), gmem(), ICON, LIT_CHAR, LIT_FLOAT, LIT_INT, Literal::litnum, Literal::littype, Literal::litval, many(), memcmp(), Addrblock::memno, Addrblock::memoffset, newlabel(), p, q, STGCONST, strp, TADDR, Addrblock::tag, TCONST, TYQUAD, UNAM_CONST, Addrblock::user, Addrblock::vleng, Addrblock::vstg, and Addrblock::vtype. Referenced by doiolist(), fixargs(), fixexpr(), fixtype(), mkaddr(), mkpower(), putcall(), putcat(), putch1(), putcx1(), putio(), putop(), and putx().
00273 {
00274 register Addrp q;
00275 struct Literal *litp, *lastlit;
00276 int k, len, type;
00277 int litflavor;
00278 double cd[2];
00279 ftnint nblanks;
00280 char *strp;
00281 char cdsbuf0[64], cdsbuf1[64], *ds[2];
00282
00283 if (p->tag != TCONST)
00284 badtag("putconst", p->tag);
00285
00286 q = ALLOC(Addrblock);
00287 q->tag = TADDR;
00288 type = p->vtype;
00289 q->vtype = ( type==TYADDR ? tyint : type );
00290 q->vleng = (expptr) cpexpr(p->vleng);
00291 q->vstg = STGCONST;
00292
00293 /* Create the new label for the constant. This is wasteful of labels
00294 because when the constant value already exists in the literal pool,
00295 this label gets thrown away and is never reclaimed. It might be
00296 cleaner to move this down past the first switch() statement below */
00297
00298 q->memno = newlabel();
00299 q->memoffset = ICON(0);
00300 q -> uname_tag = UNAM_CONST;
00301
00302 /* Copy the constant info into the Addrblock; do this by copying the
00303 largest storage elts */
00304
00305 q -> user.Const = p -> Const;
00306 q->user.kludge.vstg1 = p->vstg; /* distinguish string from binary fp */
00307
00308 /* check for value in literal pool, and update pool if necessary */
00309
00310 k = 1;
00311 switch(type)
00312 {
00313 case TYCHAR:
00314 if (halign) {
00315 strp = p->Const.ccp;
00316 nblanks = p->Const.ccp1.blanks;
00317 len = p->vleng->constblock.Const.ci;
00318 litflavor = LIT_CHAR;
00319 goto loop;
00320 }
00321 else
00322 q->memno = BAD_MEMNO;
00323 break;
00324 case TYCOMPLEX:
00325 case TYDCOMPLEX:
00326 k = 2;
00327 if (p->vstg)
00328 cd[1] = atof(ds[1] = p->Const.cds[1]);
00329 else
00330 ds[1] = cds(dtos(cd[1] = p->Const.cd[1]), cdsbuf1);
00331 case TYREAL:
00332 case TYDREAL:
00333 litflavor = LIT_FLOAT;
00334 if (p->vstg)
00335 cd[0] = atof(ds[0] = p->Const.cds[0]);
00336 else
00337 ds[0] = cds(dtos(cd[0] = p->Const.cd[0]), cdsbuf0);
00338 goto loop;
00339
00340 case TYLOGICAL1:
00341 case TYLOGICAL2:
00342 case TYLOGICAL:
00343 case TYLONG:
00344 case TYSHORT:
00345 case TYINT1:
00346 #ifdef TYQUAD
00347 case TYQUAD:
00348 #endif
00349 lit_int_flavor:
00350 litflavor = LIT_INT;
00351
00352 /* Scan the literal pool for this constant value. If this same constant
00353 has been assigned before, use the same label. Note that this routine
00354 does NOT consider two differently-typed constants with the same bit
00355 pattern to be the same constant */
00356
00357 loop:
00358 lastlit = litpool + nliterals;
00359 for(litp = litpool ; litp<lastlit ; ++litp)
00360
00361 /* Remove this type checking to ensure that all bit patterns are reused */
00362
00363 if(type == litp->littype) switch(litflavor)
00364 {
00365 case LIT_CHAR:
00366 if (len == (int)litp->litval.litival2[0]
00367 && nblanks == litp->litval.litival2[1]
00368 && !memcmp(strp, litp->cds[0], len)) {
00369 q->memno = litp->litnum;
00370 frexpr((expptr)p);
00371 q->user.Const.ccp1.ccp0 = litp->cds[0];
00372 return(q);
00373 }
00374 break;
00375 case LIT_FLOAT:
00376 if(cd[0] == litp->litval.litdval[0]
00377 && !strcmp(ds[0], litp->cds[0])
00378 && (k == 1 ||
00379 cd[1] == litp->litval.litdval[1]
00380 && !strcmp(ds[1], litp->cds[1]))) {
00381 ret:
00382 q->memno = litp->litnum;
00383 frexpr((expptr)p);
00384 return(q);
00385 }
00386 break;
00387
00388 case LIT_INT:
00389 if(p->Const.ci == litp->litval.litival)
00390 goto ret;
00391 break;
00392 }
00393
00394 /* If there's room in the literal pool, add this new value to the pool */
00395
00396 if(nliterals < maxliterals)
00397 {
00398 ++nliterals;
00399
00400 /* litp now points to the next free elt */
00401
00402 litp->littype = type;
00403 litp->litnum = q->memno;
00404 switch(litflavor)
00405 {
00406 case LIT_CHAR:
00407 litp->litval.litival2[0] = len;
00408 litp->litval.litival2[1] = nblanks;
00409 q->user.Const.ccp = litp->cds[0] =
00410 memcpy(gmem(len,0), strp, len);
00411 break;
00412
00413 case LIT_FLOAT:
00414 litp->litval.litdval[0] = cd[0];
00415 litp->cds[0] = copys(ds[0]);
00416 if (k == 2) {
00417 litp->litval.litdval[1] = cd[1];
00418 litp->cds[1] = copys(ds[1]);
00419 }
00420 break;
00421
00422 case LIT_INT:
00423 litp->litval.litival = p->Const.ci;
00424 break;
00425 } /* switch (litflavor) */
00426 }
00427 else
00428 many("literal constants", 'L', maxliterals);
00429
00430 break;
00431 case TYADDR:
00432 break;
00433 default:
00434 badtype ("putconst", p -> vtype);
00435 break;
00436 } /* switch */
00437
00438 if (type != TYCHAR || halign)
00439 frexpr((expptr)p);
00440 return( q );
00441 }
|
|
||||||||||||
|
Definition at line 114 of file put.c. References mkexpr(), OPASSIGN, and putexpr(). Referenced by cast_args(), doiolist(), enddo(), exdo(), and exequals().
|
|
|
Definition at line 80 of file put.c. References fixtype(), p, p1_expr(), and putx(). Referenced by excall(), exstop(), ioset(), puteq(), putiocall(), and stfcall().
|
|
||||||||||||
|
Definition at line 131 of file put.c. References a, cpexpr(), fixexpr(), mkexpr(), OPSTAREQ, and putx(). Referenced by putpower().
|
|
|
Definition at line 162 of file put.c. References cds(), CNULL, cpexpr(), dtos(), ISCOMPLEX, mkfield(), mkrealcon(), p, q, TADDR, and UNAM_CONST. Referenced by putcx1(), putcxcmp(), putcxeq(), putop(), and putx().
00164 {
00165 register Addrp q;
00166
00167 if (p->tag == TADDR
00168 && p->uname_tag == UNAM_CONST
00169 && ISCOMPLEX (p->vtype))
00170 return (Addrp)mkrealcon (p -> vtype + TYREAL - TYCOMPLEX,
00171 p->user.kludge.vstg1 ? p->user.Const.cds[0]
00172 : cds(dtos(p->user.Const.cd[0]),CNULL));
00173
00174 q = (Addrp) cpexpr((expptr) p);
00175 if( ISCOMPLEX(p->vtype) )
00176 q = mkfield (q, "r", p -> vtype + TYREAL - TYCOMPLEX);
00177
00178 return(q);
00179 }
|
Variable Documentation
|
|
Initial value:
{
P2BAD, P2PLUS, P2MINUS, P2STAR, P2SLASH, P2BAD, P2NEG,
P2OROR, P2ANDAND, P2EQ, P2NE, P2NOT,
P2BAD,
P2LT, P2EQ, P2GT, P2LE, P2NE, P2GE,
P2CALL, P2CALL, P2ASSIGN, P2PLUSEQ, P2STAREQ, P2CONV, P2LSHIFT, P2MOD,
P2COMOP, P2QUEST, P2COLON,
1, P2BAD, P2BAD, P2BAD, P2BAD,
P2BITOR, P2BITAND, P2BITXOR, P2BITNOT, P2RSHIFT,
P2BAD, P2BAD, P2BAD, P2BAD, P2BAD, P2BAD, P2BAD, P2BAD, P2BAD,
P2BAD, P2BAD, P2BAD, P2BAD,
1,1,1,1,1,
1,1,1,1,
1,1,1,1,1
}Definition at line 57 of file put.c. Referenced by putop(). |