use of org.graalvm.compiler.replacements.SnippetTemplate.Arguments in project graal by oracle.
the class AArch64FloatArithmeticSnippets method lower.
public void lower(RemNode node, LoweringTool tool) {
JavaKind kind = node.stamp(NodeView.DEFAULT).getStackKind();
assert kind == JavaKind.Float || kind == JavaKind.Double;
if (node instanceof SafeNode) {
// We already introduced the necessary checks, nothing to do.
return;
}
SnippetTemplate.SnippetInfo snippet = kind == JavaKind.Float ? frem : drem;
StructuredGraph graph = node.graph();
Arguments args = new Arguments(snippet, graph.getGuardsStage(), tool.getLoweringStage());
args.add("x", node.getX());
args.add("y", node.getY());
template(node, args).instantiate(providers.getMetaAccess(), node, SnippetTemplate.DEFAULT_REPLACER, tool, args);
}
use of org.graalvm.compiler.replacements.SnippetTemplate.Arguments in project graal by oracle.
the class AArch64IntegerArithmeticSnippets method lower.
public void lower(FixedBinaryNode node, LoweringTool tool) {
JavaKind kind = node.stamp(NodeView.DEFAULT).getStackKind();
assert kind == JavaKind.Int || kind == JavaKind.Long;
SnippetTemplate.SnippetInfo snippet;
if (node instanceof SafeNode) {
// We already introduced the zero division check, nothing to do.
return;
} else if (node instanceof SignedDivNode) {
snippet = kind == JavaKind.Int ? idiv : ldiv;
} else if (node instanceof SignedRemNode) {
snippet = kind == JavaKind.Int ? irem : lrem;
} else if (node instanceof UnsignedDivNode) {
snippet = kind == JavaKind.Int ? uidiv : uldiv;
} else if (node instanceof UnsignedRemNode) {
snippet = kind == JavaKind.Int ? uirem : ulrem;
} else {
throw GraalError.shouldNotReachHere();
}
StructuredGraph graph = node.graph();
Arguments args = new Arguments(snippet, graph.getGuardsStage(), tool.getLoweringStage());
args.add("x", node.getX());
args.add("y", node.getY());
template(node, args).instantiate(providers.getMetaAccess(), node, SnippetTemplate.DEFAULT_REPLACER, args);
}
use of org.graalvm.compiler.replacements.SnippetTemplate.Arguments in project graal by oracle.
the class InstanceOfSnippetsTemplates method lower.
public void lower(FloatingNode instanceOf, LoweringTool tool) {
assert instanceOf instanceof InstanceOfNode || instanceOf instanceof InstanceOfDynamicNode || instanceOf instanceof ClassIsAssignableFromNode;
List<Node> usages = instanceOf.usages().snapshot();
Instantiation instantiation = new Instantiation();
for (Node usage : usages) {
final StructuredGraph graph = (StructuredGraph) usage.graph();
InstanceOfUsageReplacer replacer = createReplacer(instanceOf, instantiation, usage, graph);
if (instantiation.isInitialized()) {
// No need to re-instantiate the snippet - just re-use its result
replacer.replaceUsingInstantiation();
} else {
Arguments args = makeArguments(replacer, tool);
template(instanceOf, args).instantiate(providers.getMetaAccess(), instanceOf, replacer, tool, args);
}
}
assert instanceOf.hasNoUsages();
if (!instanceOf.isDeleted()) {
GraphUtil.killWithUnusedFloatingInputs(instanceOf);
}
}
Aggregations