Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.38
 
1.39
 
MAIN:ragge:20050917075840
 
optim2.c
_>5050 void printip(struct interpass *pole);
 5151 
 5252 static struct varinfo defsites;
<>53 -#ifdef OLDSTYLE
 54 -static struct interpass ipole;
 55 -#endif
5653 struct interpass *storesave;
 5754 static struct interpass_prolog *ipp, *epp; /* prolog/epilog */
 5855 
     
 !
138135         }
 139136 }
 140137 
<>141 -#ifdef OLDSTYLE
142138 void
<>143 -saveip(struct interpass *ip)
 144 -{
 145 -        static int inftn;
 146 -
 147 -#if 0
 148 -        int regs;
 149 -#endif
 150 -        struct labelinfo labinfo;
 151 -        struct bblockinfo bbinfo;
 152 -
 153 -        if (ip->type == IP_PROLOG) {
 154 -                DLIST_INIT(&ipole, qelem);
 155 -                inftn = 1;
 156 -        } else if (inftn == 0)
 157 -                comperr("saveip");
 158 -
 159 -        DLIST_INSERT_BEFORE(&ipole, ip, qelem);
 160 -
 161 -        if (ip->type != IP_EPILOG)
 162 -                return;
 163 -        inftn = 0;
 164 -        ipp = (struct interpass_prolog *)DLIST_NEXT(&ipole, qelem);
 165 -        epp = (struct interpass_prolog *)ip;
 166 -
 167 -        if (b2debug) {
 168 -                printf("initial links\n");
 169 -                printip(&ipole);
 170 -        }
 171 -
 172 -        /*
 173 -         * Convert ADDROF TEMP to OREGs.
 174 -         */
 175 -                otlink = NULL;
 176 -                DLIST_FOREACH(ip, &ipole, qelem) {
 177 -                        if (ip->type != IP_NODE)
 178 -                                continue;
 179 -                        walkf(ip->ip_node, findaddrof);
 180 -                }
 181 -                if (otlink) {
 182 -                        DLIST_FOREACH(ip, &ipole, qelem) {
 183 -                                if (ip->type != IP_NODE)
 184 -                                        continue;
 185 -                                walkf(ip->ip_node, cvtaddrof);
 186 -                        }
 187 -                }
 188 -        }
 189 -                
 190 -        if (xdeljumps)
 191 -                deljumps();     /* Delete redundant jumps and dead code */
 192 -
 193 -        if (b2debug) {
 194 -                printf("links after deljumps\n");
 195 -                printip(&ipole);
 196 -        }
 197 -        if (xssaflag) {
 198 -                DLIST_INIT(&bblocks, bbelem);
 199 -                bblocks_build(&labinfo, &bbinfo);
 200 -                BDEBUG(("Calling cfg_build\n"));
 201 -                cfg_build(&labinfo);
 202 -                BDEBUG(("Calling dominators\n"));
 203 -                dominators(&bbinfo);
 204 -                BDEBUG(("Calling computeDF\n"));
 205 -                computeDF(DLIST_NEXT(&bblocks, bbelem), &bbinfo);
 206 -                BDEBUG(("Calling remunreach\n"));
 207 -                remunreach();
 208 -#if 0
 209 -                dfg = dfg_build(cfg);
 210 -                ssa = ssa_build(cfg, dfg);
 211 -#endif
 212 -        }
 213 -
 214 -#ifdef PCC_DEBUG
 215 -        if (epp->ipp_regs != 0)
 216 -                comperr("register error");
 217 -#endif
 218 -
 219 -#ifdef MYOPTIM
 220 -        myoptim((struct interpass *)ipp);
 221 -#endif
 222 -
 223 -if (xnewreg == 0) {
 224 -        int tmpautooff;
 225 -        NODE *p;
 226 -
 227 -        p2autooff = p2maxautooff = AUTOINIT;
 228 -        /* Must verify stack usage first */
 229 -        DLIST_FOREACH(ip, &ipole, qelem) {
 230 -                if (ip->type == IP_STKOFF) {
 231 -                        p2autooff = ip->ip_off;
 232 -                        if (p2autooff > p2maxautooff)
 233 -                                p2maxautooff = p2autooff;
 234 -                }
 235 -        }
 236 -        p2autooff = p2maxautooff; /* don't have live range analysis yet */
 237 -
 238 -        DLIST_FOREACH(ip, &ipole, qelem) {
 239 -                if (ip->type == IPSTK) {
 240 -                        struct interpass *ip3;
 241 -                        p2autooff = ip->ip_off;
 242 -                        ip3 = ip;
 243 -                        ip = DLIST_NEXT(ip, qelem);
 244 -                        DLIST_REMOVE(ip3, qelem);
 245 -                }
 246 -                        
 247 -                if (ip->type != IP_NODE)
 248 -                        continue;
 249 -
 250 -                p = ip->ip_node;
 251 -                walkf(p, deltemp);
 252 -
 253 -                tmpautooff = p2autooff;
 254 -
 255 -                geninsn(p, FOREFF);
 256 -                if (sucomp(p) < 0) {
 257 -                        /* Create STKOFF entry */
 258 -                        struct interpass *ip3;
 259 -                        DLIST_INSERT_BEFORE(ip, storesave, qelem);
 260 -                        ip3 = ipnode(NULL);
 261 -                        ip3->type = IPSTK;
 262 -                        ip3->ip_off = tmpautooff;
 263 -                        DLIST_INSERT_AFTER(ip, ip3, qelem);
 264 -                        ip = DLIST_PREV(storesave, qelem);
 265 -                        continue;
 266 -                }
 267 -
 268 -                p2autooff = tmpautooff;
 269 -
 270 -                genregs(p);
 271 -                mygenregs(p);
 272 -        }
 273 -
 274 -} else {
 275 -        /*
 276 -         * Loop over instruction assignment until the register assignment
 277 -         * code is satisfied.
 278 -         */
 279 -        extern int tempmin, tempfe, tempmax;
 280 -
 281 -        tempmin = ipp->ip_tmpnum - NREGREG;
 282 -        tempfe = tempmax = epp->ip_tmpnum;
 283 -        do {
 284 -                /* do instruction assignment */
 285 -                DLIST_FOREACH(ip, &ipole, qelem) {
 286 -                        if (ip->type != IP_NODE)
 287 -                                continue;
 288 -                        geninsn(ip->ip_node, FOREFF);
 289 -                        nsucomp(ip->ip_node);
 290 -                }
 291 -        } while (ngenregs(&ipole));
 292 -}
 293 -        ipp->ipp_autos = epp->ipp_autos;
 294 -        ipp->ipp_regs = epp->ipp_regs;
 295 -
 296 -
 297 -        DLIST_FOREACH(ip, &ipole, qelem) {
 298 -                emit(ip);
 299 -        }
 300 -        DLIST_INIT(&ipole, qelem);
 301 -}
 302 -#else
 303 -void
304139 optimize(struct interpass *ipole)
 305140 {
 306141         struct interpass *ip;
     
 !
371206         myoptim((struct interpass *)ipp);
 372207 #endif
 373208 }
<>374 -#endif
375209 
 376210 /*
 377211  * Delete unused labels, excess of labels, gotos to gotos.
     
 !
401235         DLIST_FOREACH(ip, ipole, qelem) {
 402236                 if (ip->type == IP_DEFLAB) {
 403237                         n = DLIST_NEXT(ip, qelem);
<>404 -#ifdef OLDSTYLE
 405 -                        while (n->type == IP_DEFLAB || n->type == IP_STKOFF) {
 406 -#else
407238                         while (n->type == IP_DEFLAB) {
<>408 -#endif
409239                                 if (n->type == IP_DEFLAB &&
 410240                                     lblary[n->ip_lbl-low] >= 0)
 411241                                         lblary[n->ip_lbl-low] = -ip->ip_lbl;
     
 !
465295                         continue;
 466296 
 467297                 ip2 = n;
<>468 -#ifdef OLDSTYLE
 469 -                do {
 470 -                        ip2 = DLIST_NEXT(ip2, qelem);
 471 -                } while (ip2->type == IP_STKOFF);
 472 -#else
473298                 ip2 = DLIST_NEXT(ip2, qelem);
<>474 -#endif
475299 
 476300                 if (ip2->type != IP_DEFLAB)
 477301                         continue;
     
 !
536360          * Any statement that immediately follows a jump is a leader.
 537361          */
 538362         DLIST_FOREACH(ip, ipole, qelem) {
<>539 -#ifdef OLDSTYLE
 540 -                /* ignore stackoff in beginning or end of bblocks */
 541 -                if (ip->type == IP_STKOFF && bb == NULL)
 542 -                        continue;
 543 -#endif
 544 -
545363                 if (bb == NULL || (ip->type == IP_EPILOG) ||
 546364                     (ip->type == IP_DEFLAB) || (ip->type == IP_DEFNAM)) {
 547365                         bb = tmpalloc(sizeof(struct basicblock));
     
 !
833651 
 834652 /* Helper function for findTemps, Find assignment nodes. */
 835653 static void
<>836 -findasg(NODE *p)
  654+searchasg(NODE *p)
837655 {
 838656         struct pvarinfo *pv;
 839657 
     
 !
861679 
 862680         currip = ip;
 863681 
<>864 -        walkf(ip->ip_node, findasg);
  682+        walkf(ip->ip_node, searchasg);
865683 }
 866684 
 867685 /*
     
 !
1014832                             ipp->ipp_regs, ipp->ipp_autos, ipp->ip_tmpnum,
 1015833                             ipp->ip_lblnum);
 1016834                         break;
<>1017 -#ifdef OLDSTYLE
 1018 -                case IP_STKOFF: printf("%d\n", ip->ip_off); break;
 1019 -#endif
<_1020835                 case IP_EPILOG:
 1021836                         epp = (struct interpass_prolog *)ip;
 1022837                         printf("%s %s regs %x autos %d mintemp %d minlbl %d\n",
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-27 23:01 +0200