31 |
31 |
32 import java.util.ArrayList; |
32 import java.util.ArrayList; |
33 import java.util.Collection; |
33 import java.util.Collection; |
34 import java.util.List; |
34 import java.util.List; |
35 |
35 |
|
36 import org.graalvm.collections.EconomicMap; |
|
37 import org.graalvm.collections.UnmodifiableMapCursor; |
36 import org.graalvm.compiler.core.common.LIRKind; |
38 import org.graalvm.compiler.core.common.LIRKind; |
37 import org.graalvm.compiler.core.common.calc.Condition; |
39 import org.graalvm.compiler.core.common.calc.Condition; |
38 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; |
40 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; |
39 import org.graalvm.compiler.core.common.cfg.BlockMap; |
41 import org.graalvm.compiler.core.common.cfg.BlockMap; |
40 import org.graalvm.compiler.core.common.type.Stamp; |
42 import org.graalvm.compiler.core.common.type.Stamp; |
98 import org.graalvm.compiler.nodes.spi.LIRLowerable; |
100 import org.graalvm.compiler.nodes.spi.LIRLowerable; |
99 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; |
101 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; |
100 import org.graalvm.compiler.nodes.spi.NodeValueMap; |
102 import org.graalvm.compiler.nodes.spi.NodeValueMap; |
101 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode; |
103 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode; |
102 import org.graalvm.compiler.options.OptionValues; |
104 import org.graalvm.compiler.options.OptionValues; |
103 import org.graalvm.util.EconomicMap; |
|
104 import org.graalvm.util.UnmodifiableMapCursor; |
|
105 |
105 |
106 import jdk.vm.ci.code.CallingConvention; |
106 import jdk.vm.ci.code.CallingConvention; |
107 import jdk.vm.ci.code.StackSlot; |
107 import jdk.vm.ci.code.StackSlot; |
108 import jdk.vm.ci.code.ValueUtil; |
108 import jdk.vm.ci.code.ValueUtil; |
109 import jdk.vm.ci.meta.AllocatableValue; |
109 import jdk.vm.ci.meta.AllocatableValue; |
536 gen.emitCompareBranch(kind.getPlatformKind(), operand(node.getValue()), nullValue, Condition.EQ, false, trueSuccessor, falseSuccessor, trueSuccessorProbability); |
536 gen.emitCompareBranch(kind.getPlatformKind(), operand(node.getValue()), nullValue, Condition.EQ, false, trueSuccessor, falseSuccessor, trueSuccessorProbability); |
537 } |
537 } |
538 |
538 |
539 public void emitCompareBranch(CompareNode compare, LabelRef trueSuccessor, LabelRef falseSuccessor, double trueSuccessorProbability) { |
539 public void emitCompareBranch(CompareNode compare, LabelRef trueSuccessor, LabelRef falseSuccessor, double trueSuccessorProbability) { |
540 PlatformKind kind = gen.getLIRKind(compare.getX().stamp(NodeView.DEFAULT)).getPlatformKind(); |
540 PlatformKind kind = gen.getLIRKind(compare.getX().stamp(NodeView.DEFAULT)).getPlatformKind(); |
541 gen.emitCompareBranch(kind, operand(compare.getX()), operand(compare.getY()), compare.condition(), compare.unorderedIsTrue(), trueSuccessor, falseSuccessor, trueSuccessorProbability); |
541 gen.emitCompareBranch(kind, operand(compare.getX()), operand(compare.getY()), compare.condition().asCondition(), compare.unorderedIsTrue(), trueSuccessor, falseSuccessor, |
|
542 trueSuccessorProbability); |
542 } |
543 } |
543 |
544 |
544 public void emitIntegerTestBranch(IntegerTestNode test, LabelRef trueSuccessor, LabelRef falseSuccessor, double trueSuccessorProbability) { |
545 public void emitIntegerTestBranch(IntegerTestNode test, LabelRef trueSuccessor, LabelRef falseSuccessor, double trueSuccessorProbability) { |
545 gen.emitIntegerTestBranch(operand(test.getX()), operand(test.getY()), trueSuccessor, falseSuccessor, trueSuccessorProbability); |
546 gen.emitIntegerTestBranch(operand(test.getX()), operand(test.getY()), trueSuccessor, falseSuccessor, trueSuccessorProbability); |
546 } |
547 } |
564 Value nullValue = gen.emitConstant(kind, JavaConstant.NULL_POINTER); |
565 Value nullValue = gen.emitConstant(kind, JavaConstant.NULL_POINTER); |
565 return gen.emitConditionalMove(kind.getPlatformKind(), operand(isNullNode.getValue()), nullValue, Condition.EQ, false, trueValue, falseValue); |
566 return gen.emitConditionalMove(kind.getPlatformKind(), operand(isNullNode.getValue()), nullValue, Condition.EQ, false, trueValue, falseValue); |
566 } else if (node instanceof CompareNode) { |
567 } else if (node instanceof CompareNode) { |
567 CompareNode compare = (CompareNode) node; |
568 CompareNode compare = (CompareNode) node; |
568 PlatformKind kind = gen.getLIRKind(compare.getX().stamp(NodeView.DEFAULT)).getPlatformKind(); |
569 PlatformKind kind = gen.getLIRKind(compare.getX().stamp(NodeView.DEFAULT)).getPlatformKind(); |
569 return gen.emitConditionalMove(kind, operand(compare.getX()), operand(compare.getY()), compare.condition(), compare.unorderedIsTrue(), trueValue, falseValue); |
570 return gen.emitConditionalMove(kind, operand(compare.getX()), operand(compare.getY()), compare.condition().asCondition(), compare.unorderedIsTrue(), trueValue, falseValue); |
570 } else if (node instanceof LogicConstantNode) { |
571 } else if (node instanceof LogicConstantNode) { |
571 return gen.emitMove(((LogicConstantNode) node).getValue() ? trueValue : falseValue); |
572 return gen.emitMove(((LogicConstantNode) node).getValue() ? trueValue : falseValue); |
572 } else if (node instanceof IntegerTestNode) { |
573 } else if (node instanceof IntegerTestNode) { |
573 IntegerTestNode test = (IntegerTestNode) node; |
574 IntegerTestNode test = (IntegerTestNode) node; |
574 return gen.emitIntegerTestMove(operand(test.getX()), operand(test.getY()), trueValue, falseValue); |
575 return gen.emitIntegerTestMove(operand(test.getX()), operand(test.getY()), trueValue, falseValue); |