Esempio n. 1
0
 public void replaceSplitWithFixed(
     ControlSplitNode node, FixedWithNextNode replacement, AbstractBeginNode survivingSuccessor) {
   assert node != null && replacement != null && node.isAlive() && replacement.isAlive()
       : "cannot replace " + node + " with " + replacement;
   assert survivingSuccessor != null;
   node.clearSuccessors();
   replacement.setNext(survivingSuccessor);
   node.replaceAndDelete(replacement);
 }
Esempio n. 2
0
 /**
  * Unlinks a node from all its control flow neighbors and then removes it from its graph. The node
  * must have no {@linkplain Node#usages() usages}.
  *
  * @param node the node to be unlinked and removed
  */
 public void removeFixed(FixedWithNextNode node) {
   assert node != null;
   if (node instanceof AbstractBeginNode) {
     ((AbstractBeginNode) node).prepareDelete();
   }
   assert node.hasNoUsages() : node + " " + node.usages().count() + ", " + node.usages().first();
   GraphUtil.unlinkFixedNode(node);
   node.safeDelete();
 }
Esempio n. 3
0
 public void addBeforeFixed(FixedNode node, FixedWithNextNode newNode) {
   assert node != null && newNode != null && node.isAlive() && newNode.isAlive()
       : "cannot add " + newNode + " before " + node;
   assert node.predecessor() != null && node.predecessor() instanceof FixedWithNextNode
       : "cannot add " + newNode + " before " + node;
   assert newNode.next() == null : newNode;
   assert !(node instanceof AbstractMergeNode);
   FixedWithNextNode pred = (FixedWithNextNode) node.predecessor();
   pred.setNext(newNode);
   newNode.setNext(node);
 }
Esempio n. 4
0
 public void replaceFixedWithFixed(FixedWithNextNode node, FixedWithNextNode replacement) {
   assert node != null && replacement != null && node.isAlive() && replacement.isAlive()
       : "cannot replace " + node + " with " + replacement;
   FixedNode next = node.next();
   node.setNext(null);
   replacement.setNext(next);
   node.replaceAndDelete(replacement);
   if (node == start) {
     setStart((StartNode) replacement);
   }
 }
Esempio n. 5
0
 public void addAfterFixed(FixedWithNextNode node, FixedNode newNode) {
   assert node != null && newNode != null && node.isAlive() && newNode.isAlive()
       : "cannot add " + newNode + " after " + node;
   FixedNode next = node.next();
   node.setNext(newNode);
   if (next != null) {
     assert newNode instanceof FixedWithNextNode;
     FixedWithNextNode newFixedWithNext = (FixedWithNextNode) newNode;
     assert newFixedWithNext.next() == null;
     newFixedWithNext.setNext(next);
   }
 }
Esempio n. 6
0
 public void replaceFixedWithFloating(FixedWithNextNode node, FloatingNode replacement) {
   assert node != null && replacement != null && node.isAlive() && replacement.isAlive()
       : "cannot replace " + node + " with " + replacement;
   GraphUtil.unlinkFixedNode(node);
   node.replaceAtUsagesAndDelete(replacement);
 }
Esempio n. 7
0
 public static void unlinkFixedNode(FixedWithNextNode fixed) {
   assert fixed.next() != null && fixed.predecessor() != null && fixed.isAlive();
   FixedNode next = fixed.next();
   fixed.setNext(null);
   fixed.replaceAtPredecessor(next);
 }