# HG changeset patch # User Thomas Wuerthinger # Date 1424452133 -3600 # Node ID 35481bcb58824c2039bae3a94c6b781b802d1b16 # Parent d56b51bbdd986d91dc82daa43c0dae4ca05ed328 Remove LIRInstruction interface. Rename LIRInstructionBase to LIRInstruction. diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/DataPatchInConstantsTest.java --- a/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/DataPatchInConstantsTest.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/DataPatchInConstantsTest.java Fri Feb 20 18:08:53 2015 +0100 @@ -178,7 +178,7 @@ public static native Object load(Object obj); } - private static class LoadThroughPatchOp extends LIRInstructionBase { + private static class LoadThroughPatchOp extends LIRInstruction { final Constant c; final boolean compressed; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java Fri Feb 20 18:08:53 2015 +0100 @@ -29,7 +29,7 @@ /** * Convenience class to provide AMD64MacroAssembler for the {@link #emitCode} method. */ -public abstract class AMD64LIRInstruction extends LIRInstructionBase { +public abstract class AMD64LIRInstruction extends LIRInstruction { @Override public final void emitCode(CompilationResultBuilder crb) { diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCLIRInstruction.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCLIRInstruction.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCLIRInstruction.java Fri Feb 20 18:08:53 2015 +0100 @@ -29,7 +29,7 @@ /** * Convenience class to provide SPARCMacroAssembler for the {@link #emitCode} method. */ -public abstract class SPARCLIRInstruction extends LIRInstructionBase { +public abstract class SPARCLIRInstruction extends LIRInstruction { protected SPARCDelayedControlTransfer delayedControlTransfer = SPARCDelayedControlTransfer.DUMMY; @Override diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java --- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java Fri Feb 20 18:08:53 2015 +0100 @@ -94,7 +94,7 @@ } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { @Use({COMPOSITE}) protected NestedCompositeValue compValue; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest2.java --- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest2.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest2.java Fri Feb 20 18:08:53 2015 +0100 @@ -95,7 +95,7 @@ } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { @Use({COMPOSITE}) protected NestedCompositeValue compValue; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest3.java --- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest3.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest3.java Fri Feb 20 18:08:53 2015 +0100 @@ -95,7 +95,7 @@ } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { @Use({COMPOSITE}) protected NestedCompositeValue compValue; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest4.java --- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest4.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest4.java Fri Feb 20 18:08:53 2015 +0100 @@ -95,7 +95,7 @@ } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { @Use({COMPOSITE}) protected NestedCompositeValue compValue; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest1.java --- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest1.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest1.java Fri Feb 20 18:08:53 2015 +0100 @@ -86,7 +86,7 @@ } } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { @Use({COMPOSITE}) protected NestedCompositeValue compValue; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest2.java --- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest2.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest2.java Fri Feb 20 18:08:53 2015 +0100 @@ -88,7 +88,7 @@ } } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { @Use({COMPOSITE}) protected NestedCompositeValue compValue; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest3.java --- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest3.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest3.java Fri Feb 20 18:08:53 2015 +0100 @@ -99,7 +99,7 @@ } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { @Use({COMPOSITE}) protected Value value; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FullInfopointOp.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FullInfopointOp.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FullInfopointOp.java Fri Feb 20 18:08:53 2015 +0100 @@ -29,7 +29,7 @@ * Emits an infopoint (only mark the position). */ @Opcode("INFOPOINT") -public class FullInfopointOp extends LIRInstructionBase { +public class FullInfopointOp extends LIRInstruction { @State protected LIRFrameState state; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Fri Feb 20 18:08:53 2015 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,24 +22,27 @@ */ package com.oracle.graal.lir; -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; +import java.lang.annotation.*; +import java.util.*; -import java.lang.annotation.*; +import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; +import static com.oracle.graal.lir.LIRInstruction.OperandMode.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.debug.*; import com.oracle.graal.lir.asm.*; /** - * The {@code LIRInstruction} interface definition. + * The base class for an {@code LIRInstruction}. */ -public interface LIRInstruction { - Value[] NO_OPERANDS = {}; +public abstract class LIRInstruction { + public static final Value[] NO_OPERANDS = {}; /** * Constants denoting how a LIR instruction uses an operand. */ - enum OperandMode { + public enum OperandMode { /** * The value must have been defined before. It is alive before the instruction until the * beginning of the instruction, but not necessarily throughout the instruction. A register @@ -72,41 +75,41 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface Use { + public static @interface Use { - OperandFlag[] value() default REG; + OperandFlag[] value() default OperandFlag.REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface Alive { + public static @interface Alive { - OperandFlag[] value() default REG; + OperandFlag[] value() default OperandFlag.REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface Temp { + public static @interface Temp { - OperandFlag[] value() default REG; + OperandFlag[] value() default OperandFlag.REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface Def { + public static @interface Def { - OperandFlag[] value() default REG; + OperandFlag[] value() default OperandFlag.REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface State { + public static @interface State { } /** * Flags for an operand. */ - enum OperandFlag { + public enum OperandFlag { /** * The value can be a {@link RegisterValue}. */ @@ -145,115 +148,204 @@ UNINITIALIZED, } - void emitCode(CompilationResultBuilder crb); + /** + * For validity checking of the operand flags defined by instruction subclasses. + */ + protected static final EnumMap> ALLOWED_FLAGS; + + static { + ALLOWED_FLAGS = new EnumMap<>(OperandMode.class); + ALLOWED_FLAGS.put(OperandMode.USE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNINITIALIZED)); + ALLOWED_FLAGS.put(ALIVE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNINITIALIZED)); + ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, COMPOSITE, CONST, ILLEGAL, HINT)); + ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, COMPOSITE, ILLEGAL, HINT)); + } - int id(); + /** + * The flags of the base and index value of an address. + */ + protected static final EnumSet ADDRESS_FLAGS = EnumSet.of(REG, ILLEGAL); + + private final LIRInstructionClass instructionClass; - void setId(int id); + /** + * Instruction id for register allocation. + */ + private int id; + + private static final DebugMetric LIR_NODE_COUNT = Debug.metric("LIRNodes"); /** - * Gets the instruction name. + * Constructs a new LIR instruction. */ - String name(); + public LIRInstruction() { + LIR_NODE_COUNT.increment(); + instructionClass = LIRInstructionClass.get(getClass()); + id = -1; + } - boolean hasOperands(); + public abstract void emitCode(CompilationResultBuilder crb); + + public final int id() { + return id; + } - boolean hasState(); + public final void setId(int id) { + this.id = id; + } + + public final String name() { + return instructionClass.getOpcode(this); + } - /** - * Determines if this instruction destroys all caller-saved registers.. - */ - boolean destroysCallerSavedRegisters(); + public final boolean hasOperands() { + return instructionClass.hasOperands() || hasState() || destroysCallerSavedRegisters(); + } + + public final boolean hasState() { + return instructionClass.hasState(this); + } + + public boolean destroysCallerSavedRegisters() { + return false; + } // ValuePositionProcedures - void forEachInputPos(ValuePositionProcedure proc); + public final void forEachInputPos(ValuePositionProcedure proc) { + instructionClass.forEachUsePos(this, proc); + } - void forEachAlivePos(ValuePositionProcedure proc); + public final void forEachAlivePos(ValuePositionProcedure proc) { + instructionClass.forEachAlivePos(this, proc); + } - void forEachTempPos(ValuePositionProcedure proc); + public final void forEachTempPos(ValuePositionProcedure proc) { + instructionClass.forEachTempPos(this, proc); + } - void forEachOutputPos(ValuePositionProcedure proc); + public final void forEachOutputPos(ValuePositionProcedure proc) { + instructionClass.forEachDefPos(this, proc); + } // InstructionValueProcedures - void forEachInput(InstructionValueProcedure proc); + public final void forEachInput(InstructionValueProcedure proc) { + instructionClass.forEachUse(this, proc); + } - void forEachAlive(InstructionValueProcedure proc); + public final void forEachAlive(InstructionValueProcedure proc) { + instructionClass.forEachAlive(this, proc); + } - void forEachTemp(InstructionValueProcedure proc); + public final void forEachTemp(InstructionValueProcedure proc) { + instructionClass.forEachTemp(this, proc); + } - void forEachOutput(InstructionValueProcedure proc); + public final void forEachOutput(InstructionValueProcedure proc) { + instructionClass.forEachDef(this, proc); + } - void forEachState(InstructionValueProcedure proc); + public final void forEachState(InstructionValueProcedure proc) { + instructionClass.forEachState(this, proc); + } // ValueProcedures - void forEachInput(ValueProcedure proc); + public final void forEachInput(ValueProcedure proc) { + instructionClass.forEachUse(this, proc); + } - void forEachAlive(ValueProcedure proc); + public final void forEachAlive(ValueProcedure proc) { + instructionClass.forEachAlive(this, proc); + } - void forEachTemp(ValueProcedure proc); + public final void forEachTemp(ValueProcedure proc) { + instructionClass.forEachTemp(this, proc); + } - void forEachOutput(ValueProcedure proc); + public final void forEachOutput(ValueProcedure proc) { + instructionClass.forEachDef(this, proc); + } - void forEachState(ValueProcedure proc); + public final void forEachState(ValueProcedure proc) { + instructionClass.forEachState(this, proc); + } // States - void forEachState(InstructionStateProcedure proc); + public final void forEachState(InstructionStateProcedure proc) { + instructionClass.forEachState(this, proc); + } - void forEachState(StateProcedure proc); + public final void forEachState(StateProcedure proc) { + instructionClass.forEachState(this, proc); + } // InstructionValueConsumers - void visitEachInput(InstructionValueConsumer proc); + public final void visitEachInput(InstructionValueConsumer proc) { + instructionClass.forEachUse(this, proc); + } - void visitEachAlive(InstructionValueConsumer proc); + public final void visitEachAlive(InstructionValueConsumer proc) { + instructionClass.forEachAlive(this, proc); + } - void visitEachTemp(InstructionValueConsumer proc); + public final void visitEachTemp(InstructionValueConsumer proc) { + instructionClass.forEachTemp(this, proc); + } - void visitEachOutput(InstructionValueConsumer proc); + public final void visitEachOutput(InstructionValueConsumer proc) { + instructionClass.forEachDef(this, proc); + } - void visitEachState(InstructionValueConsumer proc); + public final void visitEachState(InstructionValueConsumer proc) { + instructionClass.forEachState(this, proc); + } // ValueConsumers - void visitEachInput(ValueConsumer proc); + public final void visitEachInput(ValueConsumer proc) { + instructionClass.forEachUse(this, proc); + } - void visitEachAlive(ValueConsumer proc); + public final void visitEachAlive(ValueConsumer proc) { + instructionClass.forEachAlive(this, proc); + } + + public final void visitEachTemp(ValueConsumer proc) { + instructionClass.forEachTemp(this, proc); + } - void visitEachTemp(ValueConsumer proc); + public final void visitEachOutput(ValueConsumer proc) { + instructionClass.forEachDef(this, proc); + } - void visitEachOutput(ValueConsumer proc); + public final void visitEachState(ValueConsumer proc) { + instructionClass.forEachState(this, proc); + } - void visitEachState(ValueConsumer proc); + @SuppressWarnings("unused") + public final Value forEachRegisterHint(Value value, OperandMode mode, InstructionValueProcedure proc) { + return instructionClass.forEachRegisterHint(this, mode, proc); + } - /** - * Iterates all register hints for the specified value, i.e., all preferred candidates for the - * register to be assigned to the value. - *

- * Subclasses can override this method. The default implementation processes all Input operands - * as the hints for an Output operand, and all Output operands as the hints for an Input - * operand. - * - * @param value The value the hints are needed for. - * @param mode The operand mode of the value. - * @param proc The procedure invoked for all the hints. If the procedure returns a non-null - * value, the iteration is stopped and the value is returned by this method, i.e., - * clients can stop the iteration once a suitable hint has been found. - * @return The non-null value returned by the procedure, or null. - */ - Value forEachRegisterHint(Value value, OperandMode mode, InstructionValueProcedure proc); + @SuppressWarnings("unused") + public final Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc) { + return instructionClass.forEachRegisterHint(this, mode, proc); + } + + public void verify() { + } - /** - * @see #forEachRegisterHint(Value, OperandMode, InstructionValueProcedure) - * @param value The value the hints are needed for. - * @param mode The operand mode of the value. - * @param proc The procedure invoked for all the hints. If the procedure returns a non-null - * value, the iteration is stopped and the value is returned by this method, i.e., - * clients can stop the iteration once a suitable hint has been found. - * @return The non-null value returned by the procedure, or null. - */ - Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc); + public final String toStringWithIdPrefix() { + if (id != -1) { + return String.format("%4d %s", id, toString()); + } + return " " + toString(); + } - String toStringWithIdPrefix(); + @Override + public String toString() { + return instructionClass.toString(this); + } - void verify(); - - LIRInstructionClass getLIRInstructionClass(); + public LIRInstructionClass getLIRInstructionClass() { + return instructionClass; + } } diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionBase.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionBase.java Fri Feb 20 14:37:08 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir; - -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; -import static com.oracle.graal.lir.LIRInstruction.OperandMode.*; - -import java.util.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.debug.*; -import com.oracle.graal.lir.asm.*; - -/** - * The base class for an {@code LIRInstruction}. - */ -public abstract class LIRInstructionBase implements LIRInstruction { - - /** - * For validity checking of the operand flags defined by instruction subclasses. - */ - protected static final EnumMap> ALLOWED_FLAGS; - - static { - ALLOWED_FLAGS = new EnumMap<>(OperandMode.class); - ALLOWED_FLAGS.put(USE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNINITIALIZED)); - ALLOWED_FLAGS.put(ALIVE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNINITIALIZED)); - ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, COMPOSITE, CONST, ILLEGAL, HINT)); - ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, COMPOSITE, ILLEGAL, HINT)); - } - - /** - * The flags of the base and index value of an address. - */ - protected static final EnumSet ADDRESS_FLAGS = EnumSet.of(REG, ILLEGAL); - - private final LIRInstructionClass instructionClass; - - /** - * Instruction id for register allocation. - */ - private int id; - - private static final DebugMetric LIR_NODE_COUNT = Debug.metric("LIRNodes"); - - /** - * Constructs a new LIR instruction. - */ - public LIRInstructionBase() { - LIR_NODE_COUNT.increment(); - instructionClass = LIRInstructionClass.get(getClass()); - id = -1; - } - - public abstract void emitCode(CompilationResultBuilder crb); - - public final int id() { - return id; - } - - public final void setId(int id) { - this.id = id; - } - - public final String name() { - return instructionClass.getOpcode(this); - } - - public final boolean hasOperands() { - return instructionClass.hasOperands() || hasState() || destroysCallerSavedRegisters(); - } - - public final boolean hasState() { - return instructionClass.hasState(this); - } - - public boolean destroysCallerSavedRegisters() { - return false; - } - - // ValuePositionProcedures - public final void forEachInputPos(ValuePositionProcedure proc) { - instructionClass.forEachUsePos(this, proc); - } - - public final void forEachAlivePos(ValuePositionProcedure proc) { - instructionClass.forEachAlivePos(this, proc); - } - - public final void forEachTempPos(ValuePositionProcedure proc) { - instructionClass.forEachTempPos(this, proc); - } - - public final void forEachOutputPos(ValuePositionProcedure proc) { - instructionClass.forEachDefPos(this, proc); - } - - // InstructionValueProcedures - public final void forEachInput(InstructionValueProcedure proc) { - instructionClass.forEachUse(this, proc); - } - - public final void forEachAlive(InstructionValueProcedure proc) { - instructionClass.forEachAlive(this, proc); - } - - public final void forEachTemp(InstructionValueProcedure proc) { - instructionClass.forEachTemp(this, proc); - } - - public final void forEachOutput(InstructionValueProcedure proc) { - instructionClass.forEachDef(this, proc); - } - - public final void forEachState(InstructionValueProcedure proc) { - instructionClass.forEachState(this, proc); - } - - // ValueProcedures - public final void forEachInput(ValueProcedure proc) { - instructionClass.forEachUse(this, proc); - } - - public final void forEachAlive(ValueProcedure proc) { - instructionClass.forEachAlive(this, proc); - } - - public final void forEachTemp(ValueProcedure proc) { - instructionClass.forEachTemp(this, proc); - } - - public final void forEachOutput(ValueProcedure proc) { - instructionClass.forEachDef(this, proc); - } - - public final void forEachState(ValueProcedure proc) { - instructionClass.forEachState(this, proc); - } - - // States - public final void forEachState(InstructionStateProcedure proc) { - instructionClass.forEachState(this, proc); - } - - public final void forEachState(StateProcedure proc) { - instructionClass.forEachState(this, proc); - } - - // InstructionValueConsumers - public final void visitEachInput(InstructionValueConsumer proc) { - instructionClass.forEachUse(this, proc); - } - - public final void visitEachAlive(InstructionValueConsumer proc) { - instructionClass.forEachAlive(this, proc); - } - - public final void visitEachTemp(InstructionValueConsumer proc) { - instructionClass.forEachTemp(this, proc); - } - - public final void visitEachOutput(InstructionValueConsumer proc) { - instructionClass.forEachDef(this, proc); - } - - public final void visitEachState(InstructionValueConsumer proc) { - instructionClass.forEachState(this, proc); - } - - // ValueConsumers - public final void visitEachInput(ValueConsumer proc) { - instructionClass.forEachUse(this, proc); - } - - public final void visitEachAlive(ValueConsumer proc) { - instructionClass.forEachAlive(this, proc); - } - - public final void visitEachTemp(ValueConsumer proc) { - instructionClass.forEachTemp(this, proc); - } - - public final void visitEachOutput(ValueConsumer proc) { - instructionClass.forEachDef(this, proc); - } - - public final void visitEachState(ValueConsumer proc) { - instructionClass.forEachState(this, proc); - } - - public Value forEachRegisterHint(Value value, OperandMode mode, InstructionValueProcedure proc) { - return instructionClass.forEachRegisterHint(this, mode, proc); - } - - public Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc) { - return instructionClass.forEachRegisterHint(this, mode, proc); - } - - public void verify() { - } - - public final String toStringWithIdPrefix() { - if (id != -1) { - return String.format("%4d %s", id, toString()); - } - return " " + toString(); - } - - @Override - public String toString() { - return instructionClass.toString(this); - } - - public LIRInstructionClass getLIRInstructionClass() { - return instructionClass; - } -} diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java Fri Feb 20 18:08:53 2015 +0100 @@ -135,7 +135,7 @@ } opcodeField = null; - super.scan(clazz, LIRInstructionBase.class, false); + super.scan(clazz, LIRInstruction.class, false); if (opcodeConstant == null && opcodeField == null) { opcodeConstant = clazz.getSimpleName(); diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java Fri Feb 20 18:08:53 2015 +0100 @@ -202,7 +202,7 @@ protected static void forEach(LIRInstruction inst, Values values, OperandMode mode, InstructionValueProcedure proc) { for (int i = 0; i < values.getCount(); i++) { - assert LIRInstructionBase.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); + assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); if (i < values.getDirectCount()) { Value value = values.getValue(inst, i); @@ -238,7 +238,7 @@ protected static CompositeValue forEachComponent(LIRInstruction inst, CompositeValue obj, Values values, OperandMode mode, InstructionValueProcedure proc) { CompositeValue newCompValue = null; for (int i = 0; i < values.getCount(); i++) { - assert LIRInstructionBase.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); + assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); if (i < values.getDirectCount()) { Value value = values.getValue(obj, i); @@ -286,7 +286,7 @@ protected static void forEach(LIRInstruction inst, Object obj, Values values, OperandMode mode, ValuePositionProcedure proc, ValuePosition outerPosition) { for (int i = 0; i < values.getCount(); i++) { - assert LIRInstructionBase.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); + assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); if (i < values.getDirectCount()) { Value value = values.getValue(obj, i); diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SimpleInfopointOp.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SimpleInfopointOp.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SimpleInfopointOp.java Fri Feb 20 18:08:53 2015 +0100 @@ -26,7 +26,7 @@ import com.oracle.graal.lir.asm.*; @Opcode("SIMPLE_INFOPOINT") -public class SimpleInfopointOp extends LIRInstructionBase { +public class SimpleInfopointOp extends LIRInstruction { private final InfopointReason reason; private final BytecodePosition position; diff -r d56b51bbdd98 -r 35481bcb5882 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java Fri Feb 20 14:37:08 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java Fri Feb 20 18:08:53 2015 +0100 @@ -44,23 +44,23 @@ * A block delimiter. Every well formed block must contain exactly one such operation and it * must be the last operation in the block. */ - public interface BlockEndOp extends LIRInstruction { + public interface BlockEndOp { } - public interface NullCheck extends LIRInstruction { + public interface NullCheck { Value getCheckedValue(); LIRFrameState getState(); } - public interface ImplicitNullCheck extends LIRInstruction { + public interface ImplicitNullCheck { boolean makeNullCheckFor(Value value, LIRFrameState nullCheckState, int implicitNullCheckLimit); } /** * LIR operation that defines the position of a label. */ - public static class LabelOp extends LIRInstructionBase { + public static class LabelOp extends LIRInstruction { private static final Value[] NO_VALUES = new Value[0]; @@ -104,7 +104,7 @@ /** * LIR operation that is an unconditional jump to a {@link #destination()}. */ - public static class JumpOp extends LIRInstructionBase implements BlockEndOp { + public static class JumpOp extends LIRInstruction implements BlockEndOp { private final LabelRef destination; @@ -134,7 +134,7 @@ * Marker interface for a LIR operation that moves a value from {@link #getInput()} to * {@link #getResult()}. */ - public interface MoveOp extends LIRInstruction { + public interface MoveOp { Value getInput(); @@ -146,7 +146,7 @@ * {@linkplain #remove(Set) pruned} and a mapping from registers to the frame slots in which * they are saved can be {@linkplain #getMap(FrameMap) retrieved}. */ - public interface SaveRegistersOp extends LIRInstruction { + public interface SaveRegistersOp { /** * Determines if the {@link #remove(Set)} operation is supported for this object. @@ -178,7 +178,7 @@ * A LIR operation that does nothing. If the operation records its position, it can be * subsequently {@linkplain #replace(LIR, LIRInstruction) replaced}. */ - public static class NoOp extends LIRInstructionBase { + public static class NoOp extends LIRInstruction { /** * The block in which this instruction is located. @@ -208,7 +208,7 @@ } @Opcode("BLACKHOLE") - public static class BlackholeOp extends LIRInstructionBase { + public static class BlackholeOp extends LIRInstruction { @Use({REG, STACK}) private Value value;