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 fix merge conflicts from import of...



details:   https://anonhg.NetBSD.org/src/rev/66d1f6f2c62c
branches:  trunk
changeset: 343514:66d1f6f2c62c
user:      plunky <plunky%NetBSD.org@localhost>
date:      Tue Feb 09 20:37:32 2016 +0000

description:
fix merge conflicts from import of pcc-20160208

diffstat:

 external/bsd/pcc/dist/pcc/arch/amd64/code.c    |    94 +-
 external/bsd/pcc/dist/pcc/arch/amd64/local.c   |   176 +-
 external/bsd/pcc/dist/pcc/arch/amd64/local2.c  |   112 +-
 external/bsd/pcc/dist/pcc/cc/cc/cc.1           |    11 +-
 external/bsd/pcc/dist/pcc/cc/ccom/cgram.y      |   882 +++++--
 external/bsd/pcc/dist/pcc/cc/ccom/gcc_compat.c |    63 +-
 external/bsd/pcc/dist/pcc/cc/ccom/main.c       |    95 +-
 external/bsd/pcc/dist/pcc/cc/ccom/pass1.h      |   347 +-
 external/bsd/pcc/dist/pcc/cc/ccom/pftn.c       |   576 +++--
 external/bsd/pcc/dist/pcc/cc/ccom/scan.l       |   464 ++-
 external/bsd/pcc/dist/pcc/cc/ccom/trees.c      |  1212 ++++++----
 external/bsd/pcc/dist/pcc/cc/cpp/cpp.c         |  2576 +++++++++++++----------
 external/bsd/pcc/dist/pcc/configure.ac         |   127 +-
 external/bsd/pcc/dist/pcc/mip/common.c         |   142 +-
 external/bsd/pcc/dist/pcc/mip/optim2.c         |    40 +-
 15 files changed, 4213 insertions(+), 2704 deletions(-)

diffs (truncated from 12016 to 300 lines):

diff -r 33129a9729b4 -r 66d1f6f2c62c external/bsd/pcc/dist/pcc/arch/amd64/code.c
--- a/external/bsd/pcc/dist/pcc/arch/amd64/code.c       Tue Feb 09 20:28:01 2016 +0000
+++ b/external/bsd/pcc/dist/pcc/arch/amd64/code.c       Tue Feb 09 20:37:32 2016 +0000
@@ -1,5 +1,5 @@
-/*     Id: code.c,v 1.74 2014/07/03 14:03:50 ragge Exp         */      
-/*     $NetBSD: code.c,v 1.2 2014/08/13 13:18:08 plunky Exp $  */
+/*     Id: code.c,v 1.85 2015/12/13 09:00:04 ragge Exp         */      
+/*     $NetBSD: code.c,v 1.3 2016/02/09 20:37:32 plunky Exp $  */
 /*
  * Copyright (c) 2008 Michael Shalayeff
  * Copyright (c) 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
@@ -31,6 +31,15 @@
 
 # include "pass1.h"
 
+#ifndef LANG_CXX
+#undef NIL
+#define        NIL NULL
+#define        NODE P1ND
+#define        nfree p1nfree
+#define        ccopy p1tcopy
+#define        tfree p1tfree
+#endif
+
 static int nsse, ngpr, nrsp, rsaoff;
 static int thissse, thisgpr, thisrsp;
 enum { INTEGER = 1, INTMEM, SSE, SSEMEM, X87,
@@ -128,8 +137,7 @@
 {
        char *name;
 
-       if ((name = sp->soname) == NULL)
-               name = exname(sp->sname);
+       name = getexname(sp);
 
        if (sp->sclass == EXTDEF) {
                printf("\t.globl %s\n", name);
@@ -199,9 +207,13 @@
                        r1 = XMM0, t1 = DOUBLE;
                else
                        r1 = RAX, t1 = LONG;
-               if (typ == STRSSE || typ == STRIF)
+               if (typ == STRSSE)
                        r2 = XMM1, t2 = DOUBLE;
-               else
+               else if (typ == STRFI)
+                       r2 = RAX, t2 = LONG;
+               else if (typ == STRIF)
+                       r2 = XMM0, t2 = DOUBLE;
+               else /* if (typ == STRREG) */
                        r2 = RDX, t2 = LONG;
 
                if (tsize(t, sp->sdf, sp->sap) > SZLONG) {
@@ -522,6 +534,15 @@
        NODE *p, *q;
        char *c;
 
+#if defined(__GNUC__) || defined(__PCC__)
+       /* Be sure that the compiler uses full x87 */
+       /* XXX cross-compiling will fail here */
+       int fcw = 0;
+       __asm("fstcw (%0)" : : "r"(&fcw));
+       fcw |= 0x33f;
+       __asm("fldcw (%0)" : : "r"(&fcw));
+#endif
+
        /* amd64 names for some asm constant printouts */
        astypnames[INT] = astypnames[UNSIGNED] = "\t.long";
        astypnames[LONG] = astypnames[ULONG] = "\t.quad";
@@ -713,7 +734,7 @@
        s.sclass = AUTO;
 
        l = block(REG, NIL, NIL, PTR+STRTY, 0, 0);
-       l->n_lval = 0;
+       slval(l, 0);
        regno(l) = reg;
 
        r = block(NAME, NIL, NIL, p->n_type, p->n_df, p->n_ap);
@@ -739,18 +760,47 @@
  * - If the eight-byte only contains float or double, use a SSE register
  * - Otherwise use memory.
  *
+ * Arrays must be broken up as separate elements, since the elements
+ * are classified separately. For example;
+ *     struct s { short s; float f[3]; } S;
+ * will have the first 64 bits passed in general reg and the second in SSE.
+ *
  * sp below is a pointer to a member list.
  * off tells whether is is the first or second eight-byte to check.
  */
 static int
 classifystruct(struct symtab *sp, int off)
 {
+       struct symtab sps[16];
+       union dimfun *df;
        TWORD t;
-       int cl, cl2;
+       int cl, cl2, sz, i;
+
 
        for (cl = 0; sp; sp = sp->snext) {
                t = sp->stype;
 
+               /* fake a linked list of all array members */
+               if (ISARY(t)) {
+                       sz = 1;
+                       df = sp->sdf;
+                       do {
+                               sz *= df->ddim;
+                               t = DECREF(t);
+                               df++;
+                       } while (ISARY(t));
+                       for (i = 0; i < sz; i++) {
+                               sps[i] = *sp;
+                               sps[i].stype = t;
+                               sps[i].sdf = df;
+                               sps[i].snext = &sps[i+1];
+                               sps[i].soffset = i * tsize(t, df, sp->sap);
+                               sps[i].soffset += sp->soffset;
+                       }
+                       sps[i-1].snext = sp->snext;
+                       sp = &sps[0];
+               }
+
                if (off == 0) {
                        if (sp->soffset >= SZLONG)
                                continue;
@@ -768,9 +818,12 @@
                } else if (t == LDOUBLE) {
                        return STRMEM;
                } else if (ISSOU(t)) {
+#ifdef GCC_COMPAT
                        if (attr_find(sp->sap, GCC_ATYP_PACKED)) {
                                cl = STRMEM;
-                       } else {
+                       } else
+#endif
+                       {
                                cl2 = classifystruct(strmemb(sp->sap), off);
                                if (cl2 == STRMEM) {
                                        cl = STRMEM;
@@ -821,9 +874,12 @@
        } else if (t == STRTY || t == UNIONTY) {
                int sz = tsize(t, df, ap);
 
+#ifdef GCC_COMPAT
                if (attr_find(ap, GCC_ATYP_PACKED)) {
                        cl = STRMEM;
-               } else if (iscplx87(strmemb(ap)) == STRX87) {
+               } else
+#endif
+               if (iscplx87(strmemb(ap)) == STRX87) {
                        cl = STRX87;
                } else if (sz > 2*SZLONG) {
                        cl = STRMEM;
@@ -904,6 +960,8 @@
        case INTMEM:
                r = nrsp;
                nrsp += SZLONG;
+               if (p->n_type < INT || p->n_type == BOOL)
+                       p = cast(p, INT, 0);
                p = movtomem(p, r, STKREG);
                break;
 
@@ -966,7 +1024,7 @@
                nrsp += tsize(p->n_type, p->n_df, p->n_ap);
 
                l = block(REG, NIL, NIL, PTR+STRTY, 0, 0);
-               l->n_lval = 0;
+               slval(l, 0);
                regno(l) = STKREG;
 
                t = block(NAME, NIL, NIL, p->n_type, p->n_df, p->n_ap);
@@ -1127,7 +1185,7 @@
        int nframes;
        NODE *f;
 
-       nframes = a->n_lval;
+       nframes = glval(a);
        tfree(a);
 
        f = block(REG, NIL, NIL, PTR+VOID, 0, 0);
@@ -1151,7 +1209,7 @@
        int nframes;
        NODE *f;
 
-       nframes = a->n_lval;
+       nframes = glval(a);
        tfree(a);
 
        f = block(REG, NIL, NIL, PTR+VOID, 0, 0);
@@ -1180,9 +1238,17 @@
 int
 codeatyp(NODE *p)
 {
+       TWORD t;
        int typ;
 
        ngpr = nsse = 0;
-       typ = argtyp(DECREF(p->n_type), p->n_df, p->n_ap);
+       t = DECREF(p->n_type);
+       if (ISSOU(t) == 0) {
+               p = p->n_left;
+               t = DECREF(DECREF(p->n_type));
+       }
+       if (ISSOU(t) == 0)
+               cerror("codeatyp");
+       typ = argtyp(t, p->n_df, p->n_ap);
        return typ;
 }
diff -r 33129a9729b4 -r 66d1f6f2c62c external/bsd/pcc/dist/pcc/arch/amd64/local.c
--- a/external/bsd/pcc/dist/pcc/arch/amd64/local.c      Tue Feb 09 20:28:01 2016 +0000
+++ b/external/bsd/pcc/dist/pcc/arch/amd64/local.c      Tue Feb 09 20:37:32 2016 +0000
@@ -1,5 +1,5 @@
-/*     Id: local.c,v 1.80 2014/07/03 14:25:51 ragge Exp        */      
-/*     $NetBSD: local.c,v 1.3 2014/07/24 20:12:50 plunky Exp $ */
+/*     Id: local.c,v 1.95 2016/02/07 17:51:37 ragge Exp        */      
+/*     $NetBSD: local.c,v 1.4 2016/02/09 20:37:32 plunky Exp $ */
 /*
  * Copyright (c) 2008 Michael Shalayeff
  * Copyright (c) 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
@@ -29,6 +29,15 @@
 
 #include "pass1.h"
 
+#ifndef LANG_CXX
+#define        NODE P1ND
+#define        ccopy p1tcopy
+#define        tfree p1tfree
+#define        nfree p1nfree
+#define        fwalk p1fwalk
+#define        talloc p1alloc
+#endif
+
 /*     this file contains code which is dependent on the target machine */
 
 /*
@@ -62,7 +71,16 @@
 }
 #endif
 
-#define        IALLOC(sz)      (isinlining ? permalloc(sz) : tmpalloc(sz))
+static char *
+getsoname(struct symtab *sp)
+{
+       struct attr *ap;
+       return (ap = attr_find(sp->sap, ATTR_SONAME)) ?
+           ap->sarg(0) : sp->sname;
+}
+
+
+#define IALLOC(sz)     (isinlining ? permalloc(sz) : tmpalloc(sz))
 
 /*
  * Make a symtab entry for PIC use.
@@ -73,10 +91,12 @@
        struct symtab *sp = IALLOC(sizeof(struct symtab));
        size_t len = strlen(p) + strlen(s) + strlen(s2) + 1;
 
-       sp->sname = sp->soname = IALLOC(len);
-       strlcpy(sp->soname, p, len);
-       strlcat(sp->soname, s, len);
-       strlcat(sp->soname, s2, len);
+       sp->sname = IALLOC(len);
+       strlcpy(sp->sname, p, len);
+       strlcat(sp->sname, s, len);
+       strlcat(sp->sname, s2, len);
+       sp->sap = attr_new(ATTR_SONAME, 1);
+       sp->sap->sarg(0) = sp->sname;
        sp->sclass = EXTERN;
        sp->sflags = sp->slevel = 0;
        return sp;
@@ -93,18 +113,20 @@
 {
 #if defined(ELFABI)
 
-       struct attr *ga;
        NODE *q;
        struct symtab *sp;
        char *c;
 
        if (p->n_sp->sflags & SBEENHERE)
                return p;
+#ifdef GCC_COMPAT
+       struct attr *ga;
        if ((ga = attr_find(p->n_sp->sap, GCC_ATYP_VISIBILITY)) &&
            strcmp(ga->sarg(0), "hidden") == 0)
                return p; /* no GOT reference */
+#endif
 
-       c = p->n_sp->soname ? p->n_sp->soname : exname(p->n_sp->sname);
+       c = getexname(p->n_sp);
        sp = picsymtab("", c, "@GOTPCREL");
        sp->sflags |= SBEENHERE;
        q = block(NAME, NIL, NIL, INCREF(p->n_type), p->n_df, p->n_ap);
@@ -141,7 +163,7 @@
        int len = strlen(s1) + strlen(s2) + strlen(s3) + 1;
        char *sd;
 
-       sd = inlalloc(len);



Home | Main Index | Thread Index | Old Index