43972
|
1 |
/*
|
58299
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
43972
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
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 |
*/
|
50858
|
23 |
|
|
24 |
|
43972
|
25 |
package org.graalvm.compiler.nodes.graphbuilderconf;
|
|
26 |
|
|
27 |
import org.graalvm.compiler.core.common.spi.ConstantFieldProvider;
|
46640
|
28 |
import org.graalvm.compiler.debug.DebugContext;
|
43972
|
29 |
import org.graalvm.compiler.nodes.StructuredGraph;
|
|
30 |
import org.graalvm.compiler.nodes.ValueNode;
|
54328
|
31 |
import org.graalvm.compiler.nodes.spi.Replacements;
|
43972
|
32 |
import org.graalvm.compiler.nodes.spi.StampProvider;
|
46344
|
33 |
import org.graalvm.compiler.options.OptionValues;
|
43972
|
34 |
|
|
35 |
import jdk.vm.ci.meta.Assumptions;
|
|
36 |
import jdk.vm.ci.meta.ConstantReflectionProvider;
|
|
37 |
import jdk.vm.ci.meta.MetaAccessProvider;
|
|
38 |
|
|
39 |
/**
|
|
40 |
* Used by a {@link GraphBuilderPlugin} to interface with an object that builds a graph.
|
|
41 |
*/
|
|
42 |
public interface GraphBuilderTool {
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Adds the given node to the graph and also adds recursively all referenced inputs.
|
|
46 |
*
|
|
47 |
* @param value the node to be added to the graph
|
|
48 |
* @return either the node added or an equivalent node
|
|
49 |
*/
|
46393
|
50 |
<T extends ValueNode> T append(T value);
|
43972
|
51 |
|
|
52 |
StampProvider getStampProvider();
|
|
53 |
|
|
54 |
MetaAccessProvider getMetaAccess();
|
|
55 |
|
54328
|
56 |
Replacements getReplacements();
|
|
57 |
|
43972
|
58 |
default Assumptions getAssumptions() {
|
|
59 |
return getGraph().getAssumptions();
|
|
60 |
}
|
|
61 |
|
|
62 |
ConstantReflectionProvider getConstantReflection();
|
|
63 |
|
|
64 |
ConstantFieldProvider getConstantFieldProvider();
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Gets the graph being constructed.
|
|
68 |
*/
|
|
69 |
StructuredGraph getGraph();
|
|
70 |
|
46344
|
71 |
default OptionValues getOptions() {
|
|
72 |
return getGraph().getOptions();
|
|
73 |
}
|
|
74 |
|
46640
|
75 |
default DebugContext getDebug() {
|
|
76 |
return getGraph().getDebug();
|
|
77 |
}
|
|
78 |
|
43972
|
79 |
/**
|
|
80 |
* Determines if this parsing context is within the bytecode of an intrinsic or a method inlined
|
|
81 |
* by an intrinsic.
|
|
82 |
*/
|
|
83 |
boolean parsingIntrinsic();
|
50330
|
84 |
|
|
85 |
@SuppressWarnings("unused")
|
|
86 |
default boolean canDeferPlugin(GeneratedInvocationPlugin plugin) {
|
|
87 |
// By default generated plugins must be completely processed during parsing.
|
|
88 |
return false;
|
|
89 |
}
|
43972
|
90 |
}
|