# HG changeset patch # User Roland Schatz # Date 1366899310 -7200 # Node ID a5f2b9012865fe761c38a1fe4010eda620c5b23d # Parent 1342574c4f7dbe58236b30701ed4384610cd8222 Interval locations can only be AllocatableValues. diff -r 1342574c4f7d -r a5f2b9012865 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Apr 25 16:14:42 2013 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Apr 25 16:15:10 2013 +0200 @@ -90,7 +90,7 @@ public static class AMD64SpillMoveFactory implements LIR.SpillMoveFactory { @Override - public LIRInstruction createMove(Value result, Value input) { + public LIRInstruction createMove(AllocatableValue result, Value input) { return AMD64LIRGenerator.createMove(result, input); } } @@ -143,7 +143,7 @@ return result; } - private static AMD64LIRInstruction createMove(Value dst, Value src) { + private static AMD64LIRInstruction createMove(AllocatableValue dst, Value src) { if (isRegister(src) || isStackSlot(dst)) { return new MoveFromRegOp(dst, src); } else { diff -r 1342574c4f7d -r a5f2b9012865 graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu Apr 25 16:14:42 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu Apr 25 16:15:10 2013 +0200 @@ -80,7 +80,7 @@ public static class PTXSpillMoveFactory implements LIR.SpillMoveFactory { @Override - public LIRInstruction createMove(Value result, Value input) { + public LIRInstruction createMove(AllocatableValue result, Value input) { throw new InternalError("NYI"); } } diff -r 1342574c4f7d -r a5f2b9012865 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Thu Apr 25 16:14:42 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Thu Apr 25 16:15:10 2013 +0200 @@ -409,7 +409,7 @@ * The {@linkplain RegisterValue register} or {@linkplain Variable variable} for this interval * prior to register allocation. */ - public final Value operand; + public final AllocatableValue operand; /** * The operand number for this interval's {@linkplain #operand operand}. @@ -420,7 +420,7 @@ * The {@linkplain RegisterValue register} or {@linkplain StackSlot spill slot} assigned to this * interval. */ - private Value location; + private AllocatableValue location; /** * The stack slot to which all splits of this interval are spilled if necessary. @@ -498,7 +498,7 @@ */ private Interval locationHint; - void assignLocation(Value newLocation) { + void assignLocation(AllocatableValue newLocation) { if (isRegister(newLocation)) { assert this.location == null : "cannot re-assign location for " + this; if (newLocation.getKind() == Kind.Illegal && kind != Kind.Illegal) { @@ -518,7 +518,7 @@ * Gets the {@linkplain RegisterValue register} or {@linkplain StackSlot spill slot} assigned to * this interval. */ - public Value location() { + public AllocatableValue location() { return location; } @@ -673,7 +673,7 @@ */ static final Interval EndMarker = new Interval(Value.ILLEGAL, -1); - Interval(Value operand, int operandNumber) { + Interval(AllocatableValue operand, int operandNumber) { assert operand != null; this.operand = operand; this.operandNumber = operandNumber; diff -r 1342574c4f7d -r a5f2b9012865 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Thu Apr 25 16:14:42 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Thu Apr 25 16:15:10 2013 +0200 @@ -206,7 +206,7 @@ /** * Gets the operand denoted by a given operand number. */ - private Value operandFor(int operandNumber) { + private AllocatableValue operandFor(int operandNumber) { if (operandNumber < firstVariableNumber) { assert operandNumber >= 0; return registers[operandNumber].asValue(); @@ -281,7 +281,7 @@ * @param operand the operand for the interval * @return the created interval */ - Interval createInterval(Value operand) { + Interval createInterval(AllocatableValue operand) { assert isLegal(operand); int operandNumber = operandNumber(operand); Interval interval = new Interval(operand, operandNumber); @@ -346,7 +346,7 @@ return intervals[operandNumber]; } - Interval getOrCreateInterval(Value operand) { + Interval getOrCreateInterval(AllocatableValue operand) { Interval ret = intervalFor(operand); if (ret == null) { return createInterval(operand); @@ -555,8 +555,8 @@ insertionBuffer.init(instructions); } - Value fromLocation = interval.location(); - Value toLocation = canonicalSpillOpr(interval); + AllocatableValue fromLocation = interval.location(); + AllocatableValue toLocation = canonicalSpillOpr(interval); assert isRegister(fromLocation) : "from operand must be a register but is: " + fromLocation + " toLocation=" + toLocation + " spillState=" + interval.spillState(); assert isStackSlot(toLocation) : "to operand must be a stack slot"; @@ -968,7 +968,7 @@ TTY.println(blockData.get(block).liveOut.toString()); } - void addUse(Value operand, int from, int to, RegisterPriority registerPriority, Kind kind) { + void addUse(AllocatableValue operand, int from, int to, RegisterPriority registerPriority, Kind kind) { if (!isProcessed(operand)) { return; } @@ -987,7 +987,7 @@ interval.addUsePos(to & ~1, registerPriority); } - void addTemp(Value operand, int tempPos, RegisterPriority registerPriority, Kind kind) { + void addTemp(AllocatableValue operand, int tempPos, RegisterPriority registerPriority, Kind kind) { if (!isProcessed(operand)) { return; } @@ -1008,7 +1008,7 @@ return !isRegister(operand) || attributes(asRegister(operand)).isAllocatable(); } - void addDef(Value operand, int defPos, RegisterPriority registerPriority, Kind kind) { + void addDef(AllocatableValue operand, int defPos, RegisterPriority registerPriority, Kind kind) { if (!isProcessed(operand)) { return; } @@ -1114,8 +1114,8 @@ @Override protected Value doValue(Value registerHint) { if (isVariableOrRegister(registerHint)) { - Interval from = getOrCreateInterval(registerHint); - Interval to = getOrCreateInterval(targetValue); + Interval from = getOrCreateInterval((AllocatableValue) registerHint); + Interval to = getOrCreateInterval((AllocatableValue) targetValue); // hints always point from def to use if (hintAtDef) { @@ -1156,7 +1156,7 @@ BitSet live = blockData.get(block).liveOut; for (int operandNum = live.nextSetBit(0); operandNum >= 0; operandNum = live.nextSetBit(operandNum + 1)) { assert live.get(operandNum) : "should not stop here otherwise"; - Value operand = operandFor(operandNum); + AllocatableValue operand = operandFor(operandNum); if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("live in %s to %d", operand, blockTo + 2); } @@ -1197,7 +1197,7 @@ @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { - addDef(operand, opId, registerPriorityOfOutputOperand(op), operand.getKind().getStackKind()); + addDef((AllocatableValue) operand, opId, registerPriorityOfOutputOperand(op), operand.getKind().getStackKind()); addRegisterHint(op, operand, mode, flags, true); } return operand; @@ -1208,7 +1208,7 @@ @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { - addTemp(operand, opId, RegisterPriority.MustHaveRegister, operand.getKind().getStackKind()); + addTemp((AllocatableValue) operand, opId, RegisterPriority.MustHaveRegister, operand.getKind().getStackKind()); addRegisterHint(op, operand, mode, flags, false); } return operand; @@ -1220,7 +1220,7 @@ public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { RegisterPriority p = registerPriorityOfInputOperand(flags); - addUse(operand, blockFrom, opId + 1, p, operand.getKind().getStackKind()); + addUse((AllocatableValue) operand, blockFrom, opId + 1, p, operand.getKind().getStackKind()); addRegisterHint(op, operand, mode, flags, false); } return operand; @@ -1232,7 +1232,7 @@ public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { RegisterPriority p = registerPriorityOfInputOperand(flags); - addUse(operand, blockFrom, opId, p, operand.getKind().getStackKind()); + addUse((AllocatableValue) operand, blockFrom, opId, p, operand.getKind().getStackKind()); addRegisterHint(op, operand, mode, flags, false); } return operand; @@ -1247,7 +1247,7 @@ @Override public Value doValue(Value operand) { - addUse(operand, blockFrom, opId + 1, RegisterPriority.None, operand.getKind().getStackKind()); + addUse((AllocatableValue) operand, blockFrom, opId + 1, RegisterPriority.None, operand.getKind().getStackKind()); return operand; } }); diff -r 1342574c4f7d -r a5f2b9012865 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Thu Apr 25 16:14:42 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Thu Apr 25 16:15:10 2013 +0200 @@ -196,8 +196,8 @@ assert fromInterval.kind() == toInterval.kind() : "move between different types"; assert insertIdx != -1 : "must setup insert position first"; - Value fromOpr = fromInterval.operand; - Value toOpr = toInterval.operand; + AllocatableValue fromOpr = fromInterval.operand; + AllocatableValue toOpr = toInterval.operand; insertionBuffer.append(insertIdx, allocator.ir.spillMoveFactory.createMove(toOpr, fromOpr)); @@ -210,7 +210,7 @@ assert fromOpr.getKind() == toInterval.kind() : "move between different types"; assert insertIdx != -1 : "must setup insert position first"; - Value toOpr = toInterval.operand; + AllocatableValue toOpr = toInterval.operand; insertionBuffer.append(insertIdx, allocator.ir.spillMoveFactory.createMove(toOpr, fromOpr)); if (GraalOptions.TraceLinearScanLevel >= 4) { diff -r 1342574c4f7d -r a5f2b9012865 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Apr 25 16:14:42 2013 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Apr 25 16:15:10 2013 +0200 @@ -44,10 +44,10 @@ @Opcode("MOVE") public static class MoveToRegOp extends AMD64LIRInstruction implements MoveOp { - @Def({REG, HINT}) protected Value result; + @Def({REG, HINT}) protected AllocatableValue result; @Use({REG, STACK, CONST}) protected Value input; - public MoveToRegOp(Value result, Value input) { + public MoveToRegOp(AllocatableValue result, Value input) { this.result = result; this.input = input; } @@ -63,7 +63,7 @@ } @Override - public Value getResult() { + public AllocatableValue getResult() { return result; } } @@ -71,10 +71,10 @@ @Opcode("MOVE") public static class MoveFromRegOp extends AMD64LIRInstruction implements MoveOp { - @Def({REG, STACK}) protected Value result; + @Def({REG, STACK}) protected AllocatableValue result; @Use({REG, CONST, HINT}) protected Value input; - public MoveFromRegOp(Value result, Value input) { + public MoveFromRegOp(AllocatableValue result, Value input) { this.result = result; this.input = input; } @@ -90,7 +90,7 @@ } @Override - public Value getResult() { + public AllocatableValue getResult() { return result; } } diff -r 1342574c4f7d -r a5f2b9012865 graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXMove.java --- a/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXMove.java Thu Apr 25 16:14:42 2013 +0200 +++ b/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXMove.java Thu Apr 25 16:15:10 2013 +0200 @@ -39,10 +39,10 @@ @Opcode("MOVE") public static class SpillMoveOp extends PTXLIRInstruction implements MoveOp { - @Def({REG, STACK}) protected Value result; + @Def({REG, STACK}) protected AllocatableValue result; @Use({REG, STACK, CONST}) protected Value input; - public SpillMoveOp(Value result, Value input) { + public SpillMoveOp(AllocatableValue result, Value input) { this.result = result; this.input = input; } @@ -58,7 +58,7 @@ } @Override - public Value getResult() { + public AllocatableValue getResult() { return result; } } @@ -66,10 +66,10 @@ @Opcode("MOVE") public static class MoveToRegOp extends PTXLIRInstruction implements MoveOp { - @Def({REG, HINT}) protected Value result; + @Def({REG, HINT}) protected AllocatableValue result; @Use({REG, STACK, CONST}) protected Value input; - public MoveToRegOp(Value result, Value input) { + public MoveToRegOp(AllocatableValue result, Value input) { this.result = result; this.input = input; } @@ -85,7 +85,7 @@ } @Override - public Value getResult() { + public AllocatableValue getResult() { return result; } } @@ -93,10 +93,10 @@ @Opcode("MOVE") public static class MoveFromRegOp extends PTXLIRInstruction implements MoveOp { - @Def({REG, STACK}) protected Value result; + @Def({REG, STACK}) protected AllocatableValue result; @Use({REG, CONST, HINT}) protected Value input; - public MoveFromRegOp(Value result, Value input) { + public MoveFromRegOp(AllocatableValue result, Value input) { this.result = result; this.input = input; } @@ -112,7 +112,7 @@ } @Override - public Value getResult() { + public AllocatableValue getResult() { return result; } } diff -r 1342574c4f7d -r a5f2b9012865 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Thu Apr 25 16:14:42 2013 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Thu Apr 25 16:15:10 2013 +0200 @@ -64,7 +64,7 @@ public interface SpillMoveFactory { - LIRInstruction createMove(Value result, Value input); + LIRInstruction createMove(AllocatableValue result, Value input); } private boolean hasArgInCallerFrame; diff -r 1342574c4f7d -r a5f2b9012865 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 Thu Apr 25 16:14:42 2013 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java Thu Apr 25 16:15:10 2013 +0200 @@ -22,14 +22,14 @@ */ package com.oracle.graal.lir; +import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; + import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.nodes.cfg.*; -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; - /** * A collection of machine-independent LIR operations, as well as interfaces to be implemented for * specific kinds or LIR operations. @@ -117,7 +117,7 @@ Value getInput(); - Value getResult(); + AllocatableValue getResult(); } /**