Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: stack.c 7483 2007-03-08 13:17:40Z michi $
+ $Id: stack.c 7624 2007-04-02 16:09:44Z twisti $
*/
static basicblock *stack_mark_reached(stackdata_t *sd, basicblock *b, stackptr curstack, int stackdepth)
{
+ assert(b != NULL);
+
#if defined(STACK_VERBOSE)
printf("stack_mark_reached(L%03d from L%03d)\n", b->nr, sd->bptr->nr);
#endif
+
/* mark targets of backward branches */
+
if (b->nr <= sd->bptr->nr)
b->bitflags |= BBFLAG_REPLACEMENT;
static basicblock *stack_mark_reached_from_outvars(stackdata_t *sd, basicblock *b)
{
+ assert(b != NULL);
+
#if defined(STACK_VERBOSE)
printf("stack_mark_reached_from_outvars(L%03d from L%03d)\n", b->nr, sd->bptr->nr);
#endif
+
/* mark targets of backward branches */
+
if (b->nr <= sd->bptr->nr)
b->bitflags |= BBFLAG_REPLACEMENT;
/* stack_reach_next_block ******************************************************
- Mark the following block reached and propagate the outvars of the current block
- and the current locals to it. This function specializes the target block,
- if necessary, and returns a pointer to the specialized target.
+ Mark the following block reached and propagate the outvars of the
+ current block and the current locals to it. This function
+ specializes the target block, if necessary, and returns a pointer
+ to the specialized target.
IN:
sd...........stack analysis data
tbptr = (sd->bptr->original) ? sd->bptr->original : sd->bptr;
tbptr = stack_mark_reached_from_outvars(sd, tbptr->next);
- if (!tbptr)
+
+ if (tbptr == NULL)
return false;
if (tbptr != sd->bptr->next) {
/* initialize loop over basic blocks */
- sd.bptr = jd->basicblocks;
+ sd.bptr = jd->basicblocks;
superblockend = true;
- sd.repeat = false;
- curstack = NULL; stackdepth = 0;
- deadcode = true;
+ sd.repeat = false;
+ curstack = NULL;
+ stackdepth = 0;
+ deadcode = true;
/* iterate over basic blocks *****************************************/
if (sd.bptr->flags == BBTYPECHECK_REACHED) {
/* re-analyse a block because its input changed */
+
deadcode = false;
+
if (!stack_reanalyse_block(&sd))
return false;
+
superblockend = true; /* XXX */
continue;
}
if (superblockend && (sd.bptr->flags < BBREACHED)) {
- /* This block has not been reached so far, and we */
- /* don't fall into it, so we'll have to iterate again. */
+ /* This block has not been reached so far, and we
+ don't fall into it, so we'll have to iterate
+ again. */
sd.repeat = true;
continue;
}
if (sd.bptr->original && sd.bptr->original->flags < BBFINISHED) {
- /* This block is a clone and the original has not been */
- /* analysed, yet. Analyse it on the next iteration. */
+ /* This block is a clone and the original has not been
+ analysed, yet. Analyse it on the next
+ iteration. */
sd.repeat = true;
/* XXX superblockend? */