Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.20
 
1.21
 
MAIN:ragge:20050227083110
 
optim.c
_>4747 
 4848 int oflag = 0;
 4949 
<> 50+/* remove left node */
  51+static NODE *
  52+zapleft(NODE *p)
  53+{
  54+        NODE *q;
  55+
  56+        q = p->n_left;
  57+        nfree(p->n_right);
  58+        nfree(p);
  59+        return q;
  60+}
  61+
5062 /*
 5163  * fortran function arguments
 5264  */
     
 !
8294 
 8395         if( (t=BTYPE(p->n_type))==ENUMTY || t==MOETY ) econvert(p);
 8496         if( oflag ) return(p);
<>85 -        ty = coptype(o = p->n_op);
  97+
  98+        ty = coptype(p->n_op);
8699         if( ty == LTYPE ) return(p);
 87100 
 88101         if( ty == BITYPE ) p->n_right = optim(p->n_right);
 89102         p->n_left = optim(p->n_left);
 90103 
 91104         /* collect constants */
<>92 -
  105+again:  o = p->n_op;
93106         switch(o){
 94107 
 95108         case SCONV:
     
 !
123136                 LO(p) = NAME;
 124137                 goto setuleft;
 125138 
<> 139+        case RS:
  140+                if (LO(p) == RS && RCON(p->n_left) && RCON(p)) {
  141+                        /* two right-shift  by constants */
  142+                        RV(p) += RV(p->n_left);
  143+                        p->n_left = zapleft(p->n_left);
  144+                } else if (LO(p) == LS && RCON(p->n_left) && RCON(p)) {
  145+                        RV(p) -= RV(p->n_left);
  146+                        if (RV(p) < 0)
  147+                                o = p->n_op = LS, RV(p) = -RV(p);
  148+                        p->n_left = zapleft(p->n_left);
  149+                }
  150+                if (RV(p) < 0) {
  151+                        RV(p) = -RV(p);
  152+                        p->n_op = LS;
  153+                        goto again;
  154+                }
  155+                if (RV(p) >= tsize(p->n_type, p->n_df, p->n_sue) &&
  156+                    ISUNSIGNED(p->n_type)) { /* ignore signed right shifts */
  157+                        /* too many shifts */
  158+                        tfree(p->n_left);
  159+                        nfree(p->n_right);
  160+                        p->n_op = ICON; p->n_lval = 0; p->n_sp = NULL;
  161+                } else if (RV(p) == 0)
  162+                        p = zapleft(p);
  163+                break;
  164+
  165+        case LS:
  166+                if (LO(p) == LS && RCON(p->n_left) && RCON(p)) {
  167+                        /* two left-shift  by constants */
  168+                        RV(p) += RV(p->n_left);
  169+                        p->n_left = zapleft(p->n_left);
  170+                } else if (LO(p) == RS && RCON(p->n_left) && RCON(p)) {
  171+                        RV(p) -= RV(p->n_left);
  172+                        p->n_left = zapleft(p->n_left);
  173+                }
  174+                if (RV(p) < 0) {
  175+                        RV(p) = -RV(p);
  176+                        p->n_op = RS;
  177+                        goto again;
  178+                }
  179+                if (RV(p) >= tsize(p->n_type, p->n_df, p->n_sue)) {
  180+                        /* too many shifts */
  181+                        tfree(p->n_left);
  182+                        nfree(p->n_right);
  183+                        p->n_op = ICON; p->n_lval = 0; p->n_sp = NULL;
  184+                } else if (RV(p) == 0
  185+                        p = zapleft(p);
  186+                break;
  187+
<_126188         case MINUS:
 127189                 if (LCON(p) && RCON(p) && p->n_left->n_sp == p->n_right->n_sp) {
 128190                         /* link-time constants, but both are the same */
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 00:55 +0200