annotate graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java @ 2769:dd6419f4bfe2

Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Mon, 23 May 2011 21:21:47 +0200
parents 43ffa0e47a46
children 3e3338a1abb9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
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.c1x.value.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
28 import com.sun.cri.ci.*;
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2764
diff changeset
29 import com.sun.xml.internal.messaging.saaj.packaging.mime.util.*;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
30
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
31 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
32 * 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
33 * 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
34 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
35 public final class Phi extends Value {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
36
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
37 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
38
2603
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
39 private static final int INPUT_COUNT = 1;
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
40 private static final int INPUT_BLOCK = 0;
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
41
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
42 private static final int SUCCESSOR_COUNT = 0;
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
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;
2603
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
45
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
46 @Override
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
47 protected int successorCount() {
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
48 return super.successorCount() + SUCCESSOR_COUNT;
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
49 }
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
50
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
51 /**
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
52 * The join block for this phi.
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
53 */
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
54 @Override
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
55 public BlockBegin block() {
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
56 return (BlockBegin) inputs().get(super.inputCount() + INPUT_BLOCK);
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
57 }
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
58
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
59 public Value setBlock(Value n) {
2603
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
60 return (BlockBegin) inputs().set(super.inputCount() + INPUT_BLOCK, n);
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
61 }
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
62
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
63 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
64 * 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
65 * @param kind the type of the variable
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
66 * @param block the join point
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
67 * @param index the index into the stack (if < 0) or local variables
2603
01c5c0443158 new node layout: Phi
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
68 * @param graph
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
69 */
2764
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
70 public Phi(CiKind kind, BlockBegin block, Graph graph) {
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
71 this(kind, block, DEFAULT_MAX_VALUES, graph);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
72 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
73
2764
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
74 public Phi(CiKind kind, BlockBegin block, int maxValues, Graph graph) {
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
75 super(kind, INPUT_COUNT + maxValues, SUCCESSOR_COUNT, graph);
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
76 usedInputCount = 1;
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
77 setBlock(block);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
78 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
79
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
80 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
81 * 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
82 * of the join block.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
83 * @param i the index of the predecessor
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
84 * @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
85 */
2764
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
86 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
87 return (Value) inputs().get(i + INPUT_COUNT);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
88 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
89
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
90 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
91 * 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
92 * @return the number of inputs in this phi
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
93 */
2764
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
94 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
95 return usedInputCount - 1;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
96 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
97
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
98 @Override
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
99 public void accept(ValueVisitor v) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
100 v.visitPhi(this);
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 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
104 * 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
105 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
106 public void makeDead() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
107 setFlag(Flag.PhiCannotSimplify);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
108 setFlag(Flag.PhiDead);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
109 }
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 @Override
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
112 public void print(LogStream out) {
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2764
diff changeset
113 out.print("phi function (");
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2764
diff changeset
114 for (int i = 0; i < inputs().size(); ++i) {
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2764
diff changeset
115 if (i != 0) {
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2764
diff changeset
116 out.print(' ');
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2764
diff changeset
117 }
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2764
diff changeset
118 out.print((Value) inputs().get(i));
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2764
diff changeset
119 }
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2764
diff changeset
120 out.print(')');
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
121 }
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
122
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
123 @Override
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
124 public String shortName() {
2764
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
125 return "Phi: (" + valueCount() + ")";
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
126 }
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
127
2764
99912abb3ff7 Phi clean up. Phis no longer save their local/stack index.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
128 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
129 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
130 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
131 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
132 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
133 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
134 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
135 }
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
136 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
137 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
138 } 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
139 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
140 }
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
141 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
142 }
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
143
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
144 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
145 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
146 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
147 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
148 }
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
149 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
150 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
151 }