Quick Search:

Mode

Context

Displaying the whole file. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.167
 
1.168
 
MAIN:ragge:20121028135928
 
local.c
_>11 /*      $Id$    */
 22 /*
 33  * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
 44  * All rights reserved.
 55  *
 66  * Redistribution and use in source and binary forms, with or without
 77  * modification, are permitted provided that the following conditions
 88  * are met:
 99  * 1. Redistributions of source code must retain the above copyright
 1010  *    notice, this list of conditions and the following disclaimer.
 1111  * 2. Redistributions in binary form must reproduce the above copyright
 1212  *    notice, this list of conditions and the following disclaimer in the
 1313  *    documentation and/or other materials provided with the distribution.
 1414  *
 1515  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 1616  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 1717  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 1818  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 1919  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 2020  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 2121  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 2222  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 2323  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 2424  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 2525  */
 2626 
 2727 
 2828 #include "pass1.h"
 2929 
 3030 /*      this file contains code which is dependent on the target machine */
 3131 
 3232 #ifdef notyet
 3333 /*
 3434  * Check if a constant is too large for a type.
 3535  */
 3636 static int
 3737 toolarge(TWORD t, CONSZ con)
 3838 {
 3939         U_CONSZ ucon = con;
 4040 
 4141         switch (t) {
 4242         case ULONGLONG:
 4343         case LONGLONG:
 4444                 break; /* cannot be too large */
 4545 #define SCHK(i) case i: if (con > MAX_##i || con < MIN_##i) return 1; break
 4646 #define UCHK(i) case i: if (ucon > MAX_##i) return 1; break
 4747         SCHK(INT);
 4848         SCHK(SHORT);
 4949         case BOOL:
 5050         SCHK(CHAR);
 5151         UCHK(UNSIGNED);
 5252         UCHK(USHORT);
 5353         UCHK(UCHAR);
 5454         default:
 5555                 cerror("toolarge");
 5656         }
 5757         return 0;
 5858 }
 5959 #endif
 6060 
 6161 #if defined(MACHOABI)
 6262 
 6363 /*
 6464  *  Keep track of PIC stubs.
 6565  */
 6666 
 6767 void
 6868 addstub(struct stub *list, char *name)
 6969 {
 7070         struct stub *s;
 7171 
 7272         DLIST_FOREACH(s, list, link) {
 7373                 if (strcmp(s->name, name) == 0)
 7474                         return;
 7575         }
 7676 
 7777         s = permalloc(sizeof(struct stub));
 7878         s->name = newstring(name, strlen(name));
 7979         DLIST_INSERT_BEFORE(list, s, link);
 8080 }
 8181 
 8282 #endif
 8383 
 8484 #define IALLOC(sz)      (isinlining ? permalloc(sz) : tmpalloc(sz))
 8585 
 8686 /*
 8787  * Make a symtab entry for PIC use.
 8888  */
 8989 static struct symtab *
 9090 picsymtab(char *p, char *s, char *s2)
 9191 {
 9292         struct symtab *sp = IALLOC(sizeof(struct symtab));
 9393         size_t len = strlen(p) + strlen(s) + strlen(s2) + 1;
 9494         
 9595         sp->sname = sp->soname = IALLOC(len);
 9696         strlcpy(sp->soname, p, len);
 9797         strlcat(sp->soname, s, len);
 9898         strlcat(sp->soname, s2, len);
 9999         sp->sap = NULL;
 100100         sp->sclass = EXTERN;
 101101         sp->sflags = sp->slevel = 0;
 102102         sp->stype = 0xdeadbeef;
 103103         return sp;
 104104 }
 105105 
 106106 #ifdef os_win32
 107107 static NODE *
 108108 import(NODE *p)
 109109 {
 110110         NODE *q;
 111111         char *name;
 112112         struct symtab *sp;
 113113 
 114114         if ((name = p->n_sp->soname) == NULL)
 115115                 name = exname(p->n_sp->sname);
 116116 
 117117         sp = picsymtab("__imp_", name, "");
 118118         q = xbcon(0, sp, PTR+VOID);
 119119         q = block(UMUL, q, 0, PTR|VOID, 0, 0);
 120120         q = block(UMUL, q, 0, p->n_type, p->n_df, p->n_ap);
 121121         q->n_sp = p->n_sp; /* for init */
 122122         nfree(p);
 123123 
 124124         return q;
 125125 }
 126126 #endif
 127127 
 128128 int gotnr; /* tempnum for GOT register */
 129129 int argstacksize;
 130130 
 131131 /*
 132132  * Create a reference for an extern variable.
 133133  */
 134134 static NODE *
 135135 picext(NODE *p)
 136136 {
 137137 
 138138 #if defined(ELFABI)
 139139 
<> 140+        struct attr *ga;
140141         NODE *q, *r;
 141142         struct symtab *sp;
 142143         char *name;
 143144 
<> 145+        if ((ga = attr_find(p->n_sp->sap, GCC_ATYP_VISIBILITY)) &&
  146+            strcmp(ga->sarg(0), "hidden") == 0)
  147+                return p; /* no GOT reference */
  148+
<_144149         q = tempnode(gotnr, PTR|VOID, 0, 0);
 145150         if ((name = p->n_sp->soname) == NULL)
 146151                 name = p->n_sp->sname;
 147152         sp = picsymtab("", name, "@GOT");
 148153 #ifdef GCC_COMPAT
 149154         if (attr_find(p->n_sp->sap, GCC_ATYP_STDCALL) != NULL)
 150155                 p->n_sp->sflags |= SSTDCALL;
 151156 #endif
 152157         sp->sflags = p->n_sp->sflags & SSTDCALL;
 153158         r = xbcon(0, sp, INT);
 154159         q = buildtree(PLUS, q, r);
 155160         q = block(UMUL, q, 0, PTR|VOID, 0, 0);
 156161         q = block(UMUL, q, 0, p->n_type, p->n_df, p->n_ap);
 157162         q->n_sp = p->n_sp; /* for init */
 158163         nfree(p);
 159164         return q;
 160165 
 161166 #elif defined(MACHOABI)
 162167 
 163168         NODE *q, *r;
 164169         struct symtab *sp;
 165170         char buf2[256], *name, *pspn;
 166171 
 167172         if ((name = cftnsp->soname) == NULL)
 168173                 name = cftnsp->sname;
 169174         if ((pspn = p->n_sp->soname) == NULL)
 170175                 pspn = exname(p->n_sp->sname);
 171176         if (p->n_sp->sclass == EXTDEF) {
 172177                 snprintf(buf2, 256, "-L%s$pb", name);
 173178                 sp = picsymtab("", pspn, buf2);
 174179         } else {
 175180                 snprintf(buf2, 256, "$non_lazy_ptr-L%s$pb", name);
 176181                 sp = picsymtab("L", pspn, buf2);
 177182                 addstub(&nlplist, pspn);
 178183         }
 179184 
 180185         sp->stype = p->n_sp->stype;
 181186 
 182187         q = tempnode(gotnr, PTR+VOID, 0, 0);
 183188         r = xbcon(0, sp, INT);
 184189         q = buildtree(PLUS, q, r);
 185190 
 186191         if (p->n_sp->sclass != EXTDEF)
 187192                 q = block(UMUL, q, 0, PTR+VOID, 0, 0);
 188193         q = block(UMUL, q, 0, p->n_type, p->n_df, p->n_ap);
 189194         q->n_sp = p->n_sp; /* for init */
 190195         nfree(p);
 191196         return q;
 192197 
 193198 #else /* defined(PECOFFABI) || defined(AOUTABI) */
 194199 
 195200         return p;
 196201 
 197202 #endif
 198203 
 199204 }
 200205 
 201206 /*
 202207  * Create a reference for a static variable.
 203208  */
 204209 static NODE *
 205210 picstatic(NODE *p)
 206211 {
 207212 
 208213 #if defined(ELFABI)
 209214 
 210215         NODE *q, *r;
 211216         struct symtab *sp;
 212217 
 213218         q = tempnode(gotnr, PTR|VOID, 0, 0);
 214219         if (p->n_sp->slevel > 0) {
 215220                 char buf[32];
 216221                 snprintf(buf, 32, LABFMT, (int)p->n_sp->soffset);
 217222                 sp = picsymtab("", buf, "@GOTOFF");
 218223         } else {
 219224                 char *name;
 220225                 if ((name = p->n_sp->soname) == NULL)
 221226                         name = p->n_sp->sname;
 222227                 sp = picsymtab("", name, "@GOTOFF");
 223228         }
 224229         
 225230         sp->sclass = STATIC;
 226231         sp->stype = p->n_sp->stype;
 227232         r = xbcon(0, sp, INT);
 228233         q = buildtree(PLUS, q, r);
 229234         q = block(UMUL, q, 0, p->n_type, p->n_df, p->n_ap);
 230235         q->n_sp = p->n_sp; /* for init */
 231236         nfree(p);
 232237         return q;
 233238 
 234239 #elif defined(MACHOABI)
 235240 
 236241         NODE *q, *r;
 237242         struct symtab *sp;
 238243         char buf2[256];
 239244 
 240245         snprintf(buf2, 256, "-L%s$pb",
 241246             cftnsp->soname ? cftnsp->soname : cftnsp->sname);
 242247 
 243248         if (p->n_sp->slevel > 0) {
 244249                 char buf1[32];
 245250                 snprintf(buf1, 32, LABFMT, (int)p->n_sp->soffset);
 246251                 sp = picsymtab("", buf1, buf2);
 247252         } else  {
 248253                 char *name;
 249254                 if ((name = p->n_sp->soname) == NULL)
 250255                         name = p->n_sp->sname;
 251256                 sp = picsymtab("", exname(name), buf2);
 252257         }
 253258         sp->sclass = STATIC;
 254259         sp->stype = p->n_sp->stype;
 255260         q = tempnode(gotnr, PTR+VOID, 0, 0);
 256261         r = xbcon(0, sp, INT);
 257262         q = buildtree(PLUS, q, r);
 258263         q = block(UMUL, q, 0, p->n_type, p->n_df, p->n_ap);
 259264         q->n_sp = p->n_sp;
 260265         nfree(p);
 261266         return q;
 262267 
 263268 #else /* defined(PECOFFABI) || defined(AOUTABI) */
 264269 
 265270         return p;
 266271 
 267272 #endif
 268273 
 269274 }
 270275 
 271276 #ifdef TLS
 272277 /*
 273278  * Create a reference for a TLS variable.
 274279  */
 275280 static NODE *
 276281 tlspic(NODE *p)
 277282 {
 278283         NODE *q, *r;
 279284         struct symtab *sp, *sp2;
 280285         char *name;
 281286 
 282287         /*
 283288          * creates:
 284289          *   leal var@TLSGD(%ebx),%eax
 285290          *   call ___tls_get_addr@PLT
 286291          */
 287292 
 288293         /* calc address of var@TLSGD */
 289294         q = tempnode(gotnr, PTR|VOID, 0, 0);
 290295         if ((name = p->n_sp->soname) == NULL)
 291296                 name = p->n_sp->sname;
 292297         sp = picsymtab("", name, "@TLSGD");
 293298         r = xbcon(0, sp, INT);
 294299         q = buildtree(PLUS, q, r);
 295300 
 296301         /* assign to %eax */
 297302         r = block(REG, NIL, NIL, PTR|VOID, 0, 0);
 298303         r->n_rval = EAX;
 299304         q = buildtree(ASSIGN, r, q);
 300305 
 301306         /* call ___tls_get_addr */
 302307         sp2 = lookup("___tls_get_addr@PLT", 0);
 303308         sp2->stype = EXTERN|INT|FTN;
 304309         r = nametree(sp2);
 305310         r = buildtree(ADDROF, r, NIL);
 306311         r = block(UCALL, r, NIL, INT, 0, 0);
 307312 
 308313         /* fusion both parts together */
 309314         q = buildtree(COMOP, q, r);
 310315         q = block(UMUL, q, 0, p->n_type, p->n_df, p->n_ap);
 311316         q->n_sp = p->n_sp; /* for init */
 312317 
 313318         nfree(p);
 314319         return q;
 315320 }
 316321 
 317322 static NODE *
 318323 tlsnonpic(NODE *p)
 319324 {
 320325         NODE *q, *r;
 321326         struct symtab *sp, *sp2;
 322327         int ext = p->n_sp->sclass;
 323328         char *name;
 324329 
 325330         if ((name = p->n_sp->soname) == NULL)
 326331                 name = p->n_sp->sname;
 327332         sp = picsymtab("", name,
 328333             ext == EXTERN ? "@INDNTPOFF" : "@NTPOFF");
 329334         q = xbcon(0, sp, INT);
 330335         if (ext == EXTERN)
 331336                 q = block(UMUL, q, NIL, PTR|VOID, 0, 0);
 332337 
 333338         sp2 = lookup("%gs:0", 0);
 334339         sp2->stype = EXTERN|INT;
 335340         r = nametree(sp2);
 336341 
 337342         q = buildtree(PLUS, q, r);
 338343         q = block(UMUL, q, 0, p->n_type, p->n_df, p->n_ap);
 339344         q->n_sp = p->n_sp; /* for init */
 340345 
 341346         nfree(p);
 342347         return q;
 343348 }
 344349 
 345350 static NODE *
 346351 tlsref(NODE *p)
 347352 {
 348353         if (kflag)
 349354                 return (tlspic(p));
 350355         else
 351356                 return (tlsnonpic(p));
 352357 }
 353358 #endif
 354359 
 355360 /* clocal() is called to do local transformations on
 356361  * an expression tree preparitory to its being
 357362  * written out in intermediate code.
 358363  *
 359364  * the major essential job is rewriting the
 360365  * automatic variables and arguments in terms of
 361366  * REG and OREG nodes
 362367  * conversion ops which are not necessary are also clobbered here
 363368  * in addition, any special features (such as rewriting
 364369  * exclusive or) are easily handled here as well
 365370  */
 366371 NODE *
 367372 clocal(NODE *p)
 368373 {
 369374 
 370375         register struct symtab *q;
 371376         register NODE *r, *l;
 372377 #if defined(os_openbsd)
 373378         register NODE *s, *n;
 374379 #endif
 375380         register int o;
 376381         register int m;
 377382 
 378383 #ifdef PCC_DEBUG
 379384         if (xdebug) {
 380385                 printf("clocal: %p\n", p);
 381386                 fwalk(p, eprint, 0);
 382387         }
 383388 #endif
 384389         switch( o = p->n_op ){
 385390 
 386391         case NAME:
 387392                 if ((q = p->n_sp) == NULL)
 388393                         return p; /* Nothing to care about */
 389394 
 390395                 switch (q->sclass) {
 391396 
 392397                 case PARAM:
 393398                 case AUTO:
 394399                         /* fake up a structure reference */
 395400                         r = block(REG, NIL, NIL, PTR+STRTY, 0, 0);
 396401                         r->n_lval = 0;
 397402                         r->n_rval = FPREG;
 398403                         p = stref(block(STREF, r, p, 0, 0, 0));
 399404                         break;
 400405 
 401406                 case USTATIC:
 402407                         if (kflag == 0)
 403408                                 break;
 404409                         /* FALLTHROUGH */
 405410                 case STATIC:
 406411 #ifdef TLS
 407412                         if (q->sflags & STLS) {
 408413                                 p = tlsref(p);
 409414                                 break;
 410415                         }
 411416 #endif
 412417                         if (kflag == 0) {
 413418                                 if (q->slevel == 0)
 414419                                         break;
 415420                         } else if (blevel > 0 && !statinit)
 416421                                 p = picstatic(p);
 417422                         break;
 418423 
 419424                 case REGISTER:
 420425                         p->n_op = REG;
 421426                         p->n_lval = 0;
 422427                         p->n_rval = q->soffset;
 423428                         break;
 424429 
 425430                 case EXTERN:
 426431                 case EXTDEF:
 427432 #ifdef TLS
 428433                         if (q->sflags & STLS) {
 429434                                 p = tlsref(p);
 430435                                 break;
 431436                         }
 432437 #endif
 433438 
 434439 #ifdef os_win32
 435440                         if (q->sflags & SDLLINDIRECT)
 436441                                 p = import(p);
 437442 #endif
 438443                         if (kflag == 0)
 439444                                 break;
 440445                         if (blevel > 0 && !statinit)
 441446                                 p = picext(p);
 442447                         break;
 443448                 }
 444449                 break;
 445450 
 446451         case ADDROF:
 447452                 if (kflag == 0 || blevel == 0)
 448453                         break;
 449454                 /* char arrays may end up here */
 450455                 l = p->n_left;
 451456                 if (l->n_op != NAME ||
 452457                     (l->n_type != ARY+CHAR && l->n_type != ARY+WCHAR_TYPE))
 453458                         break;
 454459                 l = p;
 455460                 p = picstatic(p->n_left);
 456461                 nfree(l);
 457462                 if (p->n_op != UMUL)
 458463                         cerror("ADDROF error");
 459464                 l = p;
 460465                 p = p->n_left;
 461466                 nfree(l);
 462467                 break;
 463468 
 464469         case UCALL:
 465470         case USTCALL:
 466471                 if (kflag == 0)
 467472                         break;
 468473 #if defined(ELFABI)
 469474                 /* Change to CALL node with ebx as argument */
 470475                 l = block(REG, NIL, NIL, INT, 0, 0);
 471476                 l->n_rval = EBX;
 472477                 p->n_right = buildtree(ASSIGN, l,
 473478                     tempnode(gotnr, INT, 0, 0));
 474479                 p->n_op -= (UCALL-CALL);
 475480 #endif
 476481         
 477482         /* FALLTHROUGH */
 478483 #if defined(MACHOABI)
 479484         case CALL:
 480485         case STCALL:
 481486                 if (p->n_type == VOID)
 482487                         break;
 483488 
 484489                 r = tempnode(0, p->n_type, p->n_df, p->n_ap);
 485490                 l = tcopy(r);
 486491                 p = buildtree(COMOP, buildtree(ASSIGN, r, p), l);
 487492 #endif
 488493                         
 489494                 break;
 490495 
 491496 #if defined(os_openbsd)
 492497 /*
 493498  * The called function returns structures according to their aligned size:
 494499  *  Structures 1, 2 or 4 bytes in size are placed in EAX.
 495500  *  Structures 8 bytes in size are placed in: EAX and EDX.
 496501  */
 497502         case UMUL:
 498503                 o = 0;
 499504                 l = p->n_left;
 500505                 if (l->n_op == PLUS)
 501506                         l = l->n_left, o++;
 502507                 if (l->n_op != PCONV)
 503508                         break;
 504509                 l = l->n_left;
 505510                 if (l->n_op != STCALL && l->n_op != USTCALL)
 506511                         break;
 507512                 m = tsize(DECREF(l->n_type), l->n_df, l->n_ap);
 508513                 if (m != SZCHAR && m != SZSHORT &&
 509514                     m != SZINT && m != SZLONGLONG)
 510515                         break;
 511516                 /* This is a direct reference to a small struct return */
 512517                 l->n_op -= (STCALL-CALL);
 513518                 if (o == 0) {
 514519                         /* first element in struct */
 515520                         p->n_left = nfree(p->n_left); /* free PCONV */
 516521                         l->n_ap = p->n_ap;
 517522                         l->n_df = p->n_df;
 518523                         l->n_type = p->n_type;
 519524                         if (p->n_type < INT) {
 520525                                 /* Need to add SCONV */
 521526                                 p->n_op = SCONV;
 522527                         } else
 523528                                 p = nfree(p); /* no casts needed */
 524529                 } else {
 525530                         /* convert PLUS to RS */
 526531                         o = p->n_left->n_right->n_lval;
 527532                         l->n_type = (o > 3 ? ULONGLONG : UNSIGNED);
 528533                         nfree(p->n_left->n_right);
 529534                         p->n_left = nfree(p->n_left);
 530535                         p->n_left = nfree(p->n_left);
 531536                         p->n_left = buildtree(RS, p->n_left, bcon(o*8));
 532537                         p->n_left = makety(p->n_left, p->n_type, p->n_qual,
 533538                             p->n_df, p->n_ap);
 534539                         p = nfree(p);
 535540                 }
 536541                 break;
 537542 #endif
 538543 
 539544 #ifdef notyet
 540545         /* XXX breaks sometimes */
 541546         case CBRANCH:
 542547                 l = p->n_left;
 543548 
 544549                 /*
 545550                  * Remove unnecessary conversion ops.
 546551                  */
 547552                 if (!clogop(l->n_op) || l->n_left->n_op != SCONV)
 548553                         break;
 549554                 if (coptype(l->n_op) != BITYPE)
 550555                         break;
 551556                 if (l->n_right->n_op != ICON)
 552557                         break;
 553558                 r = l->n_left->n_left;
 554559                 if (r->n_type >= FLOAT)
 555560                         break;
 556561                 if (toolarge(r->n_type, l->n_right->n_lval))
 557562                         break;
 558563                 l->n_right->n_type = r->n_type;
 559564                 if (l->n_op >= ULE && l->n_op <= UGT)
 560565                         l->n_op -= (UGT-ULE);
 561566                 p->n_left = buildtree(l->n_op, r, l->n_right);
 562567                 nfree(l->n_left);
 563568                 nfree(l);
 564569                 break;
 565570 #endif
 566571 
 567572         case PCONV:
 568573                 l = p->n_left;
 569574 
 570575                 /* Make int type before pointer */
 571576                 if (l->n_type < INT || l->n_type == LONGLONG ||
 572577                     l->n_type == ULONGLONG || l->n_type == BOOL) {
 573578                         /* float etc? */
 574579                         p->n_left = block(SCONV, l, NIL, UNSIGNED, 0, 0);
 575580                 }
 576581                 break;
 577582 
 578583         case SCONV:
 579584                 if (p->n_left->n_op == COMOP)
 580585                         break/* may propagate wrong type later */
 581586                 l = p->n_left;
 582587 
 583588                 if (p->n_type == l->n_type) {
 584589                         nfree(p);
 585590                         return l;
 586591                 }
 587592 
 588593                 if ((p->n_type & TMASK) == 0 && (l->n_type & TMASK) == 0 &&
 589594                     tsize(p->n_type, p->n_df, p->n_ap) ==
 590595                     tsize(l->n_type, l->n_df, l->n_ap)) {
 591596                         if (p->n_type != FLOAT && p->n_type != DOUBLE &&
 592597                             l->n_type != FLOAT && l->n_type != DOUBLE &&
 593598                             l->n_type != LDOUBLE && p->n_type != LDOUBLE) {
 594599                                 if (l->n_op == NAME || l->n_op == UMUL ||
 595600                                     l->n_op == TEMP) {
 596601                                         l->n_type = p->n_type;
 597602                                         nfree(p);
 598603                                         return l;
 599604                                 }
 600605                         }
 601606                 }
 602607 
 603608                 if (DEUNSIGN(p->n_type) == INT && DEUNSIGN(l->n_type) == INT &&
 604609                     coptype(l->n_op) == BITYPE && l->n_op != COMOP &&
 605610                     l->n_op != QUEST) {
 606611                         l->n_type = p->n_type;
 607612                         nfree(p);
 608613                         return l;
 609614                 }
 610615 
 611616                 o = l->n_op;
 612617                 m = p->n_type;
 613618 
 614619                 if (o == ICON) {
 615620                         /*
 616621                          * Can only end up here if o is an address,
 617622                          * and in that case the only compile-time conversion
 618623                          * possible is to int.
 619624                          */
 620625                         if ((TMASK & l->n_type) == 0 && l->n_sp == NULL)
 621626                                 cerror("SCONV ICON");
 622627                         if (l->n_sp == 0) {
 623628                                 p->n_type = UNSIGNED;
 624629                                 concast(l, m);
 625630                         } else if (m != INT && m != UNSIGNED)
 626631                                 break;
 627632                         l->n_type = m;
 628633                         l->n_ap = 0;
 629634                         nfree(p);
 630635                         return l;
 631636                 } else if (l->n_op == FCON)
 632637                         cerror("SCONV FCON");
 633638                 if ((p->n_type == CHAR || p->n_type == UCHAR ||
 634639                     p->n_type == SHORT || p->n_type == USHORT) &&
 635640                     (l->n_type == FLOAT || l->n_type == DOUBLE ||
 636641                     l->n_type == LDOUBLE)) {
 637642                         p = block(SCONV, p, NIL, p->n_type, p->n_df, p->n_ap);
 638643                         p->n_left->n_type = INT;
 639644                         return p;
 640645                 }
 641646                 break;
 642647 
 643648         case MOD:
 644649         case DIV:
 645650                 if (o == DIV && p->n_type != CHAR && p->n_type != SHORT)
 646651                         break;
 647652                 if (o == MOD && p->n_type != CHAR && p->n_type != SHORT)
 648653                         break;
 649654                 /* make it an int division by inserting conversions */
 650655                 p->n_left = makety(p->n_left, INT, 0, 0, 0);
 651656                 p->n_right = makety(p->n_right, INT, 0, 0, 0);
 652657                 o = p->n_type;
 653658                 p->n_type = INT;
 654659                 p = makety(p, o, 0, 0, 0);
 655660                 break;
 656661 
 657662         case FORCE:
 658663                 /* put return value in return reg */
 659664                 p->n_op = ASSIGN;
 660665                 p->n_right = p->n_left;
 661666                 p->n_left = block(REG, NIL, NIL, p->n_type, 0, 0);
 662667                 p->n_left->n_rval = p->n_left->n_type == BOOL ?
 663668                     RETREG(CHAR) : RETREG(p->n_type);
 664669                 break;
 665670 
 666671         case LS:
 667672         case RS:
 668673                 /* shift count must be in a char */
 669674                 if (p->n_right->n_type == CHAR || p->n_right->n_type == UCHAR)
 670675                         break;
 671676                 p->n_right = block(SCONV, p->n_right, NIL, CHAR, 0, 0);
 672677                 break;
 673678 #if defined(os_openbsd)
 674679                 /* If not using pcc struct return */
 675680         case STASG:
 676681                 r = p->n_right;
 677682                 if (r->n_op != STCALL && r->n_op != USTCALL)
 678683                         break;
 679684                 m = tsize(BTYPE(r->n_type), r->n_df, r->n_ap);
 680685                 if (m == SZCHAR)
 681686                         m = CHAR;
 682687                 else if (m == SZSHORT)
 683688                         m = SHORT;
 684689                 else if (m == SZINT)
 685690                         m = INT;
 686691                 else if (m == SZLONGLONG)
 687692                         m = LONGLONG;
 688693                 else
 689694                         break;
 690695 
 691696                 l = buildtree(ADDROF, p->n_left, NIL);
 692697                 nfree(p);
 693698 
 694699                 r->n_op -= (STCALL-CALL);
 695700                 r->n_type = m;
 696701 
 697702                 /* r = long, l = &struct */
 698703 
 699704                 n = tempnode(0, m, r->n_df, r->n_ap);
 700705                 r = buildtree(ASSIGN, ccopy(n), r);
 701706 
 702707                 s = tempnode(0, l->n_type, l->n_df, l->n_ap);
 703708                 l = buildtree(ASSIGN, ccopy(s), l);
 704709 
 705710                 p = buildtree(COMOP, r, l);
 706711 
 707712                 l = buildtree(CAST,
 708713                     block(NAME, NIL, NIL, m|PTR, 0, 0), ccopy(s));
 709714                 r = l->n_right;
 710715                 nfree(l->n_left);
 711716                 nfree(l);
 712717 
 713718                 r = buildtree(ASSIGN, buildtree(UMUL, r, NIL), n);
 714719                 p = buildtree(COMOP, p, r);
 715720                 p = buildtree(COMOP, p, s);
 716721                 break;
 717722 #endif
 718723         }
 719724 #ifdef PCC_DEBUG
 720725         if (xdebug) {
 721726                 printf("clocal end: %p\n", p);
 722727                 fwalk(p, eprint, 0);
 723728         }
 724729 #endif
 725730         return(p);
 726731 }
 727732 
 728733 /*
 729734  * Change CALL references to either direct (static) or PLT.
 730735  */
 731736 static void
 732737 fixnames(NODE *p, void *arg)
 733738 {
 734739 #if defined(ELFABI) || defined(MACHOABI)
 735740 
 736741         struct symtab *sp;
 737742         struct attr *ap;
 738743         NODE *q;
 739744         char *c;
 740745         int isu;
 741746 
 742747         if ((cdope(p->n_op) & CALLFLG) == 0)
 743748                 return;
 744749         isu = 0;
 745750         q = p->n_left;
 746751         ap = q->n_ap;
 747752         if (q->n_op == UMUL)
 748753                 q = q->n_left, isu = 1;
 749754 
 750755         if (q->n_op == PLUS && q->n_left->n_op == TEMP &&
 751756             q->n_right->n_op == ICON) {
 752757                 sp = q->n_right->n_sp;
 753758 
 754759                 if (sp == NULL)
 755760                         return/* nothing to do */
 756761                 if (sp->sclass == STATIC && !ISFTN(sp->stype))
 757762                         return; /* function pointer */
 758763 
 759764                 if (sp->sclass != STATIC && sp->sclass != EXTERN &&
 760765                     sp->sclass != EXTDEF)
 761766                         cerror("fixnames");
 762767                 c = NULL;
 763768 #if defined(ELFABI)
 764769 
 765770                 if (sp->soname == NULL ||
 766771                     (c = strstr(sp->soname, "@GOT")) == NULL)
 767772                         cerror("fixnames2");
 768773                 if (isu) {
 769774                         memcpy(c, "@PLT", sizeof("@PLT"));
 770775                 } else
 771776                         *c = 0;
 772777 
 773778 #elif defined(MACHOABI)
 774779 
 775780                 if (sp->soname == NULL ||
 776781                     ((c = strstr(sp->soname, "$non_lazy_ptr")) == NULL &&
 777782                     (c = strstr(sp->soname, "-L")) == NULL))
 778783                                 cerror("fixnames2");
 779784 
 780785                 if (!ISFTN(sp->stype))
 781786                         return; /* function pointer */
 782787 
 783788                 if (isu) {
 784789                         addstub(&stublist, sp->soname+1);
 785790                         memcpy(c, "$stub", sizeof("$stub"));
 786791                 } else
 787792                         *c = 0;
 788793 
 789794 #endif
 790795 
 791796                 nfree(q->n_left);
 792797                 q = q->n_right;
 793798                 if (isu)
 794799                         nfree(p->n_left->n_left);
 795800                 nfree(p->n_left);
 796801                 p->n_left = q;
 797802                 q->n_ap = ap;
 798803         }
 799804 #endif
 800805 }
 801806 
 802807 static void mangle(NODE *p);
 803808 
 804809 void
 805810 myp2tree(NODE *p)
 806811 {
 807812         struct symtab *sp;
 808813 
 809814         if (kflag)
 810815                 fixnames(p, 0);
 811816 
 812817         mangle(p);
 813818 
 814819         if (p->n_op != FCON)
 815820                 return;
 816821 
 817822         sp = IALLOC(sizeof(struct symtab));
 818823         sp->sclass = STATIC;
 819824         sp->sap = 0;
 820825         sp->slevel = 1; /* fake numeric label */
 821826         sp->soffset = getlab();
 822827         sp->sflags = 0;
 823828         sp->stype = p->n_type;
 824829         sp->squal = (CON >> TSHIFT);
 825830         sp->sname = sp->soname = NULL;
 826831 
 827832         locctr(DATA, sp);
 828833         defloc(sp);
 829834         ninval(0, tsize(sp->stype, sp->sdf, sp->sap), p);
 830835 
 831836         p->n_op = NAME;
 832837         p->n_lval = 0;
 833838         p->n_sp = sp;
 834839 
 835840         if (kflag) {
 836841                 NODE *q = optim(picstatic(tcopy(p)));
 837842                 *p = *q;
 838843                 nfree(q);
 839844         }
 840845 }
 841846 
 842847 /*ARGSUSED*/
 843848 int
 844849 andable(NODE *p)
 845850 {
 846851         return(1);      /* all names can have & taken on them */
 847852 }
 848853 
 849854 /*
 850855  * Return 1 if a variable of type type is OK to put in register.
 851856  */
 852857 int
 853858 cisreg(TWORD t)
 854859 {
 855860         if (t == FLOAT || t == DOUBLE || t == LDOUBLE)
 856861                 return 0; /* not yet */
 857862         return 1;
 858863 }
 859864 
 860865 /*
 861866  * Allocate off bits on the stack.  p is a tree that when evaluated
 862867  * is the multiply count for off, t is a storeable node where to write
 863868  * the allocated address.
 864869  */
 865870 void
 866871 spalloc(NODE *t, NODE *p, OFFSZ off)
 867872 {
 868873         NODE *sp;
 869874 
 870875         p = buildtree(MUL, p, bcon(off/SZCHAR)); /* XXX word alignment? */
 871876 
 872877         /* sub the size from sp */
 873878         sp = block(REG, NIL, NIL, p->n_type, 0, 0);
 874879         sp->n_lval = 0;
 875880         sp->n_rval = STKREG;
 876881         ecomp(buildtree(MINUSEQ, sp, p));
 877882 
 878883 #ifdef MACHOABI 
 879884         /* align to 16 bytes */
 880885         sp = block(REG, NIL, NIL, p->n_type, 0, 0);
 881886         sp->n_lval = 0;
 882887         sp->n_rval = STKREG;
 883888         ecomp(buildtree(PLUSEQ, sp, bcon(15)));
 884889         
 885890         sp = block(REG, NIL, NIL, p->n_type, 0, 0);
 886891         sp->n_lval = 0;
 887892         sp->n_rval = STKREG;
 888893         ecomp(buildtree(RSEQ, sp, bcon(4)));
 889894         
 890895         sp = block(REG, NIL, NIL, p->n_type, 0, 0);
 891896         sp->n_lval = 0;
 892897         sp->n_rval = STKREG;
 893898         ecomp(buildtree(LSEQ, sp, bcon(4)));
 894899 #endif
 895900         
 896901 
 897902         /* save the address of sp */
 898903         sp = block(REG, NIL, NIL, PTR+INT, t->n_df, t->n_ap);
 899904         sp->n_lval = 0;
 900905         sp->n_rval = STKREG;
 901906         t->n_type = sp->n_type;
 902907         ecomp(buildtree(ASSIGN, t, sp)); /* Emit! */
 903908 
 904909 }
 905910 
 906911 /*
 907912  * print out a constant node, may be associated with a label.
 908913  * Do not free the node after use.
 909914  * off is bit offset from the beginning of the aggregate
 910915  * fsz is the number of bits this is referring to
 911916  */
 912917 int
 913918 ninval(CONSZ off, int fsz, NODE *p)
 914919 {
 915920         union { float f; double d; long double l; int i[3]; } u;
 916921         int i;
 917922 
 918923         switch (p->n_type) {
 919924         case LONGLONG:
 920925         case ULONGLONG:
 921926                 i = (int)(p->n_lval >> 32);
 922927                 p->n_lval &= 0xffffffff;
 923928                 p->n_type = INT;
 924929                 inval(off, 32, p);
 925930                 p->n_lval = i;
 926931                 inval(off+32, 32, p);
 927932                 break;
 928933         case LDOUBLE:
 929934                 u.i[2] = 0;
 930935                 u.l = (long double)p->n_dcon;
 931936 #if defined(HOST_BIG_ENDIAN)
 932937                 /* XXX probably broken on most hosts */
 933938                 printf("\t.long\t0x%x,0x%x,0x%x\n", u.i[2], u.i[1], u.i[0]);
 934939 #else
 935940                 printf("\t.long\t%d,%d,%d\n", u.i[0], u.i[1], u.i[2] & 0177777);
 936941 #endif
 937942                 break;
 938943         case DOUBLE:
 939944                 u.d = (double)p->n_dcon;
 940945 #if defined(HOST_BIG_ENDIAN)
 941946                 printf("\t.long\t0x%x,0x%x\n", u.i[1], u.i[0]);
 942947 #else
 943948                 printf("\t.long\t%d,%d\n", u.i[0], u.i[1]);
 944949 #endif
 945950                 break;
 946951         case FLOAT:
 947952                 u.f = (float)p->n_dcon;
 948953                 printf("\t.long\t%d\n", u.i[0]);
 949954                 break;
 950955         default:
 951956                 return 0;
 952957         }
 953958         return 1;
 954959 }
 955960 
 956961 /* make a name look like an external name in the local machine */
 957962 char *
 958963 exname(char *p)
 959964 {
 960965 #if !defined(ELFABI)
 961966 
 962967 #define NCHNAM  256
 963968         static char text[NCHNAM+1];
 964969         int i;
 965970 
 966971         if (p == NULL)
 967972                 return "";
 968973 
 969974         text[0] = '_';
 970975         for (i=1; *p && i<NCHNAM; ++i)
 971976                 text[i] = *p++;
 972977 
 973978         text[i] = '\0';
 974979         text[NCHNAM] = '\0'/* truncate */
 975980 
 976981         return (text);
 977982 
 978983 #else
 979984 
 980985         return (p == NULL ? "" : p);
 981986 
 982987 #endif
 983988 }
 984989 
 985990 /*
 986991  * map types which are not defined on the local machine
 987992  */
 988993 TWORD
 989994 ctype(TWORD type)
 990995 {
 991996         switch (BTYPE(type)) {
 992997         case LONG:
 993998                 MODTYPE(type,INT);
 994999                 break;
 9951000 
 9961001         case ULONG:
 9971002                 MODTYPE(type,UNSIGNED);
 9981003 
 9991004         }
 10001005         return (type);
 10011006 }
 10021007 
 10031008 void
 10041009 calldec(NODE *p, NODE *q)
 10051010 {
 10061011 }
 10071012 
 10081013 void
 10091014 extdec(struct symtab *q)
 10101015 {
 10111016 }
 10121017 
 10131018 /* make a common declaration for id, if reasonable */
 10141019 void
 10151020 defzero(struct symtab *sp)
 10161021 {
 10171022         int off;
 10181023         int al;
 10191024         char *name;
 10201025 
 10211026         if ((name = sp->soname) == NULL)
 10221027                 name = exname(sp->sname);
 10231028         al = talign(sp->stype, sp->sap)/SZCHAR;
 10241029         off = (int)tsize(sp->stype, sp->sdf, sp->sap);
 10251030         SETOFF(off,SZCHAR);
 10261031         off /= SZCHAR;
 10271032 #if defined(MACHOABI)
 10281033         al = ispow2(al);
 10291034         if (sp->sclass == STATIC) {
 10301035                 if (sp->slevel == 0)
 10311036                         printf("\t.lcomm %s,0%o,%d\n", name, off, al);
 10321037                 else
 10331038                         printf("\t.lcomm  " LABFMT ",0%o,%d\n", sp->soffset, off, al);
 10341039         } else {
 10351040                 if (sp->slevel == 0)
 10361041                         printf("\t.comm %s,0%o,%d\n", name, off, al);
 10371042                 else
 10381043                         printf("\t.comm  " LABFMT ",0%o,%d\n", sp->soffset, off, al);
 10391044         }
 10401045 #else
 10411046         if (sp->sclass == STATIC) {
 10421047                 if (sp->slevel == 0) {
 10431048                         printf("\t.local %s\n", name);
 10441049                 } else
 10451050                         printf("\t.local " LABFMT "\n", sp->soffset);
 10461051         }
 10471052         if (sp->slevel == 0)
 10481053                 printf("\t.comm %s,0%o,%d\n", name, off, al);
 10491054         else
 10501055                 printf("\t.comm  " LABFMT ",0%o,%d\n", sp->soffset, off, al);
 10511056 #endif
 10521057 }
 10531058 
 10541059 static char *
 10551060 section2string(char *name)
 10561061 {
 10571062         int len = strlen(name);
 10581063 
 10591064 #if defined(ELFABI)
 10601065         if (strncmp(name, "link_set", 8) == 0) {
 10611066                 const char postfix[] = ",\"aw\",@progbits";
 10621067                 char *s;
 10631068 
 10641069                 s = IALLOC(len + sizeof(postfix));
 10651070                 memcpy(s, name, len);
 10661071                 memcpy(s + len, postfix, sizeof(postfix));
 10671072                 return s;
 10681073         }
 10691074 #endif
 10701075 
 10711076         return newstring(name, len);
 10721077 }
 10731078 
 10741079 char *nextsect;
 10751080 #ifdef TLS
 10761081 static int gottls;
 10771082 #endif
 10781083 static int stdcall;
 10791084 #ifdef os_win32
 10801085 static int dllindirect;
 10811086 #endif
 10821087 static char *alias;
 10831088 static int constructor;
 10841089 static int destructor;
 10851090 
 10861091 /*
 10871092  * Give target the opportunity of handling pragmas.
 10881093  */
 10891094 int
 10901095 mypragma(char *str)
 10911096 {
 10921097         char *a2 = pragtok(NULL);
 10931098 
 10941099 #ifdef TLS
 10951100         if (strcmp(str, "tls") == 0 && a2 == NULL) {
 10961101                 gottls = 1;
 10971102                 return 1;
 10981103         }
 10991104 #endif
 11001105         if (strcmp(str, "stdcall") == 0) {
 11011106                 stdcall = 1;
 11021107                 return 1;
 11031108         }
 11041109         if (strcmp(str, "cdecl") == 0) {
 11051110                 stdcall = 0;
 11061111                 return 1;
 11071112         }
 11081113 #ifdef os_win32
 11091114         if (strcmp(str, "fastcall") == 0) {
 11101115                 stdcall = 2;
 11111116                 return 1;
 11121117         }
 11131118         if (strcmp(str, "dllimport") == 0) {
 11141119                 dllindirect = 1;
 11151120                 return 1;
 11161121         }
 11171122         if (strcmp(str, "dllexport") == 0) {
 11181123                 dllindirect = 1;
 11191124                 return 1;
 11201125         }
 11211126 #endif
 11221127 #ifndef AOUTABI
 11231128         if (strcmp(str, "constructor") == 0 || strcmp(str, "init") == 0) {
 11241129                 constructor = 1;
 11251130                 return 1;
 11261131         }
 11271132         if (strcmp(str, "destructor") == 0 || strcmp(str, "fini") == 0) {
 11281133                 destructor = 1;
 11291134                 return 1;
 11301135         }
 11311136 #endif
 11321137         if (strcmp(str, "section") == 0 && a2 != NULL) {
 11331138                 nextsect = section2string(a2);
 11341139                 return 1;
 11351140         }
 11361141         if (strcmp(str, "alias") == 0 && a2 != NULL) {
 11371142                 alias = tmpstrdup(a2);
 11381143                 return 1;
 11391144         }
 11401145 
 11411146         return 0;
 11421147 }
 11431148 
 11441149 /*
 11451150  * Called when a identifier has been declared.
 11461151  */
 11471152 void
 11481153 fixdef(struct symtab *sp)
 11491154 {
 11501155         struct attr *ap;
 11511156 #ifdef TLS
 11521157         /* may have sanity checks here */
 11531158         if (gottls)
 11541159                 sp->sflags |= STLS;
 11551160         gottls = 0;
 11561161 #endif
 11571162         if ((ap = attr_find(sp->sap, GCC_ATYP_ALIAS)) != NULL) {
 11581163                 char *an = ap->sarg(0); 
 11591164                 char *sn = sp->soname ? sp->soname : sp->sname;
 11601165                 char *v;
 11611166 
 11621167                 v = attr_find(sp->sap, GCC_ATYP_WEAK) ? "weak" : "globl";
 11631168                 printf("\t.%s %s\n", v, sn);
 11641169                 printf("\t.set %s,%s\n", sn, an);
 11651170         }       
 11661171 
 11671172         if (alias != NULL && (sp->sclass != PARAM)) {
 11681173                 char *name;
 11691174                 if ((name = sp->soname) == NULL)
 11701175                         name = exname(sp->sname);
 11711176                 printf("\t.globl %s\n", name);
 11721177                 printf("%s = ", name);
 11731178                 printf("%s\n", exname(alias));
 11741179                 alias = NULL;
 11751180         }
 11761181         if ((constructor || destructor) && (sp->sclass != PARAM)) {
 11771182 #if defined(ELFABI)
 11781183                 printf("\t.section .%ctors,\"aw\",@progbits\n",
 11791184                     constructor ? 'c' : 'd');
 11801185 #elif defined(PECOFFABI)
 11811186                 printf("\t.section .%ctors,\"w\"\n",
 11821187                     constructor ? 'c' : 'd');
 11831188 #elif defined(MACHOABI)
 11841189                 if (kflag) {
 11851190                         if (constructor)
 11861191                                 printf("\t.mod_init_func\n");
 11871192                         else
 11881193                                 printf("\t.mod_term_func\n");
 11891194                 } else {
 11901195                         if (constructor)
 11911196                                 printf("\t.constructor\n");
 11921197                         else
 11931198                                 printf("\t.destructor\n");
 11941199                 }
 11951200 #elif defined(AOUTABI)
 11961201                 uerror("constructor/destructor are not supported for this target");
 11971202 #endif
 11981203                 printf("\t.p2align 2\n");
 11991204                 printf("\t.long %s\n", exname(sp->sname));
 12001205 #ifdef MACHOABI
 12011206                 printf("\t.text\n");
 12021207 #else
 12031208                 printf("\t.previous\n");
 12041209 #endif
 12051210                 constructor = destructor = 0;
 12061211         }
 12071212         if (stdcall && (sp->sclass != PARAM)) {
 12081213                 sp->sflags |= SSTDCALL;
 12091214                 stdcall = 0;
 12101215         }
 12111216 #ifdef os_win32
 12121217         if (dllindirect && (sp->sclass != PARAM)) {
 12131218                 sp->sflags |= SDLLINDIRECT;
 12141219                 dllindirect = 0;
 12151220         }
 12161221 #endif
 12171222 }
 12181223 
 12191224 /*
 12201225  *  Postfix external functions with the arguments size.
 12211226  */
 12221227 static void
 12231228 mangle(NODE *p)
 12241229 {
 12251230         NODE *l;
 12261231 
 12271232         if (p->n_op == NAME || p->n_op == ICON) {
 12281233                 p->n_flags = 0; /* for later setting of STDCALL */
 12291234                 if (p->n_sp) {
 12301235                          if (p->n_sp->sflags & SSTDCALL)
 12311236                                 p->n_flags = FSTDCALL;
 12321237                 }
 12331238         } else if (p->n_op == TEMP)
 12341239                 p->n_flags = 0; /* STDCALL fun ptr not allowed */
 12351240 
 12361241         if (p->n_op != CALL && p->n_op != STCALL &&
 12371242             p->n_op != UCALL && p->n_op != USTCALL)
 12381243                 return;
 12391244 
 12401245         p->n_flags = 0;
 12411246 
 12421247         l = p->n_left;
 12431248         while (cdope(l->n_op) & CALLFLG)
 12441249                 l = l->n_left;
 12451250         if (l->n_op == TEMP)
 12461251                 return;
 12471252         if (l->n_op == ADDROF)
 12481253                 l = l->n_left;
 12491254         if (l->n_sp == NULL)
 12501255                 return;
 12511256 #ifdef GCC_COMPAT
 12521257         if (attr_find(l->n_sp->sap, GCC_ATYP_STDCALL) != NULL)
 12531258                 l->n_sp->sflags |= SSTDCALL;
 12541259 #endif
 12551260 #ifdef os_win32
 12561261         if (l->n_sp->sflags & SSTDCALL) {
 12571262                 if (strchr(l->n_name, '@') == NULL) {
 12581263                         int size = 0;
 12591264                         char buf[256];
 12601265                         NODE *r;
 12611266                         TWORD t;
 12621267 
 12631268                         if (p->n_op == CALL || p->n_op == STCALL) {
 12641269                                 for (r = p->n_right;    
 12651270                                     r->n_op == CM; r = r->n_left) {
 12661271                                         t = r->n_type;
 12671272                                         if (t == STRTY || t == UNIONTY)
 12681273                                                 size += tsize(t, r->n_df, r->n_ap);
 12691274                                         else
 12701275                                                 size += szty(t) * SZINT / SZCHAR;
 12711276                                 }
 12721277                                 t = r->n_type;
 12731278                                 if (t == STRTY || t == UNIONTY)
 12741279                                         size += tsize(t, r->n_df, r->n_ap);
 12751280                                 else
 12761281                                         size += szty(t) * SZINT / SZCHAR;
 12771282                         }
 12781283                         size = snprintf(buf, 256, "%s@%d", l->n_name, size) + 1;
 12791284                         l->n_name = IALLOC(size);
 12801285                         memcpy(l->n_name, buf, size);
 12811286                 }
 12821287         }
 12831288 #endif
 12841289 }
 12851290 
 12861291 void
 12871292 pass1_lastchance(struct interpass *ip)
 12881293 {
 12891294         if (ip->type == IP_NODE &&
 12901295             (ip->ip_node->n_op == CALL || ip->ip_node->n_op == UCALL) &&
 12911296             ISFTY(ip->ip_node->n_type))
 12921297                 ip->ip_node->n_flags = FFPPOP;
 12931298  
 12941299         if (ip->type == IP_EPILOG) {
 12951300                 struct interpass_prolog *ipp = (struct interpass_prolog *)ip;
 12961301                 ipp->ipp_argstacksize = argstacksize;
 12971302         }
 12981303 }
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-21 01:28 +0100