Skip to content

Commit

Permalink
Remove LoadConstantOp.canRematerialize
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrodriguez committed Apr 16, 2021
1 parent c330b64 commit 6e7f712
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import jdk.vm.ci.code.StackSlot;
import jdk.vm.ci.meta.AllocatableValue;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.Value;

/**
Expand Down Expand Up @@ -299,11 +298,6 @@ static boolean isLoadConstantOp(LIRInstruction op) {
return op.isLoadConstantOp();
}

default boolean canRematerialize() {
// By default only JavaConstants are assumed to be handled by the generic move
// operation.
return getConstant() instanceof JavaConstant;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import static jdk.vm.ci.code.ValueUtil.asStackSlot;
import static jdk.vm.ci.code.ValueUtil.isRegister;
import static jdk.vm.ci.code.ValueUtil.isStackSlot;
import static org.graalvm.compiler.lir.LIRValueUtil.isCast;
import static org.graalvm.compiler.lir.LIRValueUtil.asVariable;
import static org.graalvm.compiler.lir.LIRValueUtil.isCast;
import static org.graalvm.compiler.lir.LIRValueUtil.isVariable;
import static org.graalvm.compiler.lir.debug.LIRGenerationDebugContext.getSourceForOperandFromDebugContext;

Expand Down Expand Up @@ -905,9 +905,7 @@ protected void buildIntervals(boolean detailedAsserts) {
* @param operand The destination operand of the instruction
* @param interval The interval for this defined value.
* @return Returns the value which is moved to the instruction and which can be reused at all
* reload-locations in case the interval of this instruction is spilled. Currently this
* can only be a {@link LoadConstantOp#canRematerialize() rematerializable constant
* load}.
* reload-locations in case the interval of this instruction is spilled.
*/
protected Constant getMaterializedValue(LIRInstruction op, Value operand, Interval interval) {
if (LoadConstantOp.isLoadConstantOp(op)) {
Expand All @@ -929,11 +927,7 @@ protected Constant getMaterializedValue(LIRInstruction op, Value operand, Interv
}
}
}
Constant constant = move.getConstant();
if (!move.canRematerialize()) {
return null;
}
return constant;
return move.getConstant();
}
return null;
}
Expand Down

0 comments on commit 6e7f712

Please sign in to comment.