src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/CompositeValue.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/CompositeValue.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.lir;
  24 
  25 import java.lang.annotation.ElementType;
  26 import java.lang.annotation.Retention;
  27 import java.lang.annotation.RetentionPolicy;
  28 import java.lang.annotation.Target;
  29 import java.util.EnumSet;
  30 
  31 import org.graalvm.compiler.debug.Debug;
  32 import org.graalvm.compiler.debug.DebugCounter;
  33 import org.graalvm.compiler.lir.LIRInstruction.OperandFlag;
  34 import org.graalvm.compiler.lir.LIRInstruction.OperandMode;
  35 
  36 import jdk.vm.ci.meta.Value;
  37 import jdk.vm.ci.meta.ValueKind;
  38 
  39 /**
  40  * Base class to represent values that need to be stored in more than one register. This is mainly
  41  * intended to support addresses and not general arbitrary nesting of composite values. Because of
  42  * the possibility of sharing of CompositeValues they should be immutable.
  43  */
  44 public abstract class CompositeValue extends Value {
  45 
  46     @Retention(RetentionPolicy.RUNTIME)
  47     @Target(ElementType.FIELD)
  48     public static @interface Component {
  49 
  50         OperandFlag[] value() default OperandFlag.REG;
  51     }
  52 
  53     private static final DebugCounter COMPOSITE_VALUE_COUNT = Debug.counter("CompositeValues");
  54 
  55     public CompositeValue(ValueKind<?> kind) {
  56         super(kind);
  57         COMPOSITE_VALUE_COUNT.increment();
  58         assert CompositeValueClass.get(getClass()) != null;
  59     }
  60 
  61     /**
  62      * Invoke {@code proc} on each {@link Value} element of this {@link CompositeValue}. If
  63      * {@code proc} replaces any value then a new CompositeValue should be returned.
  64      *
  65      * @param inst
  66      * @param mode
  67      * @param proc
  68      * @return the original CompositeValue or a copy with any modified values
  69      */
  70     public abstract CompositeValue forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueProcedure proc);
  71 
  72     /**
  73      * A helper method to visit {@link Value}[] ensuring that a copy of the array is made if it's
  74      * needed.
  75      *
  76      * @param inst
  77      * @param values




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.lir;
  24 
  25 import java.lang.annotation.ElementType;
  26 import java.lang.annotation.Retention;
  27 import java.lang.annotation.RetentionPolicy;
  28 import java.lang.annotation.Target;
  29 import java.util.EnumSet;
  30 


  31 import org.graalvm.compiler.lir.LIRInstruction.OperandFlag;
  32 import org.graalvm.compiler.lir.LIRInstruction.OperandMode;
  33 
  34 import jdk.vm.ci.meta.Value;
  35 import jdk.vm.ci.meta.ValueKind;
  36 
  37 /**
  38  * Base class to represent values that need to be stored in more than one register. This is mainly
  39  * intended to support addresses and not general arbitrary nesting of composite values. Because of
  40  * the possibility of sharing of CompositeValues they should be immutable.
  41  */
  42 public abstract class CompositeValue extends Value {
  43 
  44     @Retention(RetentionPolicy.RUNTIME)
  45     @Target(ElementType.FIELD)
  46     public static @interface Component {
  47 
  48         OperandFlag[] value() default OperandFlag.REG;
  49     }
  50 


  51     public CompositeValue(ValueKind<?> kind) {
  52         super(kind);

  53         assert CompositeValueClass.get(getClass()) != null;
  54     }
  55 
  56     /**
  57      * Invoke {@code proc} on each {@link Value} element of this {@link CompositeValue}. If
  58      * {@code proc} replaces any value then a new CompositeValue should be returned.
  59      *
  60      * @param inst
  61      * @param mode
  62      * @param proc
  63      * @return the original CompositeValue or a copy with any modified values
  64      */
  65     public abstract CompositeValue forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueProcedure proc);
  66 
  67     /**
  68      * A helper method to visit {@link Value}[] ensuring that a copy of the array is made if it's
  69      * needed.
  70      *
  71      * @param inst
  72      * @param values


src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/CompositeValue.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File