< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotAddressLowering.java

Print this page

        

*** 30,40 **** import org.graalvm.compiler.asm.amd64.AMD64Address.Scale; import org.graalvm.compiler.core.amd64.AMD64AddressLowering; import org.graalvm.compiler.core.amd64.AMD64AddressNode; import org.graalvm.compiler.core.common.CompressEncoding; import org.graalvm.compiler.core.common.LIRKind; - import org.graalvm.compiler.core.common.NumUtil; import org.graalvm.compiler.core.common.type.ObjectStamp; import org.graalvm.compiler.core.common.type.StampFactory; import org.graalvm.compiler.debug.CounterKey; import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.graph.NodeClass; --- 30,39 ----
*** 42,51 **** --- 41,51 ---- import org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode; import org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp; import org.graalvm.compiler.nodeinfo.NodeInfo; import org.graalvm.compiler.nodes.CompressionNode; import org.graalvm.compiler.nodes.CompressionNode.CompressionOp; + import org.graalvm.compiler.nodes.StructuredGraph; import org.graalvm.compiler.nodes.ValueNode; import org.graalvm.compiler.nodes.calc.FloatingNode; import org.graalvm.compiler.nodes.spi.LIRLowerable; import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; import org.graalvm.compiler.options.OptionValues;
*** 91,129 **** this.heapBaseRegister = heapBaseRegister; } } @Override ! protected boolean improve(DebugContext debug, AMD64AddressNode addr) { ! ! boolean result = false; ! ! while (super.improve(debug, addr)) { ! result = true; } if (addr.getScale() == Scale.Times1) { if (addr.getIndex() instanceof CompressionNode) { ! if (improveUncompression(addr, (CompressionNode) addr.getIndex(), addr.getBase())) { counterFoldedUncompressDuringAddressLowering.increment(debug); return true; } } if (addr.getBase() instanceof CompressionNode) { ! if (improveUncompression(addr, (CompressionNode) addr.getBase(), addr.getIndex())) { counterFoldedUncompressDuringAddressLowering.increment(debug); return true; } } } ! return result; } - private boolean improveUncompression(AMD64AddressNode addr, CompressionNode compression, ValueNode other) { - if (compression.getOp() == CompressionOp.Uncompress) { CompressEncoding encoding = compression.getEncoding(); Scale scale = Scale.fromShift(encoding.getShift()); if (scale == null) { return false; } --- 91,134 ---- this.heapBaseRegister = heapBaseRegister; } } @Override ! protected boolean improve(StructuredGraph graph, DebugContext debug, AMD64AddressNode addr, boolean isBaseNegated, boolean isIndexNegated) { ! if (super.improve(graph, debug, addr, isBaseNegated, isIndexNegated)) { ! return true; } if (addr.getScale() == Scale.Times1) { if (addr.getIndex() instanceof CompressionNode) { ! if (improveUncompression(addr, (CompressionNode) addr.getIndex(), addr.getBase(), isBaseNegated, isIndexNegated)) { counterFoldedUncompressDuringAddressLowering.increment(debug); return true; } } if (addr.getBase() instanceof CompressionNode) { ! if (improveUncompression(addr, (CompressionNode) addr.getBase(), addr.getIndex(), isBaseNegated, isIndexNegated)) { counterFoldedUncompressDuringAddressLowering.increment(debug); return true; } } } ! return false; ! } ! ! @Override ! protected boolean mightBeOptimized(ValueNode value) { ! return super.mightBeOptimized(value) || value instanceof CompressionNode; ! } ! ! private boolean improveUncompression(AMD64AddressNode addr, CompressionNode compression, ValueNode other, boolean isBaseNegated, boolean isIndexNegated) { ! if (isBaseNegated || isIndexNegated || compression.getOp() != CompressionOp.Uncompress) { ! return false; } CompressEncoding encoding = compression.getEncoding(); Scale scale = Scale.fromShift(encoding.getShift()); if (scale == null) { return false; }
*** 144,156 **** addr.setBase(base); } else { return false; } } else { ! long disp = addr.getDisplacement() + encoding.getBase(); ! if (NumUtil.isInt(disp)) { ! addr.setDisplacement((int) disp); addr.setBase(other); } else { return false; } } --- 149,159 ---- addr.setBase(base); } else { return false; } } else { ! if (updateDisplacement(addr, encoding.getBase(), isBaseNegated)) { addr.setBase(other); } else { return false; } }
*** 159,168 **** } addr.setScale(scale); addr.setIndex(compression.getValue()); return true; - } else { - return false; - } } } --- 162,168 ----
< prev index next >