Changes: Edwin Steiner
- $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $
-
*/
bool cfg_build(jitdata *jd)
{
- methodinfo *m;
basicblock *bptr;
basicblock *tbptr;
basicblock *ntbptr;
lookup_target_t *lookup;
s4 i;
- /* get required compiler data */
-
- m = jd->m;
-
/* process all basic blocks to find the predecessor/successor counts */
- bptr = jd->new_basicblocks;
+ bptr = jd->basicblocks;
- for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next) {
+ for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next) {
if ((bptr->icount == 0) || (bptr->flags == BBUNDEF))
continue;
while (iptr->opc == ICMD_NOP) {
if (iptr == bptr->iinstr)
- continue;
+ break;
iptr--;
}
bptr->successorcount++;
tbptr = bptr->next;
- tbptr->predecessorcount++;
+
+ /* An exception handler has no predecessors. */
+
+ if (tbptr->type != BBTYPE_EXH)
+ tbptr->predecessorcount++;
break;
}
}
/* Second iteration to allocate the arrays and insert the basic
block pointers. */
- bptr = jd->new_basicblocks;
+ bptr = jd->basicblocks;
- for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next) {
+ for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next) {
if ((bptr->icount == 0) || (bptr->flags == BBUNDEF))
continue;
while (iptr->opc == ICMD_NOP) {
if (iptr == bptr->iinstr)
- continue;
+ break;
iptr--;
}
bptr->successors[0] = tbptr;
bptr->successorcount++;
- cfg_allocate_predecessors(tbptr);
+ /* An exception handler has no predecessors. */
- tbptr->predecessors[tbptr->predecessorcount] = bptr;
- tbptr->predecessorcount++;
+ if (tbptr->type != BBTYPE_EXH) {
+ cfg_allocate_predecessors(tbptr);
+
+ tbptr->predecessors[tbptr->predecessorcount] = bptr;
+ tbptr->predecessorcount++;
+ }
break;
}
}