annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java @ 19470:d216de21bfe8

Fix unchecked warnings in NodeClass.
author Roland Schatz <roland.schatz@oracle.com>
date Wed, 18 Feb 2015 12:10:04 +0100
parents 9619ba4daf4c
children 35481bcb5882
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
16796
0d47af538a92 Outsource Value/StateProcedure classes into files.
Josef Eisl <josef.eisl@jku.at>
parents: 16354
diff changeset
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.lir;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
25 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4522
diff changeset
26
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
27 import java.lang.annotation.*;
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
28
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
29 import com.oracle.graal.api.code.*;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
30 import com.oracle.graal.api.meta.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
31 import com.oracle.graal.lir.asm.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 /**
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
34 * The {@code LIRInstruction} interface definition.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 */
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
36 public interface LIRInstruction {
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 17604
diff changeset
37 Value[] NO_OPERANDS = {};
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 * Constants denoting how a LIR instruction uses an operand.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 */
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
42 enum OperandMode {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
44 * The value must have been defined before. It is alive before the instruction until the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
45 * beginning of the instruction, but not necessarily throughout the instruction. A register
9580
c59beafffb29 added use of javadoc links
Doug Simon <doug.simon@oracle.com>
parents: 9454
diff changeset
46 * assigned to it can also be assigned to a {@link #TEMP} or {@link #DEF} operand. The value
c59beafffb29 added use of javadoc links
Doug Simon <doug.simon@oracle.com>
parents: 9454
diff changeset
47 * can be used again after the instruction, so the instruction must not modify the register.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
49 USE,
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
52 * The value must have been defined before. It is alive before the instruction and
9580
c59beafffb29 added use of javadoc links
Doug Simon <doug.simon@oracle.com>
parents: 9454
diff changeset
53 * throughout the instruction. A register assigned to it cannot be assigned to a
c59beafffb29 added use of javadoc links
Doug Simon <doug.simon@oracle.com>
parents: 9454
diff changeset
54 * {@link #TEMP} or {@link #DEF} operand. The value can be used again after the instruction,
c59beafffb29 added use of javadoc links
Doug Simon <doug.simon@oracle.com>
parents: 9454
diff changeset
55 * so the instruction must not modify the register.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
57 ALIVE,
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
60 * The value must not have been defined before, and must not be used after the instruction.
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
61 * The instruction can do whatever it wants with the register assigned to it (or not use it
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
62 * at all).
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
64 TEMP,
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
67 * The value must not have been defined before. The instruction has to assign a value to the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
68 * register. The value can (and most likely will) be used after the instruction.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
70 DEF,
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
71 }
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
72
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
73 @Retention(RetentionPolicy.RUNTIME)
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
74 @Target(ElementType.FIELD)
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
75 static @interface Use {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
76
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
77 OperandFlag[] value() default REG;
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
78 }
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
79
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
80 @Retention(RetentionPolicy.RUNTIME)
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
81 @Target(ElementType.FIELD)
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
82 static @interface Alive {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
83
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
84 OperandFlag[] value() default REG;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
87 @Retention(RetentionPolicy.RUNTIME)
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
88 @Target(ElementType.FIELD)
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
89 static @interface Temp {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
90
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
91 OperandFlag[] value() default REG;
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
92 }
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
93
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
94 @Retention(RetentionPolicy.RUNTIME)
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
95 @Target(ElementType.FIELD)
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
96 static @interface Def {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
97
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
98 OperandFlag[] value() default REG;
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
99 }
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
100
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
101 @Retention(RetentionPolicy.RUNTIME)
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
102 @Target(ElementType.FIELD)
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
103 static @interface State {
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
104 }
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
105
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 /**
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
107 * Flags for an operand.
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
108 */
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
109 enum OperandFlag {
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
110 /**
5572
8f9c9d372e31 small renaming and doc fixes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5552
diff changeset
111 * The value can be a {@link RegisterValue}.
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
112 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
113 REG,
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
114
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
115 /**
5572
8f9c9d372e31 small renaming and doc fixes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5552
diff changeset
116 * The value can be a {@link StackSlot}.
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
117 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
118 STACK,
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
119
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
120 /**
8165
a85ef330ffe7 Composite value.
Roland Schatz <roland.schatz@oracle.com>
parents: 7907
diff changeset
121 * The value can be a {@link CompositeValue}.
a85ef330ffe7 Composite value.
Roland Schatz <roland.schatz@oracle.com>
parents: 7907
diff changeset
122 */
a85ef330ffe7 Composite value.
Roland Schatz <roland.schatz@oracle.com>
parents: 7907
diff changeset
123 COMPOSITE,
a85ef330ffe7 Composite value.
Roland Schatz <roland.schatz@oracle.com>
parents: 7907
diff changeset
124
a85ef330ffe7 Composite value.
Roland Schatz <roland.schatz@oracle.com>
parents: 7907
diff changeset
125 /**
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18163
diff changeset
126 * The value can be a {@link JavaConstant}.
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
127 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
128 CONST,
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
129
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
130 /**
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5733
diff changeset
131 * The value can be {@link Value#ILLEGAL}.
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
132 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
133 ILLEGAL,
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
134
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
135 /**
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
136 * The register allocator should try to assign a certain register to improve code quality.
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
137 * Use {@link LIRInstruction#forEachRegisterHint} to access the register hints.
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
138 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
139 HINT,
4314
9ce8594bedaf Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
140
9ce8594bedaf Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
141 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
142 * The value can be uninitialized, e.g., a stack slot that has not written to before. This
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
143 * is only used to avoid false positives in verification code.
4314
9ce8594bedaf Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
144 */
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
145 UNINITIALIZED,
4314
9ce8594bedaf Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
146 }
9ce8594bedaf Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
147
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
148 void emitCode(CompilationResultBuilder crb);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
149
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
150 int id();
11486
5d5bfb75dae0 added metrics for total number of Nodes, LIRInstructions and CompositeValues created (GRAAL-448)
Doug Simon <doug.simon@oracle.com>
parents: 9856
diff changeset
151
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
152 void setId(int id);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
153
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
154 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
155 * Gets the instruction name.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
156 */
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
157 String name();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
158
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
159 boolean hasOperands();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
160
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
161 boolean hasState();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
163 /**
9454
85a836bcd796 renaming for improved clarity: hasCall -> destroysCallerSavedRegisters
Doug Simon <doug.simon@oracle.com>
parents: 9294
diff changeset
164 * Determines if this instruction destroys all caller-saved registers..
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
165 */
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
166 boolean destroysCallerSavedRegisters();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
167
16800
a62a928287e4 Add LIRInstruction.visitEach{Input,Alive,Output,State}(InstructionValueConsumer).
Josef Eisl <josef.eisl@jku.at>
parents: 16796
diff changeset
168 // ValuePositionProcedures
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
169 void forEachInputPos(ValuePositionProcedure proc);
16280
266db8cf4dc6 Add LIRInstruction.forEach*(ValuePositionProcedure proc).
Josef Eisl <josef.eisl@jku.at>
parents: 16279
diff changeset
170
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
171 void forEachAlivePos(ValuePositionProcedure proc);
16280
266db8cf4dc6 Add LIRInstruction.forEach*(ValuePositionProcedure proc).
Josef Eisl <josef.eisl@jku.at>
parents: 16279
diff changeset
172
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
173 void forEachTempPos(ValuePositionProcedure proc);
16280
266db8cf4dc6 Add LIRInstruction.forEach*(ValuePositionProcedure proc).
Josef Eisl <josef.eisl@jku.at>
parents: 16279
diff changeset
174
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
175 void forEachOutputPos(ValuePositionProcedure proc);
16280
266db8cf4dc6 Add LIRInstruction.forEach*(ValuePositionProcedure proc).
Josef Eisl <josef.eisl@jku.at>
parents: 16279
diff changeset
176
16800
a62a928287e4 Add LIRInstruction.visitEach{Input,Alive,Output,State}(InstructionValueConsumer).
Josef Eisl <josef.eisl@jku.at>
parents: 16796
diff changeset
177 // InstructionValueProcedures
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
178 void forEachInput(InstructionValueProcedure proc);
16138
f315b1c0a590 Introduce InstructionValueProcedure.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
179
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
180 void forEachAlive(InstructionValueProcedure proc);
16138
f315b1c0a590 Introduce InstructionValueProcedure.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
181
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
182 void forEachTemp(InstructionValueProcedure proc);
16138
f315b1c0a590 Introduce InstructionValueProcedure.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
183
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
184 void forEachOutput(InstructionValueProcedure proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
185
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
186 void forEachState(InstructionValueProcedure proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
187
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
188 // ValueProcedures
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
189 void forEachInput(ValueProcedure proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
190
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
191 void forEachAlive(ValueProcedure proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
192
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
193 void forEachTemp(ValueProcedure proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
194
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
195 void forEachOutput(ValueProcedure proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
196
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
197 void forEachState(ValueProcedure proc);
16138
f315b1c0a590 Introduce InstructionValueProcedure.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
198
16800
a62a928287e4 Add LIRInstruction.visitEach{Input,Alive,Output,State}(InstructionValueConsumer).
Josef Eisl <josef.eisl@jku.at>
parents: 16796
diff changeset
199 // States
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
200 void forEachState(InstructionStateProcedure proc);
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5711
diff changeset
201
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
202 void forEachState(StateProcedure proc);
17296
e03a25f5a260 Replace anonymous StateProcedures with Lambdas.
Josef Eisl <josef.eisl@jku.at>
parents: 17286
diff changeset
203
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
204 // InstructionValueConsumers
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
205 void visitEachInput(InstructionValueConsumer proc);
16800
a62a928287e4 Add LIRInstruction.visitEach{Input,Alive,Output,State}(InstructionValueConsumer).
Josef Eisl <josef.eisl@jku.at>
parents: 16796
diff changeset
206
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
207 void visitEachAlive(InstructionValueConsumer proc);
16800
a62a928287e4 Add LIRInstruction.visitEach{Input,Alive,Output,State}(InstructionValueConsumer).
Josef Eisl <josef.eisl@jku.at>
parents: 16796
diff changeset
208
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
209 void visitEachTemp(InstructionValueConsumer proc);
16800
a62a928287e4 Add LIRInstruction.visitEach{Input,Alive,Output,State}(InstructionValueConsumer).
Josef Eisl <josef.eisl@jku.at>
parents: 16796
diff changeset
210
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
211 void visitEachOutput(InstructionValueConsumer proc);
16800
a62a928287e4 Add LIRInstruction.visitEach{Input,Alive,Output,State}(InstructionValueConsumer).
Josef Eisl <josef.eisl@jku.at>
parents: 16796
diff changeset
212
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
213 void visitEachState(InstructionValueConsumer proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
214
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
215 // ValueConsumers
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
216 void visitEachInput(ValueConsumer proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
217
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
218 void visitEachAlive(ValueConsumer proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
219
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
220 void visitEachTemp(ValueConsumer proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
221
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
222 void visitEachOutput(ValueConsumer proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
223
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
224 void visitEachState(ValueConsumer proc);
16800
a62a928287e4 Add LIRInstruction.visitEach{Input,Alive,Output,State}(InstructionValueConsumer).
Josef Eisl <josef.eisl@jku.at>
parents: 16796
diff changeset
225
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
227 * Iterates all register hints for the specified value, i.e., all preferred candidates for the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
228 * register to be assigned to the value.
7521
d4bc143c575a replaced use of <br> in javadoc with <p>
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
229 * <p>
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
230 * Subclasses can override this method. The default implementation processes all Input operands
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
231 * as the hints for an Output operand, and all Output operands as the hints for an Input
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
232 * operand.
16138
f315b1c0a590 Introduce InstructionValueProcedure.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
233 *
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
234 * @param value The value the hints are needed for.
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
235 * @param mode The operand mode of the value.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
236 * @param proc The procedure invoked for all the hints. If the procedure returns a non-null
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
237 * value, the iteration is stopped and the value is returned by this method, i.e.,
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
238 * clients can stop the iteration once a suitable hint has been found.
4245
75c620f90ab9 Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4210
diff changeset
239 * @return The non-null value returned by the procedure, or null.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 */
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
241 Value forEachRegisterHint(Value value, OperandMode mode, InstructionValueProcedure proc);
17285
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
242
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
243 /**
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
244 * @see #forEachRegisterHint(Value, OperandMode, InstructionValueProcedure)
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
245 * @param value The value the hints are needed for.
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
246 * @param mode The operand mode of the value.
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
247 * @param proc The procedure invoked for all the hints. If the procedure returns a non-null
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
248 * value, the iteration is stopped and the value is returned by this method, i.e.,
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
249 * clients can stop the iteration once a suitable hint has been found.
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
250 * @return The non-null value returned by the procedure, or null.
3a834111a632 Make [Instruction]ValueProcedure and [Instruction]ValueConsumer a FunctionalInterface.
Josef Eisl <josef.eisl@jku.at>
parents: 17277
diff changeset
251 */
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
252 Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
254 String toStringWithIdPrefix();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255
17604
35ae3e916582 Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents: 17357
diff changeset
256 void verify();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
257
19470
d216de21bfe8 Fix unchecked warnings in NodeClass.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
258 LIRInstructionClass<?> getLIRInstructionClass();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
259 }