Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java @ 7907:ea1c2bed2bfa
Common superclass for RegisterValue, StackSlot and Variable.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Thu, 28 Feb 2013 14:15:24 +0100 |
parents | 5e3d1a68664e |
children | a85ef330ffe7 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
2 * Copyright (c) 2009, 2012, 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.*; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
26 import static com.oracle.graal.lir.LIRInstruction.OperandMode.*; |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
27 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
28 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
|
29 import java.util.*; |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
30 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
31 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
|
32 import com.oracle.graal.api.meta.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
33 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
34 import com.oracle.graal.lir.asm.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 * The {@code LIRInstruction} class definition. |
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 public abstract class LIRInstruction { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
41 public static final Value[] NO_OPERANDS = {}; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 |
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 * Iterator for iterating over a list of values. Subclasses must overwrite one of the doValue |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
45 * methods. Clients of the class must only call the doValue method that takes additional |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
46 * parameters. |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
47 */ |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
48 public abstract static class ValueProcedure { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
49 |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
50 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
51 * Iterator method to be overwritten. This version of the iterator does not take additional |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
52 * parameters to keep the signature short. |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
53 * |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
54 * @param value The value that is iterated. |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
55 * @return The new value to replace the value that was passed in. |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
56 */ |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
57 protected Value doValue(Value value) { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
58 throw GraalInternalError.shouldNotReachHere("One of the doValue() methods must be overwritten"); |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
59 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
60 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
61 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
62 * Iterator method to be overwritten. This version of the iterator gets additional |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
63 * parameters about the processed value. |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
64 * |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
65 * @param value The value that is iterated. |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
66 * @param mode The operand mode for the value. |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
67 * @param flags A set of flags for the value. |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
68 * @return The new value to replace the value that was passed in. |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
69 */ |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
70 public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) { |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
71 return doValue(value); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
72 } |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
73 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
74 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
75 public abstract static class StateProcedure { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
76 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
77 protected abstract void doState(LIRFrameState state); |
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 |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
80 /** |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 * 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
|
82 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 public enum OperandMode { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
85 * 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
|
86 * beginning of the instruction, but not necessarily throughout the instruction. A register |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
87 * assigned to it can also be assigend to a Temp or Output operand. The value can be used |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
88 * 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
|
89 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
90 USE, |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
93 * The value must have been defined before. It is alive before the instruction and |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
94 * throughout the instruction. A register assigned to it cannot be assigned to a Temp or |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
95 * Output operand. The value can be used again after the instruction, so the instruction |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
96 * must not modify the register. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
98 ALIVE, |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
101 * 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
|
102 * 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
|
103 * at all). |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
105 TEMP, |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
108 * 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
|
109 * 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
|
110 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
111 DEF, |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
112 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
113 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
114 @Retention(RetentionPolicy.RUNTIME) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
115 @Target(ElementType.FIELD) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
116 public static @interface Use { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
117 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
118 OperandFlag[] value() default REG; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
119 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
120 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
121 @Retention(RetentionPolicy.RUNTIME) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
122 @Target(ElementType.FIELD) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
123 public static @interface Alive { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
124 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
125 OperandFlag[] value() default REG; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
127 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
128 @Retention(RetentionPolicy.RUNTIME) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
129 @Target(ElementType.FIELD) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
130 public static @interface Temp { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
131 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
132 OperandFlag[] value() default REG; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
133 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
134 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
135 @Retention(RetentionPolicy.RUNTIME) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
136 @Target(ElementType.FIELD) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
137 public static @interface Def { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
138 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
139 OperandFlag[] value() default REG; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
140 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
141 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
142 @Retention(RetentionPolicy.RUNTIME) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
143 @Target(ElementType.FIELD) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
144 public static @interface State { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
145 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
146 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
147 @Retention(RetentionPolicy.RUNTIME) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
148 @Target({ElementType.TYPE, ElementType.FIELD}) |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
149 public static @interface Opcode { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
150 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
151 String value() default ""; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
152 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
153 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 /** |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
155 * 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
|
156 */ |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
157 public enum OperandFlag { |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
158 /** |
5572
8f9c9d372e31
small renaming and doc fixes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5552
diff
changeset
|
159 * 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
|
160 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
161 REG, |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
162 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
163 /** |
5572
8f9c9d372e31
small renaming and doc fixes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5552
diff
changeset
|
164 * 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
|
165 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
166 STACK, |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
167 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
168 /** |
5572
8f9c9d372e31
small renaming and doc fixes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5552
diff
changeset
|
169 * The value can be a {@link Address}. |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
170 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
171 ADDR, |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
172 |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
173 /** |
5572
8f9c9d372e31
small renaming and doc fixes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5552
diff
changeset
|
174 * The value can be a {@link Constant}. |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
175 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
176 CONST, |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
177 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
178 /** |
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
|
179 * 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
|
180 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
181 ILLEGAL, |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
182 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
183 /** |
7907
ea1c2bed2bfa
Common superclass for RegisterValue, StackSlot and Variable.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
184 * The value can be {@link AllocatableValue#UNUSED}. |
ea1c2bed2bfa
Common superclass for RegisterValue, StackSlot and Variable.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
185 */ |
ea1c2bed2bfa
Common superclass for RegisterValue, StackSlot and Variable.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
186 UNUSED, |
ea1c2bed2bfa
Common superclass for RegisterValue, StackSlot and Variable.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
187 |
ea1c2bed2bfa
Common superclass for RegisterValue, StackSlot and Variable.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
188 /** |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
189 * 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
|
190 * 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
|
191 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
192 HINT, |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
193 |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
194 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
195 * 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
|
196 * 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
|
197 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
198 UNINITIALIZED, |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
199 } |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
200 |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
201 /** |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
202 * For validity checking of the operand flags defined by instruction subclasses. |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
203 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
204 protected static final EnumMap<OperandMode, EnumSet<OperandFlag>> ALLOWED_FLAGS; |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
205 |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
206 static { |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4245
diff
changeset
|
207 ALLOWED_FLAGS = new EnumMap<>(OperandMode.class); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
208 ALLOWED_FLAGS.put(USE, EnumSet.of(REG, STACK, ADDR, CONST, ILLEGAL, HINT, UNINITIALIZED)); |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
209 ALLOWED_FLAGS.put(ALIVE, EnumSet.of(REG, STACK, ADDR, CONST, ILLEGAL, HINT, UNINITIALIZED)); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
210 ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, CONST, ILLEGAL, HINT)); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
211 ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, ILLEGAL, HINT)); |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
212 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
213 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
214 /** |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
215 * The flags of the base and index value of an address. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
217 protected static final EnumSet<OperandFlag> ADDRESS_FLAGS = EnumSet.of(REG, ILLEGAL); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
218 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
219 private final LIRInstructionClass instructionClass; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
220 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
221 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 * Instruction id for register allocation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
223 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 private int id; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 /** |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
227 * Constructs a new LIR instruction. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
229 public LIRInstruction() { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
230 instructionClass = LIRInstructionClass.get(getClass()); |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
231 id = -1; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 public abstract void emitCode(TargetMethodAssembler tasm); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 public final int id() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 return id; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
238 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
240 public final void setId(int id) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 this.id = id; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 * Gets the instruction name. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 */ |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
247 public final String name() { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
248 return instructionClass.getOpcode(this); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
249 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
250 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
251 public final boolean hasOperands() { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
252 return instructionClass.hasOperands() || hasState() || hasCall(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
255 public final boolean hasState() { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
256 return instructionClass.hasState(this); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
259 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
260 * Returns true when this instruction is a call instruction that destroys all caller-saved |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
261 * registers. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
262 */ |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
263 public final boolean hasCall() { |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
264 return this instanceof StandardOp.CallOp; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
267 public final void forEachInput(ValueProcedure proc) { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
268 instructionClass.forEachUse(this, proc); |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
269 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
270 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
271 public final void forEachAlive(ValueProcedure proc) { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
272 instructionClass.forEachAlive(this, proc); |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
273 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
274 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
275 public final void forEachTemp(ValueProcedure proc) { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
276 instructionClass.forEachTemp(this, proc); |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
277 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
278 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
279 public final void forEachOutput(ValueProcedure proc) { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
280 instructionClass.forEachDef(this, proc); |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
281 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
282 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
283 public final void forEachState(ValueProcedure proc) { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
284 instructionClass.forEachState(this, proc); |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
285 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
286 |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
287 public final void forEachState(StateProcedure proc) { |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
288 instructionClass.forEachState(this, proc); |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
289 } |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
290 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
292 * 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
|
293 * 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
|
294 * <p> |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
295 * 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
|
296 * 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
|
297 * operand. |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7521
diff
changeset
|
298 * |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4210
diff
changeset
|
299 * @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
|
300 * @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
|
301 * @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
|
302 * 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
|
303 * 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
|
304 * @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
|
305 */ |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
306 public Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc) { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
307 return instructionClass.forEachRegisterHint(this, mode, proc); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
308 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
309 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
310 protected void verify() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
311 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
313 public final String toStringWithIdPrefix() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
314 if (id != -1) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 return String.format("%4d %s", id, toString()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 return " " + toString(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
319 |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
320 @Override |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
321 public String toString() { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5711
diff
changeset
|
322 return instructionClass.toString(this); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
323 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
324 } |