/// transferNodesFromList (MI) - When moving a range of instructions from one
/// MBB list to another, we need to update the parent pointers and the use/def
/// lists.
void ilist_traits<MachineInstr>::transferNodesFromList(
      iplist<MachineInstr, ilist_traits<MachineInstr> >& fromList,
      ilist_iterator<MachineInstr> first,
      ilist_iterator<MachineInstr> last) {
  // Splice within the same MBB -> no change.
  if (parent == fromList.parent) return;

  // If splicing between two blocks within the same function, just update the
  // parent pointers.
  if (parent->getParent() == fromList.parent->getParent()) {
    for (; first != last; ++first)
      first->setParent(parent);
    return;
  }
  
  // Otherwise, we have to update the parent and the use/def lists.  The common
  // case when this occurs is if we're splicing from a block in a MF to a block
  // that is not in an MF.
  bool HasOldMF = fromList.parent->getParent() != 0;
  MachineFunction *NewMF = parent->getParent();
  
  for (; first != last; ++first) {
    if (HasOldMF) first->RemoveRegOperandsFromUseLists();
    first->setParent(parent);
    if (NewMF) first->AddRegOperandsToUseLists(NewMF->getRegInfo());
  }
}
Example #2
0
/// transferNodesFromList (MI) - When moving a range of instructions from one
/// MBB list to another, we need to update the parent pointers and the use/def
/// lists.
void ilist_traits<MachineInstr>::
transferNodesFromList(ilist_traits<MachineInstr> &fromList,
                      ilist_iterator<MachineInstr> first,
                      ilist_iterator<MachineInstr> last) {
  assert(Parent->getParent() == fromList.Parent->getParent() &&
        "MachineInstr parent mismatch!");

  // Splice within the same MBB -> no change.
  if (Parent == fromList.Parent) return;

  // If splicing between two blocks within the same function, just update the
  // parent pointers.
  for (; first != last; ++first)
    first->setParent(Parent);
}