1st working version (mostly)
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Mon, 6 Jan 1986 10:50:04 +0000 (02:50 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Mon, 6 Jan 1986 10:50:04 +0000 (02:50 -0800)
SCCS-vsn: sys/tahoe/inline/langpats.c 1.2
SCCS-vsn: sys/tahoe/inline/libcpats.c 1.2
SCCS-vsn: sys/tahoe/inline/machdep.c 1.2
SCCS-vsn: sys/tahoe/inline/machpats.c 1.2
SCCS-vsn: sys/tahoe/inline/main.c 1.2

usr/src/sys/tahoe/inline/langpats.c
usr/src/sys/tahoe/inline/libcpats.c
usr/src/sys/tahoe/inline/machdep.c
usr/src/sys/tahoe/inline/machpats.c
usr/src/sys/tahoe/inline/main.c

index 1e3c0c5..63bf289 100644 (file)
@@ -5,8 +5,8 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)langpats.c 2.9 (Berkeley) 6/8/85";
-#endif not lint
+static char sccsid[] = "@(#)langpats.c 1.2 (Berkeley) %G%";
+#endif
 
 #include "inline.h"
 
 
 #include "inline.h"
 
@@ -16,7 +16,7 @@ static char sccsid[] = "@(#)langpats.c        2.9 (Berkeley) 6/8/85";
  */
 struct pats language_ptab[] = {
 
  */
 struct pats language_ptab[] = {
 
-#ifdef vax
+#if defined(vax)
        { "0,_spl0\n",
 "      mfpr    $18,r0\n\
        mtpr    $0,$18\n" },
        { "0,_spl0\n",
 "      mfpr    $18,r0\n\
        mtpr    $0,$18\n" },
@@ -247,11 +247,162 @@ struct pats language_ptab[] = {
        bgequ   1f\n\
        movl    r5,r0\n\
 1:\n" },
        bgequ   1f\n\
        movl    r5,r0\n\
 1:\n" },
-#endif vax
+#endif
 
 
-#ifdef mc68000
+#if defined(tahoe)
+       { "4,_spl0\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0,$8\n" },
+
+       { "4,_spl1\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0x11,$8\n" },
+
+       { "4,_spl3\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0x13,$8\n" },
+
+       { "4,_spl7\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0x17,$8\n" },
+
+       { "4,_spl8\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0x18,$8\n" },
+
+       { "4,_splimp\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0x18,$8\n" },
+
+       { "4,_splsoftclock\n",
+"      mfpr    $18,r0\n\
+       mtpr    $0x8,$8\n" },
+
+       { "4,_splnet\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0xc,$8\n" },
+
+       { "4,_splbio\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0x18,$8\n" },
+
+       { "4,_spltty\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0x18,$8\n" },
+
+       { "4,_splclock\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0x18,$8\n" },
+
+       { "4,_splhigh\n",
+"      mfpr    $8,r0\n\
+       mtpr    $0x18,$8\n" },
+
+       { "8,_splx\n",
+"      movl    (sp)+,r1\n\
+       mfpr    $8,r0\n\
+       mtpr    r1,$8\n" },
+
+       { "8,_mfpr\n",
+"      movl    (sp)+,r1\n\
+       mfpr    r1,r0\n" },
+
+       { "12,_mtpr\n",
+"      movl    (sp)+,r1\n\
+       movl    (sp)+,r0\n\
+       mtpr    r0,r1\n" },
+
+#ifdef notdef
+       { "8,_uncache\n",
+"      movl    (sp)+,r1\n\
+       mtpr    r1,$0x1c\n" },
+#endif
+
+       { "4,_setsoftclock\n",
+"      mtpr    $0x8,$0x10\n" },
+
+       { "8,_fuibyte\n",
+"      callf   $8,_fubyte\n" },
+
+       { "8,_fuiword\n",
+"      callf   $8,_fuword\n" },
+
+       { "12,_suibyte\n",
+"      callf   $12,_subyte\n" },
+
+       { "12,_suiword\n",
+"      callf   $12,_suword\n" },
+
+       { "8,_setjmp\n",
+"      movl    (sp)+,r1\n\
+       clrl    r0\n\
+       movab   (fp),(r1)\n\
+       addl2   $4,r1\n\
+       movab   1(pc),(r1)\n" },
+
+       { "8,_ffs\n",
+"      movl    (sp)+,r1\n\
+       ffs     r1,r0\n\
+       bgeq    1f\n\
+       mnegl   $1,r0\n\
+1:\n\
+       incl    r0\n" },
+
+       { "12,__insque\n",
+"      movl    (sp)+,r0\n\
+       movl    (sp)+,r1\n\
+       insque  (r0),(r1)\n" },
+
+       { "8,__remque\n",
+"      movl    (sp)+,r1\n\
+       remque  (r1)\n" },
+
+       { "12,_imin\n",
+"      movl    (sp)+,r0\n\
+       movl    (sp)+,r1\n\
+       cmpl    r0,r1\n\
+       bleq    1f\n\
+       movl    r1,r0\n\
+1:\n" },
+
+       { "12,_imax\n",
+"      movl    (sp)+,r0\n\
+       movl    (sp)+,r1\n\
+       cmpl    r0,r1\n\
+       bgeq    1f\n\
+       movl    r1,r0\n\
+1:\n" },
+
+       { "12,_min\n",
+"      movl    (sp)+,r0\n\
+       movl    (sp)+,r1\n\
+       cmpl    r0,r1\n\
+       blequ   1f\n\
+       movl    r1,r0\n\
+1:\n" },
+
+       { "12,_max\n",
+"      movl    (sp)+,r0\n\
+       movl    (sp)+,r1\n\
+       cmpl    r0,r1\n\
+       bgequ   1f\n\
+       movl    r1,r0\n\
+1:\n" },
+
+       { "12,__movow\n",
+"      movl    (sp)+,r1\n\
+       movl    (sp)+,r0\n\
+       movow   r0,(r1)\n" },
+
+       { "12,__movob\n",
+"      movl    (sp)+,r1\n\
+       movl    (sp)+,r0\n\
+       movob   r0,(r1)\n" },
+#endif
+
+#if defined(mc68000)
 /* someday... */
 /* someday... */
-#endif mc68000
+#endif
 
        { "", "" }
 };
 
        { "", "" }
 };
index 194c674..218e0c5 100644 (file)
@@ -5,8 +5,8 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)libcpats.c 1.3 (Berkeley) 6/8/85";
-#endif not lint
+static char sccsid[] = "@(#)libcpats.c 1.2 (Berkeley) %G%";
+#endif
 
 #include "inline.h"
 
 
 #include "inline.h"
 
@@ -15,7 +15,7 @@ static char sccsid[] = "@(#)libcpats.c        1.3 (Berkeley) 6/8/85";
  */
 struct pats libc_ptab[] = {
 
  */
 struct pats libc_ptab[] = {
 
-#ifdef vax
+#if defined(vax)
        { "1,_fgetc\n",
 "      sobgeq  *(sp),1f\n\
        calls   $1,__filbuf\n\
        { "1,_fgetc\n",
 "      sobgeq  *(sp),1f\n\
        calls   $1,__filbuf\n\
@@ -43,11 +43,11 @@ struct pats libc_ptab[] = {
        locc    $0,$65535,(r1)\n\
        jeql    1b\n\
        subl3   r5,r1,r0\n" },
        locc    $0,$65535,(r1)\n\
        jeql    1b\n\
        subl3   r5,r1,r0\n" },
-#endif vax
+#endif
 
 
-#ifdef mc68000
+#if defined(mc68000)
 /* someday... */
 /* someday... */
-#endif mc68000
+#endif
 
        { "", "" }
 };
 
        { "", "" }
 };
index 8857e25..572d258 100644 (file)
@@ -5,8 +5,8 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)machdep.c  1.6 (Berkeley) 6/8/85";
-#endif not lint
+static char sccsid[] = "@(#)machdep.c  1.2 (Berkeley) %G%";
+#endif
 
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -17,7 +17,7 @@ static char sccsid[] = "@(#)machdep.c 1.6 (Berkeley) 6/8/85";
  * for each new machine that this program is ported to.
  */
 
  * for each new machine that this program is ported to.
  */
 
-#ifdef vax
+#if defined(vax)
 /*
  * Instruction stop table.
  * All instructions that implicitly modify any of the temporary
 /*
  * Instruction stop table.
  * All instructions that implicitly modify any of the temporary
@@ -71,7 +71,60 @@ doreplaceon(cp)
                return (cp + 7);
        return (0);
 }
                return (cp + 7);
        return (0);
 }
+#endif
 
 
+#if defined(tahoe)
+/*
+ * Instruction stop table.
+ * All instructions that implicitly modify any of the temporary
+ * registers, change control flow, or implicitly loop must be
+ * listed in this table. It is used to find the end of a basic
+ * block when scanning backwards through the instruction stream
+ * trying to merge the inline expansion.
+ */
+struct inststoptbl inststoptable[] = {
+/* control */
+       { "bbssi" }, { "bcc" }, { "bcs" }, { "beql" }, { "beqlu" },
+       { "bgeq" }, { "bgequ" }, { "bgtr" }, { "bgtru" }, { "bleq" },
+       { "blequ" }, { "blss" }, { "blssu" }, { "bneq" }, { "bnequ" },
+       { "brb" }, { "brw" }, { "bvc" }, { "bvs" }, { "jmp" },
+/* jump versions of control */
+       { "jbc" }, { "jbs" }, { "jeql" }, { "jeqlu" },
+       { "jgeq" }, { "jgequ" }, { "jgtr" }, { "jgtru" }, { "jleq" },
+       { "jlequ" }, { "jlss" }, { "jlssu" }, { "jneq" }, { "jnequ" },
+       { "jcc" }, { "jcs" }, { "jvc" }, { "jvs" }, { "jbr" },
+/* multiple registers */
+       { "loadr" },
+/* bit field */
+       { "bbc" }, { "bbs" },
+/* character string and block move */
+       { "cmps2" }, { "cmps3" }, { "movblk" }, { "movs2" }, { "movs3" },
+/* procedure call */
+       { "callf" }, { "calls" }, { "ret" },
+/* loop control */
+       { "aobleq" }, { "aoblss" }, { "casel" },
+/* privileged and miscellaneous */
+       { "bpt" }, { "halt" }, { "kcall" }, { "ldpctx" }, { "rei" },
+       { "svpctx" },
+       { "" }
+};
+
+/*
+ * Check to see if a line is a candidate for replacement.
+ * Return pointer to name to be looked up in pattern table.
+ */
+char *
+doreplaceon(cp)
+       char *cp;
+{
+
+       if (bcmp(cp, "callf\t$", 7) == 0)
+               return (cp + 7);
+       return (0);
+}
+#endif
+
+#if defined(vax) || defined(tahoe)
 /*
  * Find the next argument to the function being expanded.
  */
 /*
  * Find the next argument to the function being expanded.
  */
@@ -92,7 +145,7 @@ nextarg(argc, argv)
 /*
  * Determine whether the current line pushes an argument.
  */
 /*
  * Determine whether the current line pushes an argument.
  */
- ispusharg(argc, argv)
+ispusharg(argc, argv)
        int argc;
        char *argv[];
 {
        int argc;
        char *argv[];
 {
@@ -114,11 +167,11 @@ modifies(argc, argv)
        int argc;
        char *argv[];
 {
        int argc;
        char *argv[];
 {
-       /*
-        * For the VAX all we care about are r0 to r5
-        */
        register char *lastarg = argv[argc - 1];
 
        register char *lastarg = argv[argc - 1];
 
+       /*
+        * For the VAX or TAHOE all we care about are r0 to r5
+        */
        if (lastarg[0] == 'r' && isdigit(lastarg[1]) && lastarg[2] == '\0')
                return (lastarg[1] - '0');
        return (-1);
        if (lastarg[0] == 'r' && isdigit(lastarg[1]) && lastarg[2] == '\0')
                return (lastarg[1] - '0');
        return (-1);
@@ -186,9 +239,9 @@ cleanup(numargs)
 
        return;
 }
 
        return;
 }
-#endif vax
+#endif
 
 
-#ifdef mc68000
+#if defined(mc68000)
 /*
  * Instruction stop table.
  * All instructions that implicitly modify any of the temporary
 /*
  * Instruction stop table.
  * All instructions that implicitly modify any of the temporary
@@ -356,4 +409,4 @@ cleanup(numargs)
         */
        fgets(line[bufhead], MAXLINELEN, stdin);
 }
         */
        fgets(line[bufhead], MAXLINELEN, stdin);
 }
-#endif mc68000
+#endif
index 217bf76..482c598 100644 (file)
@@ -5,17 +5,17 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)machpats.c 1.4 (Berkeley) 6/8/85";
-#endif not lint
+static char sccsid[] = "@(#)machpats.c 1.2 (Berkeley) %G%";
+#endif
 
 #include "inline.h"
 
 /*
 
 #include "inline.h"
 
 /*
- * Pattern table for special VAX instructions.
+ * Pattern table for special instructions.
  */
 struct pats machine_ptab[] = {
 
  */
 struct pats machine_ptab[] = {
 
-#ifdef vax
+#if defined(vax)
        { "3,_blkcpy\n",
 "      movl    (sp)+,r1\n\
        movl    (sp)+,r3\n\
        { "3,_blkcpy\n",
 "      movl    (sp)+,r1\n\
        movl    (sp)+,r3\n\
@@ -126,11 +126,43 @@ struct pats machine_ptab[] = {
        { "1,_remque\n",
 "      movl    (sp)+,r5\n\
        remque  (r5),r0\n" },
        { "1,_remque\n",
 "      movl    (sp)+,r5\n\
        remque  (r5),r0\n" },
-#endif vax
+#endif
 
 
-#ifdef mc68000
+#if defined(tahoe)
+       { "16,_blkcpy\n",
+"      movl    (sp)+,r0\n\
+       movl    (sp)+,r1\n\
+       movl    (sp)+,r2\n\
+       movblk\n" },
+
+       { "16,_bcopy\n",
+"      movl    (sp)+,r0\n\
+       movl    (sp)+,r1\n\
+       movl    (sp)+,r2\n\
+       movblk\n" },
+
+       { "12,_bzero\n",
+"      movl    (sp)+,r1\n\
+       movl    (sp)+,r2\n\
+       movab   1f,r0\n\
+       movs3\n\
+       .data\n\
+1:     .byte   0\n\
+       .text\n" },
+
+       { "12,_blkclr\n",
+"      movl    (sp)+,r1\n\
+       movl    (sp)+,r2\n\
+       movab   1f,r0\n\
+       movs3\n\
+       .data\n\
+1:     .byte   0\n\
+       .text\n" },
+#endif
+
+#if defined(mc68000)
 /* someday... */
 /* someday... */
-#endif mc68000
+#endif
 
        { "", "" }
 };
 
        { "", "" }
 };
index aa2aba5..e1686b1 100644 (file)
@@ -8,11 +8,11 @@
 char copyright[] =
 "@(#) Copyright (c) 1984 Regents of the University of California.\n\
  All rights reserved.\n";
 char copyright[] =
 "@(#) Copyright (c) 1984 Regents of the University of California.\n\
  All rights reserved.\n";
-#endif not lint
+#endif
 
 #ifndef lint
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     1.8 (Berkeley) 6/8/85";
-#endif not lint
+static char sccsid[] = "@(#)main.c     1.2 (Berkeley) %G%";
+#endif
 
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>