Ejemplo n.º 1
0
void SlotIndexes::renumberIndexes() {

  // Renumber updates the index of every element of the index list.
  // If all instrs in the function have been allocated an index (which has been
  // placed in the index list in the order of instruction iteration) then the
  // resulting numbering will match what would have been generated by the
  // pass during the initial numbering of the function if the new instructions
  // had been present.

  functionSize = 0;
  unsigned index = 0;

  for (IndexListEntry *curEntry = front(); curEntry != getTail();
       curEntry = curEntry->getNext()) {

    curEntry->setIndex(index);

    if (curEntry->getInstr() == 0) {
      // MBB start entry. Just step index by 1.
      index += SlotIndex::NUM;
    }
    else {
      ++functionSize;
      unsigned Slots = curEntry->getInstr()->getDesc().getNumDefs();
      if (Slots == 0)
        Slots = 1;

      index += (Slots + 1) * SlotIndex::NUM;
    }
  }
}
Ejemplo n.º 2
0
void SlotIndexes::renumberIndexes() {
  // Renumber updates the index of every element of the index list.
  DEBUG(dbgs() << "\n*** Renumbering SlotIndexes ***\n");
  ++NumGlobalRenum;

  unsigned index = 0;

  for (IndexListEntry *curEntry = front(); curEntry != getTail();
       curEntry = curEntry->getNext()) {
    curEntry->setIndex(index);
    index += SlotIndex::InstrDist;
  }
}
Ejemplo n.º 3
0
// Renumber indexes locally after curEntry was inserted, but failed to get a new
// index.
void SlotIndexes::renumberIndexes(IndexListEntry *curEntry) {
  // Number indexes with half the default spacing so we can catch up quickly.
  const unsigned Space = SlotIndex::InstrDist/2;
  assert((Space & 3) == 0 && "InstrDist must be a multiple of 2*NUM");

  IndexListEntry *start = curEntry->getPrev();
  unsigned index = start->getIndex();
  IndexListEntry *tail = getTail();
  do {
    curEntry->setIndex(index += Space);
    curEntry = curEntry->getNext();
    // If the next index is bigger, we have caught up.
  } while (curEntry != tail && curEntry->getIndex() <= index);

  DEBUG(dbgs() << "\n*** Renumbered SlotIndexes " << start->getIndex() << '-'
               << index << " ***\n");
  ++NumLocalRenum;
}