Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/pcc/dist/pcc Import latest PCC snapshot 2014070...



details:   https://anonhg.NetBSD.org/src/rev/94601ff461ff
branches:  trunk
changeset: 330864:94601ff461ff
user:      plunky <plunky%NetBSD.org@localhost>
date:      Thu Jul 24 19:11:58 2014 +0000

description:
Import latest PCC snapshot 20140706; it has been over two years since
the last import, and some build framework has been changed so this
makes it easier for people to work with later versions.

The full list of changes in the meantime are available at the PCC
CVS server, and the bugs fixed are detailed at the PCC bug tracker,
but in summary, new features added are a C++ front end, m68k support
and unicode support.

and bugs fixed in the areas of the register allocator, floating point,
attributes, long long arithmetic, PIC support and code sections (for
shared libraries) among others.

This version compiles the vast majority of the NetBSD sources on i386,
and bug reports are welcome at the PCC JIRA server.

diffstat:

 external/bsd/pcc/dist/pcc/DATESTAMP              |     2 +-
 external/bsd/pcc/dist/pcc/arch/amd64/code.c      |   669 +-
 external/bsd/pcc/dist/pcc/arch/amd64/macdefs.h   |    47 +-
 external/bsd/pcc/dist/pcc/arch/amd64/order.c     |    11 +-
 external/bsd/pcc/dist/pcc/arch/amd64/table.c     |    40 +-
 external/bsd/pcc/dist/pcc/arch/arm/code.c        |    13 +-
 external/bsd/pcc/dist/pcc/arch/arm/local2.c      |    10 +-
 external/bsd/pcc/dist/pcc/arch/arm/macdefs.h     |     5 +-
 external/bsd/pcc/dist/pcc/arch/hppa/code.c       |    12 +-
 external/bsd/pcc/dist/pcc/arch/hppa/local.c      |    27 +-
 external/bsd/pcc/dist/pcc/arch/hppa/macdefs.h    |     8 +-
 external/bsd/pcc/dist/pcc/arch/hppa/table.c      |     8 +-
 external/bsd/pcc/dist/pcc/arch/i386/code.c       |   421 +-
 external/bsd/pcc/dist/pcc/arch/i386/flocal.c     |    13 +-
 external/bsd/pcc/dist/pcc/arch/i386/local.c      |   274 +-
 external/bsd/pcc/dist/pcc/arch/i386/local2.c     |   202 +-
 external/bsd/pcc/dist/pcc/arch/i386/macdefs.h    |    23 +-
 external/bsd/pcc/dist/pcc/arch/i386/order.c      |    10 +-
 external/bsd/pcc/dist/pcc/arch/i386/table.c      |    39 +-
 external/bsd/pcc/dist/pcc/arch/m16c/code.c       |    13 +-
 external/bsd/pcc/dist/pcc/arch/m16c/local2.c     |    10 +-
 external/bsd/pcc/dist/pcc/arch/m16c/macdefs.h    |     5 +-
 external/bsd/pcc/dist/pcc/arch/m16c/order.c      |    10 +-
 external/bsd/pcc/dist/pcc/arch/m68k/code.c       |   274 +
 external/bsd/pcc/dist/pcc/arch/m68k/local.c      |   407 +
 external/bsd/pcc/dist/pcc/arch/m68k/local2.c     |   785 +++
 external/bsd/pcc/dist/pcc/arch/m68k/macdefs.h    |   244 +
 external/bsd/pcc/dist/pcc/arch/m68k/order.c      |   181 +
 external/bsd/pcc/dist/pcc/arch/m68k/table.c      |  1000 +++
 external/bsd/pcc/dist/pcc/arch/mips/code.c       |    35 +-
 external/bsd/pcc/dist/pcc/arch/mips/local.c      |    28 +-
 external/bsd/pcc/dist/pcc/arch/mips/local2.c     |    14 +-
 external/bsd/pcc/dist/pcc/arch/mips/macdefs.h    |    30 +-
 external/bsd/pcc/dist/pcc/arch/nova/README       |   253 +-
 external/bsd/pcc/dist/pcc/arch/nova/code.c       |   183 +-
 external/bsd/pcc/dist/pcc/arch/nova/local.c      |   178 +-
 external/bsd/pcc/dist/pcc/arch/nova/local2.c     |   255 +-
 external/bsd/pcc/dist/pcc/arch/nova/macdefs.h    |   129 +-
 external/bsd/pcc/dist/pcc/arch/nova/order.c      |    41 +-
 external/bsd/pcc/dist/pcc/arch/nova/table.c      |   160 +-
 external/bsd/pcc/dist/pcc/arch/pdp10/code.c      |    10 +-
 external/bsd/pcc/dist/pcc/arch/pdp10/local.c     |     8 +-
 external/bsd/pcc/dist/pcc/arch/pdp10/local2.c    |    25 +-
 external/bsd/pcc/dist/pcc/arch/pdp10/macdefs.h   |     5 +-
 external/bsd/pcc/dist/pcc/arch/pdp11/code.c      |    10 +-
 external/bsd/pcc/dist/pcc/arch/pdp11/macdefs.h   |     5 +-
 external/bsd/pcc/dist/pcc/arch/powerpc/code.c    |    17 +-
 external/bsd/pcc/dist/pcc/arch/powerpc/local.c   |    12 +-
 external/bsd/pcc/dist/pcc/arch/powerpc/local2.c  |    16 +-
 external/bsd/pcc/dist/pcc/arch/powerpc/macdefs.h |     5 +-
 external/bsd/pcc/dist/pcc/arch/sparc64/code.c    |    11 +-
 external/bsd/pcc/dist/pcc/arch/sparc64/macdefs.h |     5 +-
 external/bsd/pcc/dist/pcc/arch/vax/code.c        |   135 +-
 external/bsd/pcc/dist/pcc/arch/vax/local.c       |    38 +-
 external/bsd/pcc/dist/pcc/arch/vax/local2.c      |   139 +-
 external/bsd/pcc/dist/pcc/arch/vax/macdefs.h     |    19 +-
 external/bsd/pcc/dist/pcc/arch/vax/table.c       |    52 +-
 external/bsd/pcc/dist/pcc/cc/cc/Makefile.in      |    61 +-
 external/bsd/pcc/dist/pcc/config.h.in            |    12 +-
 external/bsd/pcc/dist/pcc/config.sub             |     4 +
 external/bsd/pcc/dist/pcc/configure              |  5591 ++++++++++-----------
 61 files changed, 7968 insertions(+), 4281 deletions(-)

diffs (truncated from 17197 to 300 lines):

diff -r 9e795e43b4e2 -r 94601ff461ff external/bsd/pcc/dist/pcc/DATESTAMP
--- a/external/bsd/pcc/dist/pcc/DATESTAMP       Thu Jul 24 18:23:28 2014 +0000
+++ b/external/bsd/pcc/dist/pcc/DATESTAMP       Thu Jul 24 19:11:58 2014 +0000
@@ -1,1 +1,1 @@
-20120325
+20140706
diff -r 9e795e43b4e2 -r 94601ff461ff external/bsd/pcc/dist/pcc/arch/amd64/code.c
--- a/external/bsd/pcc/dist/pcc/arch/amd64/code.c       Thu Jul 24 18:23:28 2014 +0000
+++ b/external/bsd/pcc/dist/pcc/arch/amd64/code.c       Thu Jul 24 19:11:58 2014 +0000
@@ -1,5 +1,5 @@
-/*     Id: code.c,v 1.63 2011/09/27 08:10:45 plunky Exp        */      
-/*     $NetBSD: code.c,v 1.1.1.4 2012/01/11 20:32:40 plunky Exp $      */
+/*     Id: code.c,v 1.74 2014/07/03 14:03:50 ragge Exp         */      
+/*     $NetBSD: code.c,v 1.1.1.5 2014/07/24 19:15:26 plunky Exp $      */
 /*
  * Copyright (c) 2008 Michael Shalayeff
  * Copyright (c) 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
@@ -33,7 +33,8 @@
 
 static int nsse, ngpr, nrsp, rsaoff;
 static int thissse, thisgpr, thisrsp;
-enum { INTEGER = 1, INTMEM, SSE, SSEMEM, X87, STRREG, STRMEM, STRCPX };
+enum { INTEGER = 1, INTMEM, SSE, SSEMEM, X87,
+       STRREG, STRMEM, STRSSE, STRIF, STRFI, STRX87 };
 static const int argregsi[] = { RDI, RSI, RDX, RCX, R08, R09 };
 /*
  * The Register Save Area looks something like this.
@@ -56,11 +57,13 @@
 static int stroffset;
 
 static int varneeds;
-#define        NEED_GPNEXT     001
-#define        NEED_FPNEXT     002
-#define        NEED_1REGREF    004
-#define        NEED_2REGREF    010
-#define        NEED_MEMREF     020
+#define        NEED_1FPREF      001
+#define        NEED_2FPREF      002
+#define        NEED_1REGREF     004
+#define        NEED_2REGREF     010
+#define        NEED_MEMREF      020
+#define        NEED_STRFI       040
+#define        NEED_STRIF      0100
 
 static int argtyp(TWORD t, union dimfun *df, struct attr *ap);
 static NODE *movtomem(NODE *p, int off, int reg);
@@ -70,6 +73,26 @@
 /*
  * Print out assembler segment name.
  */
+#ifdef MACHOABI
+void
+setseg(int seg, char *name)
+{
+       switch (seg) {
+       case PROG: name = ".text"; break;
+       case DATA:
+       case LDATA: name = ".data"; break;
+       case RDATA: name = ".const"; break;
+       case STRNG: name = ".cstring"; break;
+       case UDATA: break;
+       case CTORS: name = ".mod_init_func"; break;
+       case DTORS: name = ".mod_term_func"; break;
+       default:
+               cerror("unknown seg %d", seg);
+       }
+       printf("\t%s\n", name);
+}
+
+#else
 void
 setseg(int seg, char *name)
 {
@@ -80,25 +103,21 @@
        case STRNG:
        case RDATA: name = ".section .rodata"; break;
        case UDATA: break;
-#ifdef MACHOABI
-       case PICLDATA:
-       case PICDATA: name = ".section .data.rel.rw,\"aw\""; break;
-       case PICRDATA: name = ".section .data.rel.ro,\"aw\""; break;
-#else
        case PICLDATA:
        case PICDATA: name = ".section .data.rel.rw,\"aw\",@progbits"; break;
        case PICRDATA: name = ".section .data.rel.ro,\"aw\",@progbits"; break;
-#endif
        case TLSDATA: name = ".section .tdata,\"awT\",@progbits"; break;
        case TLSUDATA: name = ".section .tbss,\"awT\",@nobits"; break;
        case CTORS: name = ".section\t.ctors,\"aw\",@progbits"; break;
        case DTORS: name = ".section\t.dtors,\"aw\",@progbits"; break;
        case NMSEG: 
-               printf("\t.section %s,\"aw\",@progbits\n", name);
+               printf("\t.section %s,\"a%c\",@progbits\n", name,
+                   cftnsp ? 'x' : 'w');
                return;
        }
        printf("\t%s\n", name);
 }
+#endif
 
 /*
  * Define everything needed to print out some data (or text).
@@ -115,8 +134,13 @@
        if (sp->sclass == EXTDEF) {
                printf("\t.globl %s\n", name);
 #ifndef MACHOABI
-               printf("\t.type %s,@%s\n", name,
-                   ISFTN(sp->stype)? "function" : "object");
+               if (ISFTN(sp->stype)) {
+                       printf("\t.type %s,@function\n", name);
+               } else {
+                       printf("\t.type %s,@object\n", name);
+                       printf("\t.size %s,%d\n", name,
+                           (int)tsize(sp->stype, sp->sdf, sp->sap)/SZCHAR);
+               }
 #endif
        }
        if (sp->slevel == 0)
@@ -131,13 +155,13 @@
  * The return value is in (or pointed to by) RETREG.
  */
 void
-efcode()
+efcode(void)
 {
        struct symtab *sp;
        extern int gotnr;
        TWORD t;
        NODE *p, *r, *l;
-       int typ, ssz, rno;
+       int typ;
 
        gotnr = 0;      /* new number for next fun */
        sp = cftnsp;
@@ -147,32 +171,8 @@
 
        /* XXX should have one routine for this */
        ngpr = nsse = 0;
-       if ((typ = argtyp(t, sp->sdf, sp->sap)) == STRREG || typ == STRCPX) {
-               /* Cast to long pointer and move to the registers */
-               /* XXX can overrun struct size */
-               /* XXX check carefully for SSE members */
-
-               if ((ssz = tsize(t, sp->sdf, sp->sap)) > SZLONG*2)
-                       cerror("efcode1");
-
-               if (typ == STRCPX) {
-                       t = DOUBLE;
-                       rno = XMM0;
-               } else {
-                       t = LONG;
-                       rno = RAX;
-               }
-               if (ssz > SZLONG) {
-                       p = block(REG, NIL, NIL, INCREF(t), 0, 0);
-                       regno(p) = RAX;
-                       p = buildtree(UMUL, buildtree(PLUS, p, bcon(1)), NIL);
-                       ecomp(movtoreg(p, rno+1));
-               }
-               p = block(REG, NIL, NIL, INCREF(t), 0, 0);
-               regno(p) = RAX;
-               p = buildtree(UMUL, p, NIL);
-               ecomp(movtoreg(p, rno));
-       } else if (typ == STRMEM) {
+       typ = argtyp(t, sp->sdf, sp->sap);
+       if (typ == STRMEM) {
                r = block(REG, NIL, NIL, INCREF(t), sp->sdf, sp->sap);
                regno(r) = RAX;
                r = buildtree(UMUL, r, NIL);
@@ -183,8 +183,38 @@
                regno(l) = RAX;
                r = tempnode(stroffset, LONG, 0, 0);
                ecomp(buildtree(ASSIGN, l, r));
-       } else
-               cerror("efcode");
+       } else if (typ == STRX87) {
+               p = block(REG, NIL, NIL, INCREF(LDOUBLE), 0, 0);
+               regno(p) = RAX;
+               p = buildtree(UMUL, buildtree(PLUS, p, bcon(1)), NIL);
+               ecomp(movtoreg(p, 041));
+               p = block(REG, NIL, NIL, INCREF(LDOUBLE), 0, 0);
+               regno(p) = RAX;
+               p = buildtree(UMUL, p, NIL);
+               ecomp(movtoreg(p, 040));
+       } else {
+               TWORD t1, t2;
+               int r1, r2;
+               if (typ == STRSSE || typ == STRFI)
+                       r1 = XMM0, t1 = DOUBLE;
+               else
+                       r1 = RAX, t1 = LONG;
+               if (typ == STRSSE || typ == STRIF)
+                       r2 = XMM1, t2 = DOUBLE;
+               else
+                       r2 = RDX, t2 = LONG;
+
+               if (tsize(t, sp->sdf, sp->sap) > SZLONG) {
+                       p = block(REG, NIL, NIL, INCREF(t2), 0, 0);
+                       regno(p) = RAX;
+                       p = buildtree(UMUL, buildtree(PLUS, p, bcon(1)), NIL);
+                       ecomp(movtoreg(p, r2));
+               }
+               p = block(REG, NIL, NIL, INCREF(t1), 0, 0);
+               regno(p) = RAX;
+               p = buildtree(UMUL, p, NIL);
+               ecomp(movtoreg(p, r1));
+       }
 }
 
 /*
@@ -198,7 +228,7 @@
        struct symtab *sp;
        NODE *p, *r;
        TWORD t;
-       int i, rno, typ;
+       int i, rno, typ, ssz;
 
        /* recalculate the arg offset and create TEMP moves */
        /* Always do this for reg, even if not optimizing, to free arg regs */
@@ -221,6 +251,7 @@
                if (sp == NULL)
                        continue; /* XXX when happens this? */
 
+               ssz = tsize(sp->stype, sp->sdf, sp->sap);
                switch (typ = argtyp(sp->stype, sp->sdf, sp->sap)) {
                case INTEGER:
                case SSE:
@@ -260,9 +291,10 @@
                        }
                        break;
 
+               case STRX87:
                case STRMEM: /* Struct in memory */
                        sp->soffset = nrsp;
-                       nrsp += tsize(sp->stype, sp->sdf, sp->sap);
+                       nrsp += ssz;
                        break;
 
                case X87: /* long double args */
@@ -270,30 +302,35 @@
                        nrsp += SZLDOUBLE;
                        break;
 
-               case STRCPX:
+               case STRFI:
+               case STRIF:
+               case STRSSE:
                case STRREG: /* Struct in register */
-                       /* Allocate space on stack for the struct */
-                       /* For simplicity always fetch two longwords */
                        autooff += (2*SZLONG);
 
-                       if (typ == STRCPX) {
-                               t = DOUBLE;
+                       if (typ == STRSSE || typ == STRFI) {
                                rno = XMM0 + nsse++;
+                               t = DOUBLE;
                        } else {
+                               rno = argregsi[ngpr++];
                                t = LONG;
-                               rno = argregsi[ngpr++];
                        }
                        r = block(REG, NIL, NIL, t, 0, 0);
                        regno(r) = rno;
                        ecomp(movtomem(r, -autooff, FPREG));
 
-                       if (tsize(sp->stype, sp->sdf, sp->sap) > SZLONG) {
+                       if (ssz > SZLONG) {
+                               if (typ == STRSSE || typ == STRIF) {
+                                       rno = XMM0 + nsse++;
+                                       t = DOUBLE;
+                               } else {
+                                       rno = argregsi[ngpr++];
+                                       t = LONG;
+                               }
                                r = block(REG, NIL, NIL, t, 0, 0);
-                               regno(r) = (typ == STRCPX ?
-                                   XMM0 + nsse++ : argregsi[ngpr++]);
+                               regno(r) = rno;
                                ecomp(movtomem(r, -autooff+SZLONG, FPREG));
                        }
-
                        sp->soffset = -autooff;
                        break;
 
@@ -350,7 +387,7 @@
 /* called just before final exit */
 /* flag is 1 if errors, 0 if none */
 void
-ejobcode(int flag )
+ejobcode(int flag)
 {
        if (flag)
                return;
@@ -361,46 +398,66 @@
 #define        PT(x) printf(".type __pcc_" x ",@function\n")
 #endif
 
+#define        P(x) printf(x "\n")
        /* printout varargs routines if used */



Home | Main Index | Thread Index | Old Index