5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.replacements.amd64; 24 25 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_256; 26 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_64; 27 28 import org.graalvm.compiler.core.common.type.StampFactory; 29 import org.graalvm.compiler.graph.NodeClass; 30 import org.graalvm.compiler.graph.NodeInputList; 31 import org.graalvm.compiler.nodeinfo.InputType; 32 import org.graalvm.compiler.nodeinfo.NodeInfo; 33 import org.graalvm.compiler.nodes.FixedWithNextNode; 34 import org.graalvm.compiler.nodes.NamedLocationIdentity; 35 import org.graalvm.compiler.nodes.ValueNode; 36 import org.graalvm.compiler.nodes.ValueNodeUtil; 37 import org.graalvm.compiler.nodes.memory.MemoryAccess; 38 import org.graalvm.compiler.nodes.memory.MemoryNode; 39 import org.graalvm.compiler.nodes.spi.LIRLowerable; 40 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; 41 import org.graalvm.word.LocationIdentity; 42 import org.graalvm.word.Pointer; 43 44 import jdk.vm.ci.meta.JavaKind; 45 import jdk.vm.ci.meta.Value; 46 47 @NodeInfo(size = SIZE_64, cycles = CYCLES_256) 48 public class AMD64StringIndexOfNode extends FixedWithNextNode implements LIRLowerable, MemoryAccess { 49 public static final NodeClass<AMD64StringIndexOfNode> TYPE = NodeClass.create(AMD64StringIndexOfNode.class); 50 51 @OptionalInput(InputType.Memory) protected MemoryNode lastLocationAccess; 52 53 @Input protected NodeInputList<ValueNode> arguments; 54 55 public AMD64StringIndexOfNode(ValueNode sourcePointer, ValueNode sourceCount, ValueNode targetPointer, ValueNode targetCount) { 56 super(TYPE, StampFactory.forInteger(32)); 57 this.arguments = new NodeInputList<>(this, new ValueNode[]{sourcePointer, sourceCount, targetPointer, targetCount}); 58 } 59 60 @Override 61 public LocationIdentity getLocationIdentity() { 62 return NamedLocationIdentity.getArrayLocation(JavaKind.Char); 63 } 64 65 ValueNode sourcePointer() { 66 return arguments.get(0); 67 } | 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.replacements.amd64; 24 25 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_64; 26 27 import org.graalvm.compiler.core.common.type.StampFactory; 28 import org.graalvm.compiler.graph.NodeClass; 29 import org.graalvm.compiler.graph.NodeInputList; 30 import org.graalvm.compiler.nodeinfo.InputType; 31 import org.graalvm.compiler.nodeinfo.NodeCycles; 32 import org.graalvm.compiler.nodeinfo.NodeInfo; 33 import org.graalvm.compiler.nodes.FixedWithNextNode; 34 import org.graalvm.compiler.nodes.NamedLocationIdentity; 35 import org.graalvm.compiler.nodes.ValueNode; 36 import org.graalvm.compiler.nodes.ValueNodeUtil; 37 import org.graalvm.compiler.nodes.memory.MemoryAccess; 38 import org.graalvm.compiler.nodes.memory.MemoryNode; 39 import org.graalvm.compiler.nodes.spi.LIRLowerable; 40 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; 41 import org.graalvm.word.LocationIdentity; 42 import org.graalvm.word.Pointer; 43 44 import jdk.vm.ci.meta.JavaKind; 45 import jdk.vm.ci.meta.Value; 46 47 @NodeInfo(size = SIZE_64, cycles = NodeCycles.CYCLES_UNKNOWN) 48 public class AMD64StringIndexOfNode extends FixedWithNextNode implements LIRLowerable, MemoryAccess { 49 public static final NodeClass<AMD64StringIndexOfNode> TYPE = NodeClass.create(AMD64StringIndexOfNode.class); 50 51 @OptionalInput(InputType.Memory) protected MemoryNode lastLocationAccess; 52 53 @Input protected NodeInputList<ValueNode> arguments; 54 55 public AMD64StringIndexOfNode(ValueNode sourcePointer, ValueNode sourceCount, ValueNode targetPointer, ValueNode targetCount) { 56 super(TYPE, StampFactory.forInteger(32)); 57 this.arguments = new NodeInputList<>(this, new ValueNode[]{sourcePointer, sourceCount, targetPointer, targetCount}); 58 } 59 60 @Override 61 public LocationIdentity getLocationIdentity() { 62 return NamedLocationIdentity.getArrayLocation(JavaKind.Char); 63 } 64 65 ValueNode sourcePointer() { 66 return arguments.get(0); 67 } |