Mercurial > hg > graal-jvmci-8
annotate graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java @ 2842:7596ae867a7b
basic inlining passes all tests, including optimistic inlining
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Wed, 01 Jun 2011 16:26:17 +0200 |
parents | bd17ac598c6e |
children | 7474789a8120 7f14e6b48a9c |
rev | line source |
---|---|
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1 /* |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
4 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
8 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
13 * accompanied this code). |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
14 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
18 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
21 * questions. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
22 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
23 package com.sun.c1x.ir; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
24 |
2603 | 25 import com.oracle.graal.graph.*; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
26 import com.sun.c1x.debug.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
27 import com.sun.cri.ci.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
28 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
29 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
30 * The {@code Phi} instruction represents the merging of dataflow |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
31 * in the instruction graph. It refers to a join block and a variable. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
32 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
33 public final class Phi extends Value { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
34 |
2769
dd6419f4bfe2
Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
35 private static final int DEFAULT_MAX_VALUES = 2; |
2764
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
36 |
2603 | 37 private static final int INPUT_COUNT = 1; |
38 private static final int INPUT_BLOCK = 0; | |
39 | |
2827
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
40 private final int maxValues; |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
41 |
2603 | 42 private static final int SUCCESSOR_COUNT = 0; |
43 | |
2764
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
44 private int usedInputCount; |
2821
015be60afcf3
removed flags from Value class
Lukas Stadler <lukas.stadler@jku.at>
parents:
2805
diff
changeset
|
45 private boolean isDead; |
2603 | 46 |
47 @Override | |
2827
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
48 protected int inputCount() { |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
49 return super.inputCount() + INPUT_COUNT + maxValues; |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
50 } |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
51 |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
52 @Override |
2603 | 53 protected int successorCount() { |
54 return super.successorCount() + SUCCESSOR_COUNT; | |
55 } | |
56 | |
57 /** | |
58 * The join block for this phi. | |
59 */ | |
2793
d3fc4fe063bf
Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2772
diff
changeset
|
60 public Merge block() { |
d3fc4fe063bf
Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2772
diff
changeset
|
61 return (Merge) inputs().get(super.inputCount() + INPUT_BLOCK); |
2603 | 62 } |
63 | |
2763
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
64 public Value setBlock(Value n) { |
2793
d3fc4fe063bf
Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2772
diff
changeset
|
65 return (Merge) inputs().set(super.inputCount() + INPUT_BLOCK, n); |
2603 | 66 } |
67 | |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
68 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
69 * Create a new Phi for the specified join block and local variable (or operand stack) slot. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
70 * @param kind the type of the variable |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
71 * @param block the join point |
2603 | 72 * @param graph |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
73 */ |
2793
d3fc4fe063bf
Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2772
diff
changeset
|
74 public Phi(CiKind kind, Merge block, Graph graph) { |
2764
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
75 this(kind, block, DEFAULT_MAX_VALUES, graph); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
76 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
77 |
2793
d3fc4fe063bf
Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2772
diff
changeset
|
78 public Phi(CiKind kind, Merge block, int maxValues, Graph graph) { |
2764
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
79 super(kind, INPUT_COUNT + maxValues, SUCCESSOR_COUNT, graph); |
2827
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
80 this.maxValues = maxValues; |
2764
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
81 usedInputCount = 1; |
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
82 setBlock(block); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
83 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
84 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
85 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
86 * Get the instruction that produces the value associated with the i'th predecessor |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
87 * of the join block. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
88 * @param i the index of the predecessor |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
89 * @return the instruction that produced the value in the i'th predecessor |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
90 */ |
2764
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
91 public Value valueAt(int i) { |
2763
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
92 return (Value) inputs().get(i + INPUT_COUNT); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
93 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
94 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
95 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
96 * Get the number of inputs to this phi (i.e. the number of predecessors to the join block). |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
97 * @return the number of inputs in this phi |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
98 */ |
2764
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
99 public int valueCount() { |
2763
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
100 return usedInputCount - 1; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
101 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
102 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
103 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
104 public void accept(ValueVisitor v) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
105 v.visitPhi(this); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
106 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
107 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
108 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
109 * Make this phi illegal if types were not merged correctly. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
110 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
111 public void makeDead() { |
2821
015be60afcf3
removed flags from Value class
Lukas Stadler <lukas.stadler@jku.at>
parents:
2805
diff
changeset
|
112 isDead = true; |
015be60afcf3
removed flags from Value class
Lukas Stadler <lukas.stadler@jku.at>
parents:
2805
diff
changeset
|
113 } |
015be60afcf3
removed flags from Value class
Lukas Stadler <lukas.stadler@jku.at>
parents:
2805
diff
changeset
|
114 |
015be60afcf3
removed flags from Value class
Lukas Stadler <lukas.stadler@jku.at>
parents:
2805
diff
changeset
|
115 public boolean isDead() { |
015be60afcf3
removed flags from Value class
Lukas Stadler <lukas.stadler@jku.at>
parents:
2805
diff
changeset
|
116 return isDead; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
117 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
118 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
119 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
120 public void print(LogStream out) { |
2768
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2764
diff
changeset
|
121 out.print("phi function ("); |
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2764
diff
changeset
|
122 for (int i = 0; i < inputs().size(); ++i) { |
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2764
diff
changeset
|
123 if (i != 0) { |
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2764
diff
changeset
|
124 out.print(' '); |
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2764
diff
changeset
|
125 } |
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2764
diff
changeset
|
126 out.print((Value) inputs().get(i)); |
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2764
diff
changeset
|
127 } |
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2764
diff
changeset
|
128 out.print(')'); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
129 } |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
130 |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
131 @Override |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
132 public String shortName() { |
2799
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
2793
diff
changeset
|
133 StringBuilder str = new StringBuilder(); |
2842
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2827
diff
changeset
|
134 for (int i = 0; i < valueCount(); ++i) { |
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2827
diff
changeset
|
135 if (i != 0) { |
2799
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
2793
diff
changeset
|
136 str.append(' '); |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
2793
diff
changeset
|
137 } |
2842
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2827
diff
changeset
|
138 str.append(valueAt(i) == null ? "-" : valueAt(i).id()); |
2799
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
2793
diff
changeset
|
139 } |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
2793
diff
changeset
|
140 return "Phi: (" + str + ")"; |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
141 } |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
142 |
2764
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
143 public Phi addInput(Node y) { |
2763
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
144 assert !this.isDeleted() && !y.isDeleted(); |
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
145 Phi phi = this; |
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
146 if (usedInputCount == inputs().size()) { |
2764
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
147 phi = new Phi(kind, block(), usedInputCount * 2, graph()); |
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
148 for (int i = 0; i < valueCount(); ++i) { |
99912abb3ff7
Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2763
diff
changeset
|
149 phi.addInput(valueAt(i)); |
2763
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
150 } |
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
151 phi.addInput(y); |
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
152 this.replace(phi); |
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
153 } else { |
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
154 phi.inputs().set(usedInputCount++, y); |
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
155 } |
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
156 return phi; |
5e8a69041cd7
Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
157 } |
2769
dd6419f4bfe2
Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
158 |
dd6419f4bfe2
Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
159 public void removeInput(int index) { |
dd6419f4bfe2
Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
160 inputs().set(index, null); |
dd6419f4bfe2
Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
161 for (int i = index + 1; i < usedInputCount; ++i) { |
dd6419f4bfe2
Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
162 inputs().set(i - 1, inputs().get(i)); |
dd6419f4bfe2
Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
163 } |
dd6419f4bfe2
Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
164 usedInputCount--; |
dd6419f4bfe2
Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
165 } |
2827
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
166 |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
167 @Override |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
168 public Node copy(Graph into) { |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
169 Phi x = new Phi(kind, null, maxValues, into); |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
170 x.usedInputCount = usedInputCount; |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
171 x.isDead = isDead; |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
172 x.setNonNull(isNonNull()); |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
173 return x; |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2821
diff
changeset
|
174 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
175 } |