void MDefinition::replaceAllUsesWith(MDefinition *dom) { for (MUseIterator i(uses_.begin()); i != uses_.end(); ) { MUse *use = *i; i = uses_.removeAt(i); use->node()->setOperand(use->index(), dom); dom->linkUse(use); } }
MUseIterator MNode::replaceOperand(MUseIterator use, MDefinition *ins) { MDefinition *used = getOperand(use->index()); if (used == ins) return use; MUse *save = *use; MUseIterator result(used->removeUse(use)); if (ins) { setOperand(save->index(), ins); ins->linkUse(save); } return result; }