Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java @ 5797:b3a87b533c0f
formatting fix
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 09 Jul 2012 22:17:00 +0200 |
parents | 141b15521a39 |
children | c5afcc2ebd3d |
rev | line source |
---|---|
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@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) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
4 * |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
8 * |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
14 * |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
18 * |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
21 * questions. |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@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; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
24 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
25 import static com.oracle.graal.api.code.ValueUtil.*; |
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
26 import static com.oracle.graal.lir.LIRValueUtil.*; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
27 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
28 import java.util.*; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
29 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
30 import com.oracle.max.criutils.*; |
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.LIRInstruction.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
35 import com.oracle.graal.lir.cfg.*; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
36 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
37 public final class LIRVerifier { |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
38 private final LIR lir; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
39 private final FrameMap frameMap; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
40 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
41 private final boolean beforeRegisterAllocation; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
42 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
43 private final BitSet[] blockLiveOut; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
44 private final Object[] variableDefinitions; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
45 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
46 private BitSet liveOutFor(Block block) { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
47 return blockLiveOut[block.getId()]; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
48 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
49 private void setLiveOutFor(Block block, BitSet liveOut) { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
50 blockLiveOut[block.getId()] = liveOut; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
51 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
52 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
53 private int maxRegisterNum() { |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
54 return frameMap.target.arch.registers.length; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
55 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
56 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
57 private boolean isAllocatableRegister(Value value) { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
58 return isRegister(value) && frameMap.registerConfig.getAttributesMap()[asRegister(value).number].isAllocatable(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
59 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
60 |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
61 public static boolean verify(final LIRInstruction op) { |
5797 | 62 ValueProcedure allowedProc = new ValueProcedure() { |
63 @Override public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) { | |
64 return allowed(op, value, mode, flags); | |
65 } | |
66 }; | |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
67 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
68 op.forEachInput(allowedProc); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
69 op.forEachAlive(allowedProc); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
70 op.forEachState(allowedProc); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
71 op.forEachTemp(allowedProc); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
72 op.forEachOutput(allowedProc); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
73 |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
74 op.verify(); |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
75 return true; |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
76 } |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
77 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
78 public static boolean verify(boolean beforeRegisterAllocation, LIR lir, FrameMap frameMap) { |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
79 LIRVerifier verifier = new LIRVerifier(beforeRegisterAllocation, lir, frameMap); |
4212
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
80 verifier.verify(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
81 return true; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
82 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
83 |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
84 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
85 private LIRVerifier(boolean beforeRegisterAllocation, LIR lir, FrameMap frameMap) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
86 this.beforeRegisterAllocation = beforeRegisterAllocation; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
87 this.lir = lir; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
88 this.frameMap = frameMap; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
89 this.blockLiveOut = new BitSet[lir.linearScanOrder().size()]; |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4199
diff
changeset
|
90 this.variableDefinitions = new Object[lir.numVariables()]; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
91 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
92 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
93 private BitSet curVariablesLive; |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
94 private Value[] curRegistersLive; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
95 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
96 private Block curBlock; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
97 private Object curInstruction; |
4290
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
98 private BitSet curRegistersDefined; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
99 |
4212
f282e35ea829
Define incoming parameters in a PARAMS instruction. This simplifies register allocation because the initial register state does not have to be inferred from the calling convention.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
100 private void verify() { |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
101 ValueProcedure useProc = new ValueProcedure() { @Override public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) { return use(value, mode, flags); } }; |
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
102 ValueProcedure defProc = new ValueProcedure() { @Override public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) { return def(value, mode, flags); } }; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
103 |
4290
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
104 curRegistersDefined = new BitSet(); |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
105 for (Block block : lir.linearScanOrder()) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
106 curBlock = block; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
107 curVariablesLive = new BitSet(); |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
108 curRegistersLive = new Value[maxRegisterNum()]; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
109 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
110 if (block.getDominator() != null) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
111 curVariablesLive.or(liveOutFor(block.getDominator())); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
112 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
113 |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
114 assert block.lir.get(0) instanceof StandardOp.LabelOp : "block must start with label"; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
115 if (block.numberOfPreds() > 1) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
116 assert block.lir.get(0) instanceof StandardOp.PhiLabelOp : "phi mapping required for multiple predecessors"; |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
117 Value[] phiDefinitions = ((StandardOp.PhiLabelOp) block.lir.get(0)).getPhiDefinitions(); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
118 if (!beforeRegisterAllocation) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
119 assert phiDefinitions.length == 0; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
120 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
121 for (Block pred : block.getPredecessors()) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
122 assert pred.numberOfSux() == 1; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
123 LIRInstruction last = pred.lir.get(pred.lir.size() - 1); |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
124 assert last instanceof StandardOp.PhiJumpOp : "phi mapping required for multiple successors"; |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
125 Value[] phiUses = ((StandardOp.PhiJumpOp) last).getPhiInputs(); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
126 if (!beforeRegisterAllocation) { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
127 assert phiUses.length == 0; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
128 } |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
129 } |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
130 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
131 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
132 if (block.numberOfSux() > 0) { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
133 LIRInstruction last = block.lir.get(block.lir.size() - 1); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
134 assert last instanceof StandardOp.JumpOp || last instanceof LIRXirInstruction : "block with successor must end with unconditional jump"; |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
135 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
136 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
137 for (LIRInstruction op : block.lir) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
138 curInstruction = op; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
139 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
140 op.forEachInput(useProc); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
141 if (op.hasCall()) { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
142 for (Register register : frameMap.registerConfig.getCallerSaveRegisters()) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
143 curRegistersLive[register.number] = null; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
144 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
145 } |
4290
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
146 curRegistersDefined.clear(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
147 op.forEachAlive(useProc); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
148 op.forEachState(useProc); |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
149 op.forEachTemp(defProc); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
150 op.forEachOutput(defProc); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
151 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
152 curInstruction = null; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
153 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
154 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
155 setLiveOutFor(block, curVariablesLive); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
156 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
157 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
158 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
159 private Value use(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:
4212
diff
changeset
|
160 allowed(curInstruction, value, mode, flags); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
161 |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
162 if (isVariable(value)) { |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
163 assert beforeRegisterAllocation; |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
164 |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
165 int variableIdx = asVariable(value).index; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
166 if (!curVariablesLive.get(variableIdx)) { |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
167 TTY.println("block %s instruction %s", curBlock, curInstruction); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
168 TTY.println("live variables: %s", curVariablesLive); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
169 if (variableDefinitions[variableIdx] != null) { |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
170 TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
171 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
172 TTY.println("ERROR: Use of variable %s that is not defined in dominator", value); |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
173 throw GraalInternalError.shouldNotReachHere(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
174 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
175 |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
176 } else if (isAllocatableRegister(value)) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
177 int regNum = asRegister(value).number; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
178 if (mode == OperandMode.ALIVE) { |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
179 curRegistersDefined.set(regNum); |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
180 } |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
181 |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
182 if (beforeRegisterAllocation && curRegistersLive[regNum] != value) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
183 TTY.println("block %s instruction %s", curBlock, curInstruction); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
184 TTY.println("live registers: %s", Arrays.toString(curRegistersLive)); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
185 TTY.println("ERROR: Use of fixed register %s that is not defined in this block", value); |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
186 throw GraalInternalError.shouldNotReachHere(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
187 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
188 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
189 return value; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
190 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
191 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
192 private Value def(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:
4212
diff
changeset
|
193 allowed(curInstruction, value, mode, flags); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
194 |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
195 if (isVariable(value)) { |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
196 assert beforeRegisterAllocation; |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
197 |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
198 int variableIdx = asVariable(value).index; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
199 if (variableDefinitions[variableIdx] != null) { |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
200 TTY.println("block %s instruction %s", curBlock, curInstruction); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
201 TTY.println("live variables: %s", curVariablesLive); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
202 TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
203 TTY.println("ERROR: Variable %s defined multiple times", value); |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
204 throw GraalInternalError.shouldNotReachHere(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
205 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
206 assert curInstruction != null; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
207 variableDefinitions[variableIdx] = curInstruction; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
208 assert !curVariablesLive.get(variableIdx); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
209 if (mode == OperandMode.DEF) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
210 curVariablesLive.set(variableIdx); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
211 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
212 |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
213 } else if (isAllocatableRegister(value)) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
214 int regNum = asRegister(value).number; |
4290
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
215 if (curRegistersDefined.get(regNum)) { |
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
216 TTY.println("block %s instruction %s", curBlock, curInstruction); |
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
217 TTY.println("ERROR: Same register defined twice in the same instruction: %s", value); |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
218 throw GraalInternalError.shouldNotReachHere(); |
4290
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
219 } |
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
220 curRegistersDefined.set(regNum); |
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
221 |
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
222 if (beforeRegisterAllocation) { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
223 if (mode == OperandMode.DEF) { |
4290
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
224 curRegistersLive[regNum] = value; |
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
225 } else { |
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
226 curRegistersLive[regNum] = null; |
21400bafb3ff
Enforce that one fixed register cannot be a temporary operand multiple times with different kinds
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
227 } |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
228 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
229 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
230 return value; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
231 } |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
232 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
233 private static Value allowed(Object op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
234 if ((isVariable(value) && flags.contains(OperandFlag.REG)) || |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
235 (isRegister(value) && flags.contains(OperandFlag.REG)) || |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
236 (isStackSlot(value) && flags.contains(OperandFlag.STACK)) || |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
237 (isConstant(value) && flags.contains(OperandFlag.CONST) && mode != OperandMode.DEF) || |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
238 (isIllegal(value) && flags.contains(OperandFlag.ILLEGAL))) { |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
239 return value; |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
240 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
241 TTY.println("instruction %s", op); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
242 TTY.println("mode: %s flags: %s", mode, flags); |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
243 TTY.println("Unexpected value: %s %s", value.getClass().getSimpleName(), value); |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
244 throw GraalInternalError.shouldNotReachHere(); |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
245 } |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
246 } |