changes to merge f2 and c2. Added -f flag to act as f2.
[unix-history] / usr / src / old / pcc / c2.vax / c20.c
index bd799c1..eef1a77 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)c20.c      4.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)c20.c      4.8 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -12,6 +12,7 @@ static        char sccsid[] = "@(#)c20.c      4.6 (Berkeley) %G%";
 
 char _sibuf[BUFSIZ], _sobuf[BUFSIZ];
 int ioflag;
 
 char _sibuf[BUFSIZ], _sobuf[BUFSIZ];
 int ioflag;
+int fflag;
 long   isn     = 2000000;
 struct optab *oplook();
 struct optab *getline();
 long   isn     = 2000000;
 struct optab *oplook();
 struct optab *getline();
@@ -49,20 +50,23 @@ char **argv;
        while (argc>0) {/* get flags */
                if (**argv=='+') debug++;
                else if (**argv=='-') {
        while (argc>0) {/* get flags */
                if (**argv=='+') debug++;
                else if (**argv=='-') {
-                       if ((*argv)[1]=='i') ioflag++; else nflag++;
+                       if ((*argv)[1]=='i') ioflag++;
+                       else if ((*argv)[1]=='f') fflag++;
+                       else nflag++;
                } else if (infound==0) {
                        if (freopen(*argv, "r", stdin) ==NULL) {
                                fprintf(stderr,"C2: can't find %s\n", *argv);
                                exit(1);
                        }
                } else if (infound==0) {
                        if (freopen(*argv, "r", stdin) ==NULL) {
                                fprintf(stderr,"C2: can't find %s\n", *argv);
                                exit(1);
                        }
-                       setbuf(stdin,_sibuf); ++infound;
+                       ++infound;
                } else if (freopen(*argv, "w", stdout) ==NULL) {
                        fprintf(stderr,"C2: can't create %s\n", *argv);
                        exit(1);
                }
                } else if (freopen(*argv, "w", stdout) ==NULL) {
                        fprintf(stderr,"C2: can't create %s\n", *argv);
                        exit(1);
                }
-               setbuf(stdout,_sobuf);
                argc--; argv++;
        }
                argc--; argv++;
        }
+       setbuf(stdin, _sibuf);
+       setbuf(stdout, _sobuf);
        lasta = lastr = sbrk(2);
        opsetup();
        lasta = firstr = lastr = alloc(0);
        lasta = lastr = sbrk(2);
        opsetup();
        lasta = firstr = lastr = alloc(0);
@@ -332,6 +336,26 @@ output()
                if (casebas==0) printf("L%d:\n",casebas=isn++);
                printf(".word   L%d-L%d\n", t->labno, casebas);
                continue;
                if (casebas==0) printf("L%d:\n",casebas=isn++);
                printf(".word   L%d-L%d\n", t->labno, casebas);
                continue;
+       case MOV:
+               if (!fflag) goto std;
+               if (t->forw) if(t->forw->op == CBR) goto std;
+               if (*t->code == '$') goto std;
+               if (t->subop == FFLOAT)
+                       {
+                       printf("movl\t%s\n", t->code);
+                       continue;
+                       }
+               if (t->subop == DFLOAT || t->subop == GFLOAT)
+                       {
+                       printf("movq\t%s\n", t->code);
+                       continue;
+                       }
+               if (t->subop == HFLOAT)
+                       {
+                       printf("movo\t%s\n", t->code);
+                       continue;
+                       }
+               goto std;
 
        }
 }
 
        }
 }