Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java @ 15637:40f13c935d8b
mx: fix constructor call
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Wed, 14 May 2014 11:08:05 +0200 |
parents | 96bb07a5d667 |
children | f315b1c0a590 |
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 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
30 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
|
31 import com.oracle.graal.api.meta.*; |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15192
diff
changeset
|
32 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
|
33 import com.oracle.graal.compiler.common.cfg.*; |
6500
8fd4201ce98c
moved TTY and LogStream to com.oracle.graal.debug
Doug Simon <doug.simon@oracle.com>
parents:
6462
diff
changeset
|
34 import com.oracle.graal.debug.*; |
9776
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
35 import com.oracle.graal.lir.LIRInstruction.OperandFlag; |
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
36 import com.oracle.graal.lir.LIRInstruction.OperandMode; |
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
37 import com.oracle.graal.lir.LIRInstruction.ValueProcedure; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
38 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
39 public final class LIRVerifier { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
40 |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
41 private final LIR lir; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
42 private final FrameMap frameMap; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
43 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
44 private final boolean beforeRegisterAllocation; |
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 final BitSet[] blockLiveOut; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
47 private final Object[] variableDefinitions; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
48 |
14786
a6595f1b55b0
Make LIR use AbstractBlock. (errors)
Josef Eisl <josef.eisl@jku.at>
parents:
9776
diff
changeset
|
49 private BitSet liveOutFor(AbstractBlock<?> block) { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
50 return blockLiveOut[block.getId()]; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
51 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
52 |
14786
a6595f1b55b0
Make LIR use AbstractBlock. (errors)
Josef Eisl <josef.eisl@jku.at>
parents:
9776
diff
changeset
|
53 private void setLiveOutFor(AbstractBlock<?> block, BitSet liveOut) { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
54 blockLiveOut[block.getId()] = liveOut; |
4169
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 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
57 private int maxRegisterNum() { |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
58 return frameMap.target.arch.getRegisters().length; |
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 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
61 private boolean isAllocatableRegister(Value value) { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
62 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
|
63 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
64 |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
65 public static boolean verify(final LIRInstruction op) { |
5797 | 66 ValueProcedure allowedProc = new ValueProcedure() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
67 |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
68 @Override |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
69 public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) { |
5797 | 70 return allowed(op, value, mode, flags); |
71 } | |
72 }; | |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
73 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
74 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
|
75 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
|
76 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
|
77 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
|
78 op.forEachOutput(allowedProc); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
79 |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
80 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
|
81 return true; |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
82 } |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
83 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
84 public static boolean verify(boolean beforeRegisterAllocation, LIR lir, FrameMap frameMap) { |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
85 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
|
86 verifier.verify(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
87 return true; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
88 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
89 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
90 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
|
91 this.beforeRegisterAllocation = beforeRegisterAllocation; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
92 this.lir = lir; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
93 this.frameMap = frameMap; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
94 this.blockLiveOut = new BitSet[lir.linearScanOrder().size()]; |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4199
diff
changeset
|
95 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
|
96 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
97 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
98 private BitSet curVariablesLive; |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
99 private Value[] curRegistersLive; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
100 |
14786
a6595f1b55b0
Make LIR use AbstractBlock. (errors)
Josef Eisl <josef.eisl@jku.at>
parents:
9776
diff
changeset
|
101 private AbstractBlock<?> curBlock; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
102 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
|
103 private BitSet curRegistersDefined; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
104 |
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
|
105 private void verify() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
106 ValueProcedure useProc = new ValueProcedure() { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
107 |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
108 @Override |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
109 public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
110 return use(value, mode, flags); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
111 } |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
112 }; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
113 ValueProcedure defProc = new ValueProcedure() { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
114 |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
115 @Override |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
116 public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
117 return def(value, mode, flags); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
118 } |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
119 }; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
120 |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
121 int maxRegisterNum = maxRegisterNum(); |
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
|
122 curRegistersDefined = new BitSet(); |
14786
a6595f1b55b0
Make LIR use AbstractBlock. (errors)
Josef Eisl <josef.eisl@jku.at>
parents:
9776
diff
changeset
|
123 for (AbstractBlock<?> block : lir.linearScanOrder()) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
124 curBlock = block; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
125 curVariablesLive = new BitSet(); |
6582
cc32ce37eddc
deleted Architecture.twoOperandMode() and encapsulated all public fields in Architecture with getters
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
126 curRegistersLive = new Value[maxRegisterNum]; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
127 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
128 if (block.getDominator() != null) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
129 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
|
130 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
131 |
14806
a8723f1ff542
LIR renamed setter and getter functions.
Josef Eisl <josef.eisl@jku.at>
parents:
14786
diff
changeset
|
132 assert lir.getLIRforBlock(block).get(0) instanceof StandardOp.LabelOp : "block must start with label"; |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
133 |
7497
0f8c6dbf68be
Code clean up and documentation for ComputeBlockOrder class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7327
diff
changeset
|
134 if (block.getSuccessorCount() > 0) { |
14806
a8723f1ff542
LIR renamed setter and getter functions.
Josef Eisl <josef.eisl@jku.at>
parents:
14786
diff
changeset
|
135 LIRInstruction last = lir.getLIRforBlock(block).get(lir.getLIRforBlock(block).size() - 1); |
6462 | 136 assert last instanceof StandardOp.JumpOp : "block with successor must end with unconditional jump"; |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
137 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4317
diff
changeset
|
138 |
14806
a8723f1ff542
LIR renamed setter and getter functions.
Josef Eisl <josef.eisl@jku.at>
parents:
14786
diff
changeset
|
139 for (LIRInstruction op : lir.getLIRforBlock(block)) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
140 curInstruction = op; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
141 |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
142 op.forEachInput(useProc); |
9454
85a836bcd796
renaming for improved clarity: hasCall -> destroysCallerSavedRegisters
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
143 if (op.destroysCallerSavedRegisters()) { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
144 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
|
145 curRegistersLive[register.number] = null; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
146 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
147 } |
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
|
148 curRegistersDefined.clear(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
149 op.forEachAlive(useProc); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
150 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
|
151 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
|
152 op.forEachOutput(defProc); |
4169
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 curInstruction = null; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
155 } |
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 setLiveOutFor(block, curVariablesLive); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
158 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
159 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
160 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
161 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
|
162 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
|
163 |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
164 if (isVariable(value)) { |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
165 assert beforeRegisterAllocation; |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
166 |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
167 int variableIdx = asVariable(value).index; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
168 if (!curVariablesLive.get(variableIdx)) { |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
169 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
|
170 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
|
171 if (variableDefinitions[variableIdx] != null) { |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
172 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
|
173 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
174 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
|
175 throw GraalInternalError.shouldNotReachHere(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
176 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
177 |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
178 } else if (isAllocatableRegister(value)) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
179 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
|
180 if (mode == OperandMode.ALIVE) { |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
181 curRegistersDefined.set(regNum); |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
182 } |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
183 |
9638
c455c86138ba
Value: more occurrences of object equality replaced
Bernhard Urban <bernhard.urban@jku.at>
parents:
9454
diff
changeset
|
184 if (beforeRegisterAllocation && !curRegistersLive[regNum].equals(value)) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
185 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
|
186 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
|
187 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
|
188 throw GraalInternalError.shouldNotReachHere(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
189 } |
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 return value; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
192 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
193 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
194 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
|
195 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
|
196 |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
197 if (isVariable(value)) { |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
198 assert beforeRegisterAllocation; |
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
199 |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
200 int variableIdx = asVariable(value).index; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
201 if (variableDefinitions[variableIdx] != null) { |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
202 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
|
203 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
|
204 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
|
205 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
|
206 throw GraalInternalError.shouldNotReachHere(); |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
207 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
208 assert curInstruction != null; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
209 variableDefinitions[variableIdx] = curInstruction; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
210 assert !curVariablesLive.get(variableIdx); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
211 if (mode == OperandMode.DEF) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
212 curVariablesLive.set(variableIdx); |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
213 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
214 |
4317
ef004bae30ae
Improvement to LIR Verification
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4290
diff
changeset
|
215 } else if (isAllocatableRegister(value)) { |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
216 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
|
217 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
|
218 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
|
219 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
|
220 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
|
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 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
|
223 |
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 if (beforeRegisterAllocation) { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5552
diff
changeset
|
225 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
|
226 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
|
227 } 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
|
228 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
|
229 } |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
230 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
231 } |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
232 return value; |
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
233 } |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
234 |
9776
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
235 // @formatter:off |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
236 private static Value allowed(Object op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { |
9776
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
237 if ((isVariable(value) && flags.contains(OperandFlag.REG)) || |
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
238 (isRegister(value) && flags.contains(OperandFlag.REG)) || |
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
239 (isStackSlot(value) && flags.contains(OperandFlag.STACK)) || |
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
240 (isConstant(value) && flags.contains(OperandFlag.CONST) && mode != OperandMode.DEF) || |
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
241 (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
|
242 return value; |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
243 } |
9776
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
244 throw new GraalInternalError("Invalid LIR%n Instruction: %s%n Mode: %s%n Flags: %s%n Unexpected value: %s %s", |
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
245 op, mode, flags, value.getClass().getSimpleName(), value); |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4212
diff
changeset
|
246 } |
9776
f43313f3f759
put error details into exception instead of printing to the console
Doug Simon <doug.simon@oracle.com>
parents:
9638
diff
changeset
|
247 // @formatter:on |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
diff
changeset
|
248 } |