Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.90
 
1.91
 
MAIN:ragge:20040510213558
 
reader.c
_>7676 int fregs;
 7777 
 7878 NODE *nodepole;
<>79 -static int saving;
  79+int saving;
8080 
<>81 -static struct templst {
 82 -        struct templst *next;
 83 -        int tempnr;
 84 -        int tempoff;
 85 -} *templst;
 86 -
8781 int e2print(NODE *p, int down, int *a, int *b);
 8882 void saveip(struct interpass *ip);
 8983 void deljumps(void);
     
 !
117111                 cerror("not logop branch");
 118112         if ((dope[p->n_op] & ASGOPFLG) && p->n_op != RETURN)
 119113                 cerror("asgop %d slipped through", p->n_op);
<>120 -        if (p->n_op ==CALL)
  114+        if (p->n_op ==CALL || p->n_op == ADDROF)
121115                 cerror("non-UCALL node");
 122116 }
 123117 #endif
     
 !
332326 static void
 333327 epilogue(int regs, int autos, int retlab)
 334328 {
<>335 -        templst = NULL;
336329         eoftn(regs, autos, retlab);
 337330 }
 338331 
     
 !
881874                 fprintf(stderr, " %s", rnames[p->n_rval] );
 882875                 break;
 883876 
<>884 -        case TEMP:
 885 -                fprintf(stderr," %d", (int)p->n_lval);
 886 -                break;
 887 -
888877         case ICON:
 889878         case NAME:
 890879         case OREG:
     
 !
992981 }
 993982 #endif
 994983 
<>995 -static int
 996 -findtemp(NODE *p)
 997 -{
 998 -        struct templst *w = templst;
 999 -
 1000 -        while (w != NULL) {
 1001 -                if (w->tempnr == p->n_lval)
 1002 -                        break;
 1003 -                w = w->next;
 1004 -        }
 1005 -        if (w == NULL) {
 1006 -                w = tmpalloc(sizeof(struct templst));
 1007 -                w->tempnr = p->n_lval;
 1008 -                w->tempoff = freetemp(szty(p->n_type));
 1009 -                w->next = templst;
 1010 -                templst = w;
 1011 -        }
 1012 -        return w->tempoff;
 1013 -}
 1014 -
1015984 /*
 1016985  * change left TEMPs into OREGs
 1017986  */
     
 !
10321001                 r->n_name = "";
 10331002                 r->n_lval = l->n_lval;
 10341003                 r->n_type = INT;
<>1035 -                return;
10361004         }
<>1037 -        if (p->n_op != TEMP)
 1038 -                return;
 1039 -        /*
 1040 -         * the size of a TEMP is in multiples of the reg size.
 1041 -         */
 1042 -        p->n_op = OREG;
 1043 -        p->n_rval = FPREG;
 1044 -        p->n_lval = findtemp(p);
 1045 -        p->n_name = "";
10461005 }
 10471006 
 10481007 /*
     
 !
11481107 
 11491108 }
 11501109 
<>1151 -static SIMPLEQ_HEAD(, interpass) ipole = SIMPLEQ_HEAD_INITIALIZER(ipole);
 1152 -
 1153 -void
 1154 -saveip(struct interpass *ip)
 1155 -{
 1156 -        struct interpass *prol;
 1157 -
 1158 -        SIMPLEQ_INSERT_TAIL(&ipole, ip, sqelem);
 1159 -
 1160 -        if (ip->type != IP_EPILOG)
 1161 -                return;
 1162 -        saving = -1;
 1163 -
 1164 -        cvtemps(ip);    /* Convert TEMPs to OREGs */
 1165 -        deljumps();     /* Delete redundant jumps and dead code */
 1166 -
 1167 -        prol = SIMPLEQ_FIRST(&ipole);
 1168 -        prol->ip_auto = ip->ip_auto;
 1169 -        prol->ip_regs = ip->ip_regs;
 1170 -
 1171 -#ifdef MYOPTIM
 1172 -        myoptim(prol);
 1173 -#endif
 1174 -
 1175 -        while ((ip = SIMPLEQ_FIRST(&ipole))) {
 1176 -                SIMPLEQ_REMOVE_HEAD(&ipole, sqelem);
 1177 -                pass2_compile(ip);
 1178 -        }
 1179 -}
 1180 -
11811110 /*
<>1182 - * Convert TEMPs to OREGs.
 1183 - * XXX - ugly.
 1184 - */
 1185 -void
 1186 -cvtemps(struct interpass *epil)
 1187 -{
 1188 -        struct interpass *ip;
 1189 -
 1190 -        SETOFF(epil->ip_auto, ALINT);
 1191 -        maxautooff = autooff = epil->ip_auto;
 1192 -        SIMPLEQ_FOREACH(ip, &ipole, sqelem) {
 1193 -                if (ip->type != IP_NODE)
 1194 -                        continue;
 1195 -                walkf(ip->ip_node, deltemp);
 1196 -        }
 1197 -        epil->ip_auto = maxautooff;
 1198 -}
 1199 -
 1200 -void
 1201 -deljumps()
 1202 -{
 1203 -        struct interpass *ip, *n;
 1204 -        int gotone;
 1205 -
 1206 -again:  gotone = 0;
 1207 -
 1208 -        SIMPLEQ_FOREACH(ip, &ipole, sqelem) {
 1209 -                if (ip->type == IP_EPILOG)
 1210 -                        return;
 1211 -                if (ip->type != IP_NODE)
 1212 -                        continue;
 1213 -                n = ip->sqelem.sqe_next;
 1214 -                /* Check for nodes without side effects */
 1215 -                if (ip->ip_node->n_op != GOTO)
 1216 -                        continue;
 1217 -                switch (n->type) {
 1218 -                case IP_NODE:
 1219 -                        tfree(n->ip_node);
 1220 -                        ip->sqelem.sqe_next = n->sqelem.sqe_next;
 1221 -                        break;
 1222 -                case IP_DEFLAB:
 1223 -                        if (ip->ip_node->n_left->n_lval != n->ip_lbl)
 1224 -                                continue;
 1225 -                        tfree(ip->ip_node);
 1226 -                        *ip = *n;
 1227 -                        break;
 1228 -                default:
 1229 -                        continue;
 1230 -                }
 1231 -                gotone = 1;
 1232 -        }
 1233 -        if (gotone)
 1234 -                goto again;
 1235 -}
 1236 -
 1237 -void
 1238 -optdump(struct interpass *ip)
 1239 -{
 1240 -        static char *nm[] = { "node", "prolog", "newblk", "epilog", "locctr",
 1241 -                "deflab", "defnam", "asm" };
 1242 -        printf("type %s\n", nm[ip->type-1]);
 1243 -        switch (ip->type) {
 1244 -        case IP_NODE:
 1245 -                fwalk(ip->ip_node, e2print, 0);
 1246 -                break;
 1247 -        case IP_DEFLAB:
 1248 -                printf("label " LABFMT "\n", ip->ip_lbl);
 1249 -                break;
 1250 -        case IP_ASM:
 1251 -                printf(": %s\n", ip->ip_asm);
 1252 -                break;
 1253 -        }
 1254 -}
 1255 -
 1256 -/*
<_12571111  * Find the best ops for a given tree.
 12581112  * Different instruction sequences are graded as:
 12591113         add2 reg,reg     = 0
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-09-22 22:19 +0200