Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.47
 
1.48
 
MAIN:ragge:20030825110855
 
reader.c
_>304304          */
 305305         again:
 306306 
<>307 -        if (p->n_op == FREE)
 308 -                cerror("order");        /* whole tree was done */
309307         cookie = cook;
 310308         rcount();
 311309         canon(p);
     
 !
329327 
 330328         switch (m = p->n_op) {
 331329 
<> 330+        case PLUS:
  331+                /*
  332+                 * Be sure that both sides are addressable.
  333+                 */
  334+                if (!canaddr(p->n_left))
  335+                        order(p->n_left, INTAREG|INTBREG);
  336+                if (!canaddr(p->n_right))
  337+                        order(p->n_right, INTAREG|INTBREG);
  338+
  339+                /*
  340+                 * If any of the leaves are already in a temp reg,
  341+                 * try to add to it.
  342+                 */
  343+                if (istnode(p->n_left))
  344+                        if ((m = nmatch(p, NDLEFT)) == MDONE)
  345+                                goto cleanup;
  346+                if (istnode(p->n_right))
  347+                        if ((m = nmatch(p, NDRIGHT)) == MDONE)
  348+                                goto cleanup;
  349+
  350+                /*
  351+                 * None of the leaves are in a temp register, try to find
  352+                 * a matching instruction that ends in a register.
  353+                 */
  354+                if ((m = nmatch(p, 0)) == MDONE)
  355+                        goto cleanup;
  356+                /*
  357+                 * Search for a match if any of the leaves are put
  358+                 * in a register.  Use the dynamic programming
  359+                 * algorithm?
  360+                 * This can be made much more efficient.
  361+                 */
  362+                if (chkmatch(p, STAREG|STBREG, SANY, NDLEFT) == MDONE) {
  363+                        /* offstar? */
  364+                        order(p->n_left, INTAREG|INTBREG);
  365+                        goto again;
  366+                }
  367+                if (chkmatch(p, SANY, STAREG|STBREG, NDRIGHT) == MDONE) {
  368+                        /* offstar? */
  369+                        order(p->n_right, INTAREG|INTBREG);
  370+                        goto again;
  371+                }
  372+                cerror("add failed");
  373+                goto nomat;
332374         default:
 333375 #ifdef notyet
 334376                 if ((cookie & (INTAREG|INTBREG)) && optype(m) == LTYPE) {
     
 !
771813 
 772814                 if( !rewfld(p) ) return 0;
 773815 
<>774 -                ty = (szty(p->n_type) == 2)? LONG: INT;
  816+                ty = (szty(p->n_type) == 2)? LONG: INT; /* XXXX */
775817                 v = p->n_rval;
 776818                 s = UPKFSZ(v);
 777819 # ifdef RTOLBYTES
     
 !
850892 }
 851893 
 852894 /*
<> 895+ * for pointer/integer arithmetic, set pointer at left node
  896+ */
  897+static void
  898+setleft(NODE *p)         
  899+{       
  900+        NODE *q;
  901+
  902+        /* only additions for now */
  903+        if (p->n_op != PLUS)
  904+                return;
  905+        if (ISPTR(p->n_right->n_type) && !ISPTR(p->n_left->n_type)) {
  906+                q = p->n_right;
  907+                p->n_right = p->n_left;
  908+                p->n_left = q;
  909+        }
  910+}
  911+
  912+/*
853913  * look for situations where we can turn * into OREG
 854914  */
 855915 void
     
 !
924984         /* put p in canonical form */
 925985 
 926986 #ifndef FIELDOPS
<>927 -        fwalk( p, ffld, 0 ); /* look for field operators */
  987+        fwalk(p, ffld, 0);      /* look for field operators */
928988 # endif
<>929 -        walkf( p, oreg2 );  /* look for and create OREG nodes */
  989+        walkf(p, setleft);      /* ptrs at left node for arithmetic */
  990+        walkf(p, oreg2);        /* look for and create OREG nodes */
930991 #ifdef MYCANON
<>931 -        MYCANON(p);  /* your own canonicalization routine(s) */
  992+        MYCANON(p);             /* your own canonicalization routine(s) */
932993 #endif
<>933 -        walkf( p, sucomp );  /* do the Sethi-Ullman computation */
  994+        walkf(p, sucomp);       /* do the Sethi-Ullman computation */
<_934995 
 935996 }
 936997 
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-08-28 17:08 +0200