src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIRInstruction.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/LIRInstruction.java

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.COMPOSITE;
  26 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.CONST;
  27 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.HINT;
  28 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.ILLEGAL;
  29 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.OUTGOING;
  30 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
  31 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
  32 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.UNINITIALIZED;
  33 import static org.graalvm.compiler.lir.LIRInstruction.OperandMode.ALIVE;
  34 import static org.graalvm.compiler.lir.LIRInstruction.OperandMode.DEF;
  35 import static org.graalvm.compiler.lir.LIRInstruction.OperandMode.TEMP;
  36 import static org.graalvm.compiler.lir.LIRValueUtil.isVirtualStackSlot;
  37 import static jdk.vm.ci.code.ValueUtil.isStackSlot;
  38 
  39 import java.lang.annotation.ElementType;
  40 import java.lang.annotation.Retention;
  41 import java.lang.annotation.RetentionPolicy;
  42 import java.lang.annotation.Target;
  43 import java.util.Arrays;
  44 import java.util.EnumMap;
  45 import java.util.EnumSet;
  46 
  47 import org.graalvm.compiler.debug.Debug;
  48 import org.graalvm.compiler.debug.DebugCounter;
  49 import org.graalvm.compiler.graph.NodeSourcePosition;
  50 import org.graalvm.compiler.lir.StandardOp.LoadConstantOp;
  51 import org.graalvm.compiler.lir.StandardOp.MoveOp;
  52 import org.graalvm.compiler.lir.StandardOp.ValueMoveOp;
  53 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
  54 import org.graalvm.compiler.lir.gen.LIRGenerationResult;
  55 
  56 import jdk.vm.ci.code.RegisterValue;
  57 import jdk.vm.ci.code.StackSlot;
  58 import jdk.vm.ci.meta.JavaConstant;
  59 import jdk.vm.ci.meta.Value;
  60 
  61 /**
  62  * The base class for an {@code LIRInstruction}.
  63  */
  64 public abstract class LIRInstruction {
  65     /**
  66      * Constants denoting how a LIR instruction uses an operand.
  67      */
  68     public enum OperandMode {


 187         ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, COMPOSITE, ILLEGAL, HINT));
 188     }
 189 
 190     /**
 191      * The flags of the base and index value of an address.
 192      */
 193     protected static final EnumSet<OperandFlag> ADDRESS_FLAGS = EnumSet.of(REG, ILLEGAL);
 194 
 195     private final LIRInstructionClass<?> instructionClass;
 196 
 197     /**
 198      * Instruction id for register allocation.
 199      */
 200     private int id;
 201 
 202     /**
 203      * The source position of the code that generated this instruction.
 204      */
 205     private NodeSourcePosition position;
 206 
 207     private static final DebugCounter LIR_NODE_COUNT = Debug.counter("LIRNodes");
 208 
 209     /**
 210      * Constructs a new LIR instruction.
 211      */
 212     public LIRInstruction(LIRInstructionClass<? extends LIRInstruction> c) {
 213         LIR_NODE_COUNT.increment();
 214         instructionClass = c;
 215         assert c.getClazz() == this.getClass();
 216         id = -1;
 217     }
 218 
 219     public abstract void emitCode(CompilationResultBuilder crb);
 220 
 221     public final int id() {
 222         return id;
 223     }
 224 
 225     public final void setId(int id) {
 226         this.id = id;
 227     }
 228 
 229     public final NodeSourcePosition getPosition() {
 230         return position;
 231     }
 232 
 233     public final void setPosition(NodeSourcePosition position) {




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 static jdk.vm.ci.code.ValueUtil.isStackSlot;
  26 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.COMPOSITE;
  27 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.CONST;
  28 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.HINT;
  29 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.ILLEGAL;
  30 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.OUTGOING;
  31 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
  32 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
  33 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.UNINITIALIZED;
  34 import static org.graalvm.compiler.lir.LIRInstruction.OperandMode.ALIVE;
  35 import static org.graalvm.compiler.lir.LIRInstruction.OperandMode.DEF;
  36 import static org.graalvm.compiler.lir.LIRInstruction.OperandMode.TEMP;
  37 import static org.graalvm.compiler.lir.LIRValueUtil.isVirtualStackSlot;

  38 
  39 import java.lang.annotation.ElementType;
  40 import java.lang.annotation.Retention;
  41 import java.lang.annotation.RetentionPolicy;
  42 import java.lang.annotation.Target;
  43 import java.util.Arrays;
  44 import java.util.EnumMap;
  45 import java.util.EnumSet;
  46 


  47 import org.graalvm.compiler.graph.NodeSourcePosition;
  48 import org.graalvm.compiler.lir.StandardOp.LoadConstantOp;
  49 import org.graalvm.compiler.lir.StandardOp.MoveOp;
  50 import org.graalvm.compiler.lir.StandardOp.ValueMoveOp;
  51 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
  52 import org.graalvm.compiler.lir.gen.LIRGenerationResult;
  53 
  54 import jdk.vm.ci.code.RegisterValue;
  55 import jdk.vm.ci.code.StackSlot;
  56 import jdk.vm.ci.meta.JavaConstant;
  57 import jdk.vm.ci.meta.Value;
  58 
  59 /**
  60  * The base class for an {@code LIRInstruction}.
  61  */
  62 public abstract class LIRInstruction {
  63     /**
  64      * Constants denoting how a LIR instruction uses an operand.
  65      */
  66     public enum OperandMode {


 185         ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, COMPOSITE, ILLEGAL, HINT));
 186     }
 187 
 188     /**
 189      * The flags of the base and index value of an address.
 190      */
 191     protected static final EnumSet<OperandFlag> ADDRESS_FLAGS = EnumSet.of(REG, ILLEGAL);
 192 
 193     private final LIRInstructionClass<?> instructionClass;
 194 
 195     /**
 196      * Instruction id for register allocation.
 197      */
 198     private int id;
 199 
 200     /**
 201      * The source position of the code that generated this instruction.
 202      */
 203     private NodeSourcePosition position;
 204 


 205     /**
 206      * Constructs a new LIR instruction.
 207      */
 208     public LIRInstruction(LIRInstructionClass<? extends LIRInstruction> c) {

 209         instructionClass = c;
 210         assert c.getClazz() == this.getClass();
 211         id = -1;
 212     }
 213 
 214     public abstract void emitCode(CompilationResultBuilder crb);
 215 
 216     public final int id() {
 217         return id;
 218     }
 219 
 220     public final void setId(int id) {
 221         this.id = id;
 222     }
 223 
 224     public final NodeSourcePosition getPosition() {
 225         return position;
 226     }
 227 
 228     public final void setPosition(NodeSourcePosition position) {


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