Exemplo n.º 1
0
/*------------------------------------------------------------------*/
static void
findPrevUse (eBBlock *ebp, iCode *ic, operand *op,
             eBBlock ** ebbs, int count,
             bool emitWarnings)
{
  unvisitBlocks (ebbs, count);

  if (op->isaddr)
    OP_SYMBOL (op)->isptr = 1;
  OP_SYMBOL (op)->key = op->key;

  /* There must be a definition in each branch of predecessors */
  if (!findPrevUseSym (ebp, ic->prev, OP_SYMBOL(op)))
    {
      /* computeLiveRanges() is called at least twice */
      if (emitWarnings)
        {
          if (IS_ITEMP (op))
            {
              if (OP_SYMBOL (op)->prereqv)
                {
                  werrorfl (ic->filename, ic->lineno, W_LOCAL_NOINIT,
                            OP_SYMBOL (op)->prereqv->name);
                  OP_SYMBOL (op)->prereqv->reqv = NULL;
                  OP_SYMBOL (op)->prereqv->allocreq = 1;
                }
            }
          else
            {
              werrorfl (ic->filename, ic->lineno, W_LOCAL_NOINIT,
                        OP_SYMBOL (op)->name);
            }
        }
      /* is this block part of a loop? */
      if (IS_ITEMP (op) && ebp->depth != 0)
        {
          /* extend the life range to the outermost loop */
          unvisitBlocks(ebbs, count);
          markWholeLoop (ebp, op->key);
        }
    }
}
Exemplo n.º 2
0
/*-----------------------------------------------------------------*/
iCode *
iCodeFromeBBlock (eBBlock ** ebbs, int count)
{
  int i = 1;
  iCode *ric = ebbs[0]->sch;
  iCode *lic = ebbs[0]->ech;

  for (; i < count; i++)
    {
      if (ebbs[i]->sch == NULL)
        continue;

      if (ebbs[i]->noPath &&
          (ebbs[i]->entryLabel != entryLabel &&
           ebbs[i]->entryLabel != returnLabel))
        {
          iCode *ic = NULL;
          bool foundNonlabel = 0;
          ic=ebbs[i]->sch;
          do
            {
              if (ic->op != LABEL)
                {
                  foundNonlabel = 1;
                  break;
                }
              if (ic==ebbs[i]->ech)
                break;
              ic = ic->next;
            }
          while (ic);
          if (foundNonlabel && ic)
            {
              werrorfl (ic->filename, ic->lineno, W_CODE_UNREACH);
              continue;
            }
        }

      lic->next = ebbs[i]->sch;
      lic->next->prev = lic;
      lic = ebbs[i]->ech;

    }

  return ric;
}