diff graal/GraalCompiler/src/com/sun/c1x/ir/Value.java @ 2581:4a36a0bd6d18

added GraalGraph to classpath, Node as superclass of Value
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 05 May 2011 13:27:48 +0200
parents e1b3db8031ee
children 51ebe5f0516f
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Value.java	Wed May 04 18:57:26 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Value.java	Thu May 05 13:27:48 2011 +0200
@@ -22,7 +22,7 @@
  */
 package com.sun.c1x.ir;
 
-import com.sun.c1x.*;
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.opt.*;
 import com.sun.cri.ci.*;
@@ -32,7 +32,7 @@
  * This class represents a value within the HIR graph, including local variables, phis, and
  * all other instructions.
  */
-public abstract class Value {
+public abstract class Value extends Node {
 
     public enum Flag {
         NonNull,            // this value is non-null
@@ -51,11 +51,6 @@
     public final CiKind kind;
 
     /**
-     * Unique identifier for this value. This field's value is lazily initialized by {@link #id()}.
-     */
-    private int id;
-
-    /**
      * A mask of {@linkplain Flag flags} denoting extra properties of this value.
      */
     private int flags;
@@ -72,12 +67,35 @@
     /**
      * Creates a new value with the specified kind.
      * @param kind the type of this value
+     * @param inputCount
+     * @param successorCount
+     * @param graph
      */
-    public Value(CiKind kind) {
+    public Value(CiKind kind, int inputCount, int successorCount, Graph graph) {
+        super(inputCount, successorCount, graph == null ? new Graph() : graph);
         assert kind == kind.stackKind() : kind + " != " + kind.stackKind();
         this.kind = kind;
     }
 
+    ///////////////
+    // TODO: remove when Value class changes are completed
+
+    public Value(CiKind kind) {
+        this(kind, 0, 0, null);
+    }
+
+    @Override
+    public Node copy(Graph into) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    protected Object clone() throws CloneNotSupportedException {
+        throw new CloneNotSupportedException();
+    }
+
+    /////////////////
+
     /**
      * Gets the instruction that should be substituted for this one. Note that this
      * method is recursive; if the substituted instruction has a substitution, then
@@ -297,19 +315,4 @@
 
     public abstract void print(LogStream out);
 
-    /**
-     * This method returns a unique identification number for this value. The number returned is unique
-     * only to the compilation that produced this node and is computed lazily by using the current compilation
-     * for the current thread. Thus the first access is a hash lookup using {@link java.lang.ThreadLocal} and
-     * should not be considered fast. Because of the potentially slow first access, use of this ID should be
-     * restricted to debugging output.
-     * @return a unique ID for this value
-     */
-    public int id() {
-        if (id == 0) {
-            C1XMetrics.UniqueValueIdsAssigned++;
-            id = C1XCompilation.compilation().nextID();
-        }
-        return id;
-    }
 }