annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java @ 21218:ca85b783309c

Add LabelOp.isPhiIn().
author Josef Eisl <josef.eisl@jku.at>
date Thu, 23 Apr 2015 14:35:28 +0200
parents 7223cb16dfa6
children 0bb06deee33b
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 /*
4206
430b5db3e6f8 Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4199
diff changeset
2 * Copyright (c) 2011, 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
9297
a5f2b9012865 Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9247
diff changeset
25 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
21218
ca85b783309c Add LabelOp.isPhiIn().
Josef Eisl <josef.eisl@jku.at>
parents: 21217
diff changeset
26 import static com.oracle.graal.lir.LIRValueUtil.*;
9297
a5f2b9012865 Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9247
diff changeset
27
12610
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
28 import java.util.*;
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
29
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
30 import com.oracle.graal.api.code.*;
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5698
diff changeset
31 import com.oracle.graal.api.meta.*;
6531
4afe23aa0a00 renamed packages: com.oracle.max.asm... -> com.oracle.graal.asm...
Doug Simon <doug.simon@oracle.com>
parents: 5733
diff changeset
32 import com.oracle.graal.asm.*;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15192
diff changeset
33 import com.oracle.graal.compiler.common.*;
15192
644dfe49c0f4 Move packages com.oracle.graal.cfg to com.oracle.graal.compiler.common.cfg.
Josef Eisl <josef.eisl@jku.at>
parents: 15157
diff changeset
34 import com.oracle.graal.compiler.common.cfg.*;
5733
141b15521a39 use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5698
diff changeset
35 import com.oracle.graal.lir.asm.*;
18443
1c92d437179b FrameMapBuilder: move into package.
Josef Eisl <josef.eisl@jku.at>
parents: 18140
diff changeset
36 import com.oracle.graal.lir.framemap.*;
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
37
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
38 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7369
diff changeset
39 * A collection of machine-independent LIR operations, as well as interfaces to be implemented for
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7369
diff changeset
40 * specific kinds or LIR operations.
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
41 */
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
42 public class StandardOp {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
44 /**
13268
68b964b6dc8e introduced BlockEndOp interface and require that every LIR block is terminated by such an operation
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
45 * A block delimiter. Every well formed block must contain exactly one such operation and it
68b964b6dc8e introduced BlockEndOp interface and require that every LIR block is terminated by such an operation
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
46 * must be the last operation in the block.
5698
764db9ada24f rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 5539
diff changeset
47 */
19525
35481bcb5882 Remove LIRInstruction interface. Rename LIRInstructionBase to LIRInstruction.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18933
diff changeset
48 public interface BlockEndOp {
5698
764db9ada24f rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 5539
diff changeset
49 }
764db9ada24f rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 5539
diff changeset
50
19525
35481bcb5882 Remove LIRInstruction interface. Rename LIRInstructionBase to LIRInstruction.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18933
diff changeset
51 public interface NullCheck {
12785
c13633a4d472 peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents: 12613
diff changeset
52 Value getCheckedValue();
c13633a4d472 peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents: 12613
diff changeset
53
c13633a4d472 peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents: 12613
diff changeset
54 LIRFrameState getState();
c13633a4d472 peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents: 12613
diff changeset
55 }
c13633a4d472 peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents: 12613
diff changeset
56
19525
35481bcb5882 Remove LIRInstruction interface. Rename LIRInstructionBase to LIRInstruction.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18933
diff changeset
57 public interface ImplicitNullCheck {
12785
c13633a4d472 peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents: 12613
diff changeset
58 boolean makeNullCheckFor(Value value, LIRFrameState nullCheckState, int implicitNullCheckLimit);
c13633a4d472 peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents: 12613
diff changeset
59 }
c13633a4d472 peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents: 12613
diff changeset
60
5698
764db9ada24f rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 5539
diff changeset
61 /**
13268
68b964b6dc8e introduced BlockEndOp interface and require that every LIR block is terminated by such an operation
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
62 * LIR operation that defines the position of a label.
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
63 */
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
64 public static final class LabelOp extends LIRInstruction {
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
65 public static final LIRInstructionClass<LabelOp> TYPE = LIRInstructionClass.create(LabelOp.class);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7369
diff changeset
66
11537
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
67 private static final Value[] NO_VALUES = new Value[0];
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
68
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
69 /**
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
70 * In the LIR, every register and variable must be defined before it is used. For method
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
71 * parameters that are passed in fixed registers, exception objects passed to the exception
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
72 * handler in a fixed register, or any other use of a fixed register not defined in this
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
73 * method, an artificial definition is necessary. To avoid spill moves to be inserted
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
74 * between the label at the beginning of a block an an actual definition in the second
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
75 * instruction of a block, the registers are defined here in the label.
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
76 */
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
77 @Def({REG, STACK}) private Value[] incomingValues;
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
78
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
79 private final Label label;
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
80 private final boolean align;
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
81
7369
4c6e577d0c01 Backed out changeset b5280041f59e. Alignment for branch targets has no positive effect. Remove to keep code cache smaller.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7353
diff changeset
82 public LabelOp(Label label, boolean align) {
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
83 super(TYPE);
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
84 this.label = label;
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
85 this.align = align;
11537
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
86 this.incomingValues = NO_VALUES;
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
87 }
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
88
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
89 public void setIncomingValues(Value[] values) {
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
90 assert incomingValues.length == 0;
7ce08e264abf Fixed registers that flow into a block need to be inputs of the LabelOp, otherwise the register allocator can insert spill moves before the definition of a fixed register.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9339
diff changeset
91 incomingValues = values;
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
92 }
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
93
21217
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
94 public int getIncomingSize() {
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
95 return incomingValues.length;
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
96 }
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
97
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
98 public Value getIncomingValue(int idx) {
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
99 return incomingValues[idx];
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
100 }
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
101
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
102 public void clearIncomingValues() {
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
103 incomingValues = NO_VALUES;
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
104 }
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
105
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
106 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12785
diff changeset
107 public void emitCode(CompilationResultBuilder crb) {
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
108 if (align) {
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12785
diff changeset
109 crb.asm.align(crb.target.wordSize * 2);
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
110 }
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12785
diff changeset
111 crb.asm.bind(label);
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
112 }
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
113
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
114 public Label getLabel() {
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
115 return label;
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
116 }
21218
ca85b783309c Add LabelOp.isPhiIn().
Josef Eisl <josef.eisl@jku.at>
parents: 21217
diff changeset
117
ca85b783309c Add LabelOp.isPhiIn().
Josef Eisl <josef.eisl@jku.at>
parents: 21217
diff changeset
118 /**
ca85b783309c Add LabelOp.isPhiIn().
Josef Eisl <josef.eisl@jku.at>
parents: 21217
diff changeset
119 * @return true if this label acts as a PhiIn.
ca85b783309c Add LabelOp.isPhiIn().
Josef Eisl <josef.eisl@jku.at>
parents: 21217
diff changeset
120 */
ca85b783309c Add LabelOp.isPhiIn().
Josef Eisl <josef.eisl@jku.at>
parents: 21217
diff changeset
121 public boolean isPhiIn() {
ca85b783309c Add LabelOp.isPhiIn().
Josef Eisl <josef.eisl@jku.at>
parents: 21217
diff changeset
122 return getIncomingSize() > 0 && isVariable(getIncomingValue(0));
ca85b783309c Add LabelOp.isPhiIn().
Josef Eisl <josef.eisl@jku.at>
parents: 21217
diff changeset
123 }
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
124 }
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
125
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
126 /**
13268
68b964b6dc8e introduced BlockEndOp interface and require that every LIR block is terminated by such an operation
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
127 * LIR operation that is an unconditional jump to a {@link #destination()}.
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
128 */
19525
35481bcb5882 Remove LIRInstruction interface. Rename LIRInstructionBase to LIRInstruction.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18933
diff changeset
129 public static class JumpOp extends LIRInstruction implements BlockEndOp {
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
130 public static final LIRInstructionClass<JumpOp> TYPE = LIRInstructionClass.create(JumpOp.class);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7369
diff changeset
131
21216
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
132 private static final Value[] NO_VALUES = new Value[0];
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
133
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
134 @Alive({REG, STACK, CONST}) private Value[] outgoingValues;
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
135
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
136 private final LabelRef destination;
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
137
8293
ae7e78091f03 Cleanup branching and jumps in LIRGenerator: JumpOp/BranchOp do not need a state. In emitBranch, emitNullCheckBranch, emitCompareBranch, emitOverflowCheckBranch and emitIntegerTestBranch both targets are always provided.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7890
diff changeset
138 public JumpOp(LabelRef destination) {
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
139 this(TYPE, destination);
21216
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
140 this.outgoingValues = NO_VALUES;
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
141 }
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
142
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
143 protected JumpOp(LIRInstructionClass<? extends JumpOp> c, LabelRef destination) {
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
144 super(c);
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
145 this.destination = destination;
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
146 }
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
147
21216
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
148 public void setOutgoingValues(Value[] values) {
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
149 assert outgoingValues.length == 0;
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
150 outgoingValues = values;
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
151 }
04339fd2c863 Create SSA LIR.
Josef Eisl <josef.eisl@jku.at>
parents: 21198
diff changeset
152
21217
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
153 public int getOutgoingSize() {
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
154 return outgoingValues.length;
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
155 }
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
156
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
157 public Value getOutgoingValue(int idx) {
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
158 return outgoingValues[idx];
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
159 }
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
160
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
161 public void clearOutgoingValues() {
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
162 outgoingValues = NO_VALUES;
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
163 }
7223cb16dfa6 LabelOp/JumpOp: add accessors for incoming/outgoing values.
Josef Eisl <josef.eisl@jku.at>
parents: 21216
diff changeset
164
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
165 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12785
diff changeset
166 public void emitCode(CompilationResultBuilder crb) {
13318
da0851712519 moved emitting code for LIR and queries about whether an edge goes to its lexical successor "inside" CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13313
diff changeset
167 if (!crb.isSuccessorEdge(destination)) {
13269
8950e87ffcc9 don't emit code for a JumpOp that goes to its successor
Doug Simon <doug.simon@oracle.com>
parents: 13268
diff changeset
168 crb.asm.jmp(destination.label());
8950e87ffcc9 don't emit code for a JumpOp that goes to its successor
Doug Simon <doug.simon@oracle.com>
parents: 13268
diff changeset
169 }
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
170 }
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
171
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
172 public LabelRef destination() {
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
173 return destination;
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
174 }
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
175 }
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4435
diff changeset
176
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
177 /**
13268
68b964b6dc8e introduced BlockEndOp interface and require that every LIR block is terminated by such an operation
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
178 * Marker interface for a LIR operation that is a conditional jump.
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
179 */
13268
68b964b6dc8e introduced BlockEndOp interface and require that every LIR block is terminated by such an operation
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
180 public interface BranchOp extends BlockEndOp {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
182
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
183 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7369
diff changeset
184 * Marker interface for a LIR operation that moves a value from {@link #getInput()} to
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7369
diff changeset
185 * {@link #getResult()}.
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
186 */
19525
35481bcb5882 Remove LIRInstruction interface. Rename LIRInstructionBase to LIRInstruction.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18933
diff changeset
187 public interface MoveOp {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7369
diff changeset
188
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
189 Value getInput();
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7369
diff changeset
190
9297
a5f2b9012865 Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9247
diff changeset
191 AllocatableValue getResult();
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
192 }
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
193
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4245
diff changeset
194 /**
12610
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
195 * An operation that saves registers to the stack. The set of saved registers can be
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
196 * {@linkplain #remove(Set) pruned} and a mapping from registers to the frame slots in which
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
197 * they are saved can be {@linkplain #getMap(FrameMap) retrieved}.
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
198 */
19525
35481bcb5882 Remove LIRInstruction interface. Rename LIRInstructionBase to LIRInstruction.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18933
diff changeset
199 public interface SaveRegistersOp {
12610
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
200
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
201 /**
12613
595f01abb887 clearer API and documentation for the capability of a SaveRegistersOp to have its registers pruned
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
202 * Determines if the {@link #remove(Set)} operation is supported for this object.
595f01abb887 clearer API and documentation for the capability of a SaveRegistersOp to have its registers pruned
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
203 */
595f01abb887 clearer API and documentation for the capability of a SaveRegistersOp to have its registers pruned
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
204 boolean supportsRemove();
595f01abb887 clearer API and documentation for the capability of a SaveRegistersOp to have its registers pruned
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
205
595f01abb887 clearer API and documentation for the capability of a SaveRegistersOp to have its registers pruned
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
206 /**
12610
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
207 * Prunes {@code doNotSave} from the registers saved by this operation.
15157
f4e31f06b019 Create com.oracle.graal.cfg project and move CFG related files.
Josef Eisl <josef.eisl@jku.at>
parents: 14823
diff changeset
208 *
12610
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
209 * @param doNotSave registers that should not be saved by this operation
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
210 * @return the number of registers pruned
12613
595f01abb887 clearer API and documentation for the capability of a SaveRegistersOp to have its registers pruned
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
211 * @throws UnsupportedOperationException if removal is not {@linkplain #supportsRemove()
595f01abb887 clearer API and documentation for the capability of a SaveRegistersOp to have its registers pruned
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
212 * supported}
12610
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
213 */
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
214 int remove(Set<Register> doNotSave);
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
215
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
216 /**
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
217 * Gets a map from the saved registers saved by this operation to the frame slots in which
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
218 * they are saved.
15157
f4e31f06b019 Create com.oracle.graal.cfg project and move CFG related files.
Josef Eisl <josef.eisl@jku.at>
parents: 14823
diff changeset
219 *
18140
185bd9096c88 Remove FrameMap.indexForStackSlot().
Josef Eisl <josef.eisl@jku.at>
parents: 17604
diff changeset
220 * @param frameMap used to {@linkplain FrameMap#offsetForStackSlot(StackSlot) convert} a
12610
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
221 * virtual slot to a frame slot index
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
222 */
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
223 RegisterSaveLayout getMap(FrameMap frameMap);
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
224
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
225 }
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
226
62fb4919edc9 cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents: 11537
diff changeset
227 /**
13313
6dd9a1455e64 renamed PlaceholderOp to NoOp
Doug Simon <doug.simon@oracle.com>
parents: 13269
diff changeset
228 * A LIR operation that does nothing. If the operation records its position, it can be
6dd9a1455e64 renamed PlaceholderOp to NoOp
Doug Simon <doug.simon@oracle.com>
parents: 13269
diff changeset
229 * subsequently {@linkplain #replace(LIR, LIRInstruction) replaced}.
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
230 */
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
231 public static final class NoOp extends LIRInstruction {
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
232 public static final LIRInstructionClass<NoOp> TYPE = LIRInstructionClass.create(NoOp.class);
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
233
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
234 /**
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
235 * The block in which this instruction is located.
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
236 */
19560
4d70d150944f Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19526
diff changeset
237 final AbstractBlockBase<?> block;
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
238
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
239 /**
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
240 * The block index of this instruction.
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
241 */
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
242 final int index;
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
243
19560
4d70d150944f Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19526
diff changeset
244 public NoOp(AbstractBlockBase<?> block, int index) {
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
245 super(TYPE);
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
246 this.block = block;
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
247 this.index = index;
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
248 }
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
249
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
250 public void replace(LIR lir, LIRInstruction replacement) {
20070
aa8e0e2c5751 StandardOp.NoOp: assert that the right instruction is #replaced.
Josef Eisl <josef.eisl@jku.at>
parents: 19560
diff changeset
251 List<LIRInstruction> instructions = lir.getLIRforBlock(block);
aa8e0e2c5751 StandardOp.NoOp: assert that the right instruction is #replaced.
Josef Eisl <josef.eisl@jku.at>
parents: 19560
diff changeset
252 assert instructions.get(index).equals(this) : String.format("Replacing the wrong instruction: %s instead of %s", instructions.get(index), this);
aa8e0e2c5751 StandardOp.NoOp: assert that the right instruction is #replaced.
Josef Eisl <josef.eisl@jku.at>
parents: 19560
diff changeset
253 instructions.set(index, replacement);
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
254 }
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
255
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
256 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12785
diff changeset
257 public void emitCode(CompilationResultBuilder crb) {
13313
6dd9a1455e64 renamed PlaceholderOp to NoOp
Doug Simon <doug.simon@oracle.com>
parents: 13269
diff changeset
258 if (block != null) {
6dd9a1455e64 renamed PlaceholderOp to NoOp
Doug Simon <doug.simon@oracle.com>
parents: 13269
diff changeset
259 throw new GraalInternalError(this + " should have been replaced");
6dd9a1455e64 renamed PlaceholderOp to NoOp
Doug Simon <doug.simon@oracle.com>
parents: 13269
diff changeset
260 }
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
261 }
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8969
diff changeset
262 }
18933
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
263
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
264 @Opcode("BLACKHOLE")
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
265 public static final class BlackholeOp extends LIRInstruction {
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
266 public static final LIRInstructionClass<BlackholeOp> TYPE = LIRInstructionClass.create(BlackholeOp.class);
18933
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
267
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
268 @Use({REG, STACK}) private Value value;
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
269
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
270 public BlackholeOp(Value value) {
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19525
diff changeset
271 super(TYPE);
18933
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
272 this.value = value;
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
273 }
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
274
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
275 @Override
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
276 public void emitCode(CompilationResultBuilder crb) {
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
277 // do nothing, just keep value alive until at least here
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
278 }
76553fa0f02b Compiler intrinsic for JMH blackhole.
Roland Schatz <roland.schatz@oracle.com>
parents: 18443
diff changeset
279 }
21198
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
280
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
281 public static final class StackMove extends LIRInstruction implements MoveOp {
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
282 public static final LIRInstructionClass<StackMove> TYPE = LIRInstructionClass.create(StackMove.class);
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
283
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
284 @Def({STACK, HINT}) protected AllocatableValue result;
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
285 @Use({STACK}) protected Value input;
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
286
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
287 public StackMove(AllocatableValue result, Value input) {
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
288 super(TYPE);
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
289 this.result = result;
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
290 this.input = input;
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
291 }
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
292
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
293 @Override
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
294 public void emitCode(CompilationResultBuilder crb) {
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
295 throw new GraalInternalError(this + " should have been removed");
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
296 }
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
297
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
298 @Override
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
299 public Value getInput() {
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
300 return input;
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
301 }
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
302
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
303 @Override
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
304 public AllocatableValue getResult() {
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
305 return result;
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
306 }
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
307 }
d2bae7605fe4 Introduce StackMove LIR instruction.
Josef Eisl <josef.eisl@jku.at>
parents: 20070
diff changeset
308
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
309 }