Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.178
 
1.179
 
MAIN:ragge:20060401131915
 
reader.c
_>588588                 break;
 589589 
 590590         case UMUL: /* May turn into an OREG */
<> 591+                rv = findumul(p, cookie);
  592+                break;
  593+
591594         case REG:
 592595         case TEMP:
 593596         case NAME:
     
 !
10641067 /*
 10651068  * look for situations where we can turn * into OREG
 10661069  */
<>1067 -void
 1068 -oreg2(NODE *p)
  1070+int
  1071+oregok(NODE *p, int *r, CONSZ *temp, char **cp)
10691072 {
 10701073 
 10711074         NODE *q;
<>1072 -        int r;
 1073 -        char *cp;
10741075         NODE *ql, *qr;
<>1075 -        CONSZ temp;
10761076 
<>1077 -        if (p->n_op == UMUL) {
 1078 -                q = p->n_left;
 1079 -                if (q->n_op == REG && q->n_rval == DECRA(q->n_reg, 0)) {
 1080 -                        temp = q->n_lval;
 1081 -                        r = q->n_rval;
 1082 -                        cp = q->n_name;
 1083 -                        goto ormake;
 1084 -                }
  1077+        q = p->n_left;
  1078+        if (q->n_op == REG && q->n_rval == DECRA(q->n_reg, 0)) {
  1079+                *temp = q->n_lval;
  1080+                *r = q->n_rval;
  1081+                *cp = q->n_name;
  1082+                goto ormake;
  1083+        }
10851084 
<>1086 -                if (q->n_op != PLUS && q->n_op != MINUS)
 1087 -                        return;
 1088 -                ql = q->n_left;
 1089 -                qr = q->n_right;
  1085+        if (q->n_op != PLUS && q->n_op != MINUS)
  1086+                return 0;
  1087+        ql = q->n_left;
  1088+        qr = q->n_right;
10901089 
 10911090 #ifdef R2REGS
 10921091 
<>1093 -                /* look for doubly indexed expressions */
  1092+        /* look for doubly indexed expressions */
  1093+        /* XXX - fix checks */
10941094 
<>1095 -                if( q->n_op == PLUS) {
 1096 -                        int i;
 1097 -                        if( (r=base(ql))>=0 && (i=offset(qr, tlen(p)))>=0) {
 1098 -                                makeor2(p, ql, r, i);
 1099 -                                return;
 1100 -                        } else if((r=base(qr))>=0 && (i=offset(ql, tlen(p)))>=0) {
 1101 -                                makeor2(p, qr, r, i);
 1102 -                                return;
 1103 -                        }
  1095+        if( q->n_op == PLUS) {
  1096+                int i;
  1097+                if( (r=base(ql))>=0 && (i=offset(qr, tlen(p)))>=0) {
  1098+                        makeor2(p, ql, r, i);
  1099+                        return;
  1100+                } else if((r=base(qr))>=0 && (i=offset(ql, tlen(p)))>=0) {
  1101+                        makeor2(p, qr, r, i);
  1102+                        return;
11041103                 }
<> 1104+        }
11051105 
 11061106 
 11071107 #endif
 11081108 
<>1109 -                if( (q->n_op==PLUS || q->n_op==MINUS) && qr->n_op == ICON &&
 1110 -                                ql->n_op==REG && szty(qr->n_type)==1 &&
 1111 -                                (ql->n_rval == DECRA(ql->n_reg, 0) ||
 1112 -                                /* XXX */
 1113 -                                 ql->n_rval == FPREG || ql->n_rval == STKREG)) {
 1114 -                        temp = qr->n_lval;
 1115 -                        if( q->n_op == MINUS ) temp = -temp;
 1116 -                        r = ql->n_rval;
 1117 -                        temp += ql->n_lval;
 1118 -                        cp = qr->n_name;
 1119 -                        if( *cp && ( q->n_op == MINUS || *ql->n_name ) ) return;
 1120 -                        if( !*cp ) cp = ql->n_name;
  1109+        if( (q->n_op==PLUS || q->n_op==MINUS) && qr->n_op == ICON &&
  1110+                        ql->n_op==REG && szty(qr->n_type)==1 &&
  1111+                        (ql->n_rval == DECRA(ql->n_reg, 0) ||
  1112+                        /* XXX */
  1113+                         ql->n_rval == FPREG || ql->n_rval == STKREG)) {
  1114+                *temp = qr->n_lval;
  1115+                if( q->n_op == MINUS ) *temp = -*temp;
  1116+                *r = ql->n_rval;
  1117+                *temp += ql->n_lval;
  1118+                *cp = qr->n_name;
  1119+                if( **cp && ( q->n_op == MINUS || *ql->n_name ) )
  1120+                        return 0;
  1121+                if( !**cp ) *cp = ql->n_name;
11211122 
<>1122 -                        ormake:
 1123 -                        if( notoff( p->n_type, r, temp, cp ) ) return;
 1124 -                        p->n_op = OREG;
 1125 -                        p->n_rval = r;
 1126 -                        p->n_lval = temp;
 1127 -                        p->n_name = cp;
 1128 -                        /* stop gencode traversal */
 1129 -                        if (p->n_su == DOWNL)
 1130 -                                p->n_su = 0;
 1131 -                        else
 1132 -                                p->n_su &= ~(LMASK|RMASK|DORIGHT);
 1133 -                        tfree(q);
 1134 -                        return;
 1135 -                }
  1123+                ormake:
  1124+                if( notoff( p->n_type, *r, *temp, *cp ) == 0)
  1125+                        return 1;
11361126         }
<> 1127+        return 0;
11371128 }
 11381129 
<> 1130+static void
  1131+ormake(NODE *p, int r, CONSZ temp, char *cp)
  1132+{
  1133+        p->n_op = OREG;
  1134+        p->n_rval = r;
  1135+        p->n_lval = temp;
  1136+        p->n_name = cp;
  1137+        /* stop gencode traversal */
  1138+        if (p->n_su == DOWNL)
  1139+                p->n_su = 0;
  1140+        else
  1141+                p->n_su &= ~(LMASK|RMASK|DORIGHT);
  1142+        tfree(p->n_left);
  1143+}
  1144+
  1145+/*
  1146+ * look for situations where we can turn * into OREG
  1147+ */
11391148 void
<> 1149+oreg2(NODE *p)
  1150+{
  1151+        int r;
  1152+        CONSZ temp;
  1153+        char *cp;
  1154+
  1155+        if (p->n_op != UMUL)
  1156+                return;
  1157+        if (oregok(p, &r, &temp, &cp) == 0)
  1158+                return;
  1159+        ormake(p, r, temp, cp);
  1160+}
  1161+
  1162+void
<_11401163 canon(p) NODE *p; {
 11411164         /* put p in canonical form */
 11421165 
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-18 16:27 +0100