Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.1
 
1.2
 
MAIN:ragge:20020325225236
 
reader.c
_>1 -#ifndef lint
  1+#if 0
22 static char *sccsid ="@(#)reader.c      4.8 (Berkeley) 12/10/87";
<>3 -#endif lint
  3+#endif
44 
 55 # include "pass2.h"
 66 
     
 !
3636 OFFSZ baseoff = 0;
 3737 OFFSZ maxtemp = 0;
 3838 
<>39 -p2init( argc, argv ) char *argv[];{
  39+int
  40+p2init(int argc, char *argv[])
  41+{
4042         /* set the values of the pass 2 arguments */
 4143 
<>42 -        register int c;
 43 -        register char *cp;
 44 -        register files;
  44+        int c;
  45+        char *cp;
  46+        int files;
4547 
 4648         allo0();  /* free all regs */
 4749         files = 0;
     
 !
120122         setrew();
 121123         return( files );
 122124 
<>123 -        }
  125+}
124126 
 125127 # ifndef NOMAIN
 126128 
     
 !
224226 
 225227 # ifdef ONEPASS
 226228 
<>227 -p2compile( p ) NODE *p; {
  229+void
  230+p2compile(NODE *p)
  231+{
228232 
 229233         if( lflag ) lineid( lineno, filename );
 230234         tmpoff = baseoff/* expression at top level reuses temps */
     
 !
242246         allchk();
 243247         /* can't do tcheck here; some stuff (e.g., attributes) may be around from first pass */
 244248         /* first pass will do it... */
<>245 -        }
  249+}
246250 
<>247 -p2bbeg( aoff, myreg ) {
  251+void
  252+p2bbeg(int aoff, int myreg)
  253+{
248254         static int myftn = -1;
 249255 
 250256         tmpoff = baseoff = (unsigned int) aoff;
     
 !
259265                 /* maxoff at end of ftn is max of autos and temps over all blocks */
 260266                 }
 261267         setregs();
<>262 -        }
  268+}
263269 
<>264 -p2bend(){
  270+void
  271+p2bend()
  272+{
265273         SETOFF( maxoff, ALSTACK );
 266274         eobl2();
<>267 -        }
  275+}
268276 
 269277 # endif
 270278 
 271279 NODE *deltrees[DELAYS];
 272280 int deli;
 273281 
<>274 -delay( p ) register NODE *p; {
 275 -        /* look in all legal places for COMOP's and ++ and -- ops to delay */
 276 -        /* note; don't delay ++ and -- within calls or things like
 277 -        /* getchar (in their macro forms) will start behaving strangely */
 278 -        register i;
  282+/*
  283+ * look in all legal places for COMOP's and ++ and -- ops to delay
  284+ * note; don't delay ++ and -- within calls or things like
  285+ * getchar (in their macro forms) will start behaving strangely
  286+ */
  287+void
  288+delay(NODE *p)
  289+{
  290+        int i;
279291 
 280292         /* look for visible COMOPS, and rewrite repeatedly */
 281293 
<>282 -        while( delay1( p ) ) { /* VOID */ }
  294+        while (delay1(p))
  295+                ;
283296 
 284297         /* look for visible, delayable ++ and -- */
 285298 
 286299         deli = 0;
 287300         delay2( p );
 288301         codgen( p, FOREFF );  /* do what is left */
<>289 -        for( i = 0; i<deli; ++i ) codgen( deltrees[i], FOREFF );  /* do the rest */
 290 -        }
  302+        for( i = 0; i<deli; ++i )
  303+                codgen( deltrees[i], FOREFF );  /* do the rest */
  304+}
291305 
<>292 -delay1( p ) register NODE *p; {  /* look for COMOPS */
 293 -        register o, ty;
  306+/*
  307+ * look for COMOPS
  308+ */
  309+int
  310+delay1(NODE *p)
  311+{
  312+        int o, ty;
294313 
 295314         o = p->in.op;
 296315         ty = optype( o );
     
 !
314333                         q->in.op = FREE;
 315334                         }
 316335                 return( 1 );
<>317 -                }
  336+        }
318337 
 319338         return( delay1(p->in.left) || delay1(p->in.right ) );
<>320 -        }
  339+}
321340 
<>322 -delay2( p ) register NODE *p; {
  341+void
  342+delay2(NODE *p)
  343+{
323344 
 324345         /* look for delayable ++ and -- operators */
 325346 
<>326 -        register o, ty;
  347+        int o, ty;
327348         o = p->in.op;
 328349         ty = optype( o );
 329350 
     
 !
342363         case COMOP:
 343364         case CBRANCH:
 344365                 /* for the moment, don't delay past a conditional context, or
<>345 -                /* inside of a call */
  366+                 * inside of a call */
346367                 return;
 347368 
 348369         case UNARY MUL:
     
 !
368389 
 369390         if( ty == BITYPE ) delay2( p->in.right );
 370391         if( ty != LTYPE ) delay2( p->in.left );
<>371 -        }
  392+}
372393 
<>373 -codgen( p, cookie ) NODE *p; {
  394+/*
  395+ * generate the code for p;
  396+ * order may call codgen recursively
  397+ * cookie is used to describe the context
  398+ */
  399+void
  400+codgen(NODE *p, int cookie)
  401+{
374402 
<>375 -        /* generate the code for p;
 376 -           order may call codgen recursively */
 377 -        /* cookie is used to describe the context */
 378 -
379403         for(;;){
 380404                 canon(p);  /* creats OREG from * if possible and does sucomp */
 381405                 stotree = NIL;
     
 !
391415                 /* because it's minimal, can do w.o. stores */
 392416 
 393417                 order( stotree, stocook );
<>394 -                }
 395 -
  418+        }
396419         order( p, cookie );
<> 420+}
397421 
<>398 -        }
 399 -
400422 # ifndef BUG4
 401423 char *cnames[] = {
 402424         "SANY",
     
 !
425447         0,
 426448         };
 427449 
<>428 -prcook( cookie ){
 429 -
 430 -        /* print a nice-looking description of cookie */
 431 -
  450+/*
  451+ * print a nice-looking description of cookie
  452+ */
  453+void
  454+prcook(int cookie)
  455+{
432456         int i, flag;
 433457 
 434458         if( cookie & SPECIAL ){
     
 !
451475                         }
 452476                 }
 453477 
<>454 -        }
  478+}
455479 # endif
 456480 
 457481 int odebug = 0;
 458482 
<>459 -order(p,cook) register NODE *p; {
 460 -
 461 -        register o, ty, m;
  483+void
  484+order(NODE *p, int cook)
  485+{
  486+        int o, ty, m;
462487         int m1;
 463488         int cookie;
<>464 -        register NODE *p1, *p2;
  489+        NODE *p1, *p2;
465490 
 466491         cookie = cook;
 467492         rcount();
     
 !
491516         first:
 492517 # ifndef BUG4
 493518         if( odebug ){
<>494 -                printf( "order( %o, ", p );
  519+                printf( "order( %p, ", p );
495520                 prcook( cookie );
 496521                 printf( " )\n" );
 497522                 fwalk( p, eprint, 0 );
     
 !
545570         
 546571 # ifndef BUG4
 547572         if( odebug ){
<>548 -                printf( "order( %o, ", p );
  573+                printf( "order( %p, ", p );
549574                 prcook( cook );
 550575                 printf( " ), cookie " );
 551576                 prcook( cookie );
     
 !
649674                 goto cleanup;
 650675 
 651676                 /* if arguments are passed in register, care must be taken that reclaim
<>652 -                /* not throw away the register which now has the result... */
  677+                 * not throw away the register which now has the result... */
653678 
 654679         case UNARY MUL:
 655680                 if( cook == FOREFF ){
     
 !
770795 int callflag;
 771796 int fregs;
 772797 
<>773 -store( p ) register NODE *p; {
  798+void
  799+store( p ) NODE *p; {
774800 
 775801         /* find a subtree of p which should be stored */
 776802 
<>777 -        register o, ty;
  803+        int o, ty;
778804 
 779805         o = p->in.op;
 780806         ty = optype(o);
     
 !
835861         store( p->in.left );
 836862         }
 837863 
<>838 -constore( p ) register NODE *p; {
 839 -
 840 -        /* store conditional expressions */
 841 -        /* the point is, avoid storing expressions in conditional
 842 -           conditional context, since the evaluation order is predetermined */
 843 -
  864+/*
  865+ * store conditional expressions
  866+ * the point is, avoid storing expressions in conditional
  867+ * conditional context, since the evaluation order is predetermined
  868+ */
  869+void
  870+constore(NODE *p)
  871+{
844872         switch( p->in.op ) {
 845873 
 846874         case ANDAND:
     
 !
854882                 }
 855883 
 856884         store( p );
<>857 -        }
  885+}
858886 
<>859 -markcall( p ) register NODE *p; {  /* mark off calls below the current node */
  887+/* mark off calls below the current node */
  888+void
  889+markcall(NODE *p)
  890+{
860891 
 861892         again:
 862893         switch( p->in.op ){
     
 !
884915                 return;
 885916                 }
 886917 
<>887 -        }
  918+}
888919 
<>889 -stoarg( p, calltype ) register NODE *p; {
  920+void
  921+stoarg(NODE *p, int calltype)
  922+{
890923         /* arrange to store the args */
<>891 -
892924         if( p->in.op == CM ){
 893925                 stoarg( p->in.left, calltype );
 894926                 p = p->in.right ;
     
 !
908940         if( callflag ){ /* prevent two calls from being active at once  */
 909941                 SETSTO(p,INTEMP);
 910942                 store(p); /* do again to preserve bottom up nature....  */
<>911 -                }
 912 -#endif
913943         }
<> 944+#endif
  945+}
914946 
 915947 int negrel[] = { NE, EQ, GT, GE, LT, LE, UGT, UGE, ULT, ULE } ;  /* negatives of relationals */
 916948 
<>917 -cbranch( p, true, false ) NODE *p; {
 918 -        /* evaluate p for truth value, and branch to true or false
 919 -        /* accordingly: label <0 means fall through */
  949+/*
  950+ * evaluate p for truth value, and branch to true or false
  951+ * accordingly: label <0 means fall through
  952+ */
920953 
<>921 -        register o, lab, flab, tlab;
  954+void
  955+cbranch(NODE *p, int true, int false)
  956+{
  957+        int o, lab, flab, tlab;
922958 
 923959         lab = -1;
 924960 
     
 !
10451081 
 10461082         }
 10471083 
<>1048 -rcount(){ /* count recursions */
  1084+void
  1085+rcount()
  1086+{ /* count recursions */
10491087         if( ++nrecur > NRECUR ){
 10501088                 cerror( "expression causes compiler loop: try simplifying" );
<>1051 -                }
 1052 -
10531089         }
<> 1090+}
10541091 
 10551092 # ifndef BUG4
<>1056 -eprint( p, down, a, b ) NODE *p; int *a, *b; {
  1093+int
  1094+eprint(NODE *p, int down, int *a, int *b)
  1095+{
10571096 
 10581097         *a = *b = down+1;
 10591098         while( down >= 2 ){
     
 !
10631102         if( down-- ) printf( "    " );
 10641103 
 10651104 
<>1066 -        printf( "%o) %s", p, opst[p->in.op] );
  1105+        printf( "%p) %s", p, opst[p->in.op] );
10671106         switch( p->in.op ) { /* special cases */
 10681107 
 10691108         case REG:
     
 !
10961135                 printf( "%s", rnames[p->in.rall&~MUSTDO]);
 10971136                 }
 10981137         printf( ", SU= %d\n", p->in.su );
<>1099 -
 1100 -        }
  1138+        return 0;
  1139+}
11011140 # endif
 11021141 
 11031142 # ifndef NOMAIN
 11041143 NODE *
<>1105 -eread(){
  1144+eread()
  1145+{
11061146 
 11071147         /* call eread recursively to get subtrees, if any */
 11081148 
     
 !
12601300         }
 12611301 #endif
 12621302 
<>1263 -oreg2( p ) register NODE *p; {
 1264 -
  1303+void
  1304+oreg2(NODE *p)
  1305+{
12651306         /* look for situations where we can turn * into OREG */
 12661307 
 12671308         NODE *q;
<>1268 -        register i;
 1269 -        register r;
 1270 -        register char *cp;
 1271 -        register NODE *ql, *qr;
  1309+        int i;
  1310+        int r;
  1311+        char *cp;
  1312+        NODE *ql, *qr;
12721313         CONSZ temp;
 12731314 
 12741315         if( p->in.op == UNARY MUL ){
     
 !
13291370 
 13301371         }
 13311372 
<> 1373+void
13321374 canon(p) NODE *p; {
 13331375         /* put p in canonical form */
<>1334 -        int oreg2(), sucomp();
13351376 
 13361377 #ifndef FIELDOPS
 13371378         int ffld();
     
 !
13431384 #endif
 13441385         walkf( p, sucomp );  /* do the Sethi-Ullman computation */
 13451386 
<>1346 -        }
  1387+}
<_13471388 
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-07-11 10:02 +0200