diff graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java @ 2827:bd17ac598c6e

Graph cloning, initial version (not completely working)
author Lukas Stadler <lukas.stadler@jku.at>
date Mon, 30 May 2011 18:46:57 +0200
parents 015be60afcf3
children 7596ae867a7b caf55daa41dc
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java	Mon May 30 17:05:06 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java	Mon May 30 18:46:57 2011 +0200
@@ -37,12 +37,19 @@
     private static final int INPUT_COUNT = 1;
     private static final int INPUT_BLOCK = 0;
 
+    private final int maxValues;
+
     private static final int SUCCESSOR_COUNT = 0;
 
     private int usedInputCount;
     private boolean isDead;
 
     @Override
+    protected int inputCount() {
+        return super.inputCount() + INPUT_COUNT + maxValues;
+    }
+
+    @Override
     protected int successorCount() {
         return super.successorCount() + SUCCESSOR_COUNT;
     }
@@ -62,7 +69,6 @@
      * Create a new Phi for the specified join block and local variable (or operand stack) slot.
      * @param kind the type of the variable
      * @param block the join point
-     * @param index the index into the stack (if < 0) or local variables
      * @param graph
      */
     public Phi(CiKind kind, Merge block, Graph graph) {
@@ -71,6 +77,7 @@
 
     public Phi(CiKind kind, Merge block, int maxValues, Graph graph) {
         super(kind, INPUT_COUNT + maxValues, SUCCESSOR_COUNT, graph);
+        this.maxValues = maxValues;
         usedInputCount = 1;
         setBlock(block);
     }
@@ -160,4 +167,13 @@
         }
         usedInputCount--;
     }
+
+    @Override
+    public Node copy(Graph into) {
+        Phi x = new Phi(kind, null, maxValues, into);
+        x.usedInputCount = usedInputCount;
+        x.isDead = isDead;
+        x.setNonNull(isNonNull());
+        return x;
+    }
 }