Mercurial > hg > truffle
annotate graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Block.java @ 2874:d90bf514d647
Renamed packages.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 08 Jun 2011 08:59:54 +0200 |
parents | graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/schedule/Block.java@0341b6424579 |
children | 41318fcb6b56 |
rev | line source |
---|---|
2744
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1 /* |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
2 * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
4 * |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
8 * |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
13 * accompanied this code). |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
14 * |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
18 * |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
21 * questions. |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
22 */ |
2874
d90bf514d647
Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2872
diff
changeset
|
23 package com.oracle.max.graal.compiler.schedule; |
2744
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
24 |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
25 import java.util.*; |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
26 |
2874
d90bf514d647
Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2872
diff
changeset
|
27 import com.oracle.max.graal.compiler.ir.*; |
d90bf514d647
Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2872
diff
changeset
|
28 import com.oracle.max.graal.graph.*; |
2777
3e4d992fd312
towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2751
diff
changeset
|
29 |
2744
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
30 |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
31 public class Block { |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
32 |
2751
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
33 private int blockID; |
2744
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
34 private final List<Block> successors = new ArrayList<Block>(); |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
35 private final List<Block> predecessors = new ArrayList<Block>(); |
2801
2af109bec0c0
Make block contains a list of nodes instead a list of instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2800
diff
changeset
|
36 private List<Node> instructions = new ArrayList<Node>(); |
2800
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
37 private Block dominator; |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
38 private final List<Block> dominators = new ArrayList<Block>(); |
2744
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
39 |
2805
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
40 private Node firstNode; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
41 private Node lastNode; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
42 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
43 public Node firstNode() { |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
44 return firstNode; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
45 } |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
46 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
47 public void setFirstNode(Node node) { |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
48 this.firstNode = node; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
49 } |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
50 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
51 public Node lastNode() { |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
52 return lastNode; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
53 } |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
54 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
55 public void setLastNode(Node node) { |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
56 this.lastNode = node; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
57 } |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
58 |
2744
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
59 public List<Block> getSuccessors() { |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
60 return Collections.unmodifiableList(successors); |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
61 } |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
62 |
2800
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
63 public void setDominator(Block dominator) { |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
64 assert this.dominator == null; |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
65 assert dominator != null; |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
66 this.dominator = dominator; |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
67 dominator.dominators.add(this); |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
68 } |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
69 |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
70 public List<Block> getDominators() { |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
71 return Collections.unmodifiableList(dominators); |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
72 } |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
73 |
2801
2af109bec0c0
Make block contains a list of nodes instead a list of instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2800
diff
changeset
|
74 public List<Node> getInstructions() { |
2777
3e4d992fd312
towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2751
diff
changeset
|
75 return instructions; |
3e4d992fd312
towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2751
diff
changeset
|
76 } |
3e4d992fd312
towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2751
diff
changeset
|
77 |
2744
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
78 public List<Block> getPredecessors() { |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
79 return Collections.unmodifiableList(predecessors); |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
80 } |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
81 |
2751
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
82 public Block(int blockID) { |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
83 this.blockID = blockID; |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
84 } |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
85 |
2744
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
86 public void addSuccessor(Block other) { |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
87 successors.add(other); |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
88 other.predecessors.add(this); |
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
89 } |
2751
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
90 |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
91 public int blockID() { |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
92 return blockID; |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
93 } |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
94 |
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:
2780
diff
changeset
|
95 /** |
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:
2780
diff
changeset
|
96 * Iterate over this block, its exception handlers, and its successors, in that order. |
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:
2780
diff
changeset
|
97 * |
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:
2780
diff
changeset
|
98 * @param closure the closure to apply to each 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:
2780
diff
changeset
|
99 */ |
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:
2780
diff
changeset
|
100 public void iteratePreOrder(BlockClosure closure) { |
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:
2780
diff
changeset
|
101 // XXX: identity hash map might be too slow, consider a boolean array or a mark field |
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:
2780
diff
changeset
|
102 iterate(new IdentityHashMap<Block, Block>(), closure); |
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:
2780
diff
changeset
|
103 } |
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:
2780
diff
changeset
|
104 |
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:
2780
diff
changeset
|
105 private void iterate(IdentityHashMap<Block, Block> mark, BlockClosure closure) { |
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:
2780
diff
changeset
|
106 if (!mark.containsKey(this)) { |
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:
2780
diff
changeset
|
107 mark.put(this, this); |
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:
2780
diff
changeset
|
108 closure.apply(this); |
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:
2780
diff
changeset
|
109 |
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:
2780
diff
changeset
|
110 iterateReverse(mark, closure, this.successors); |
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:
2780
diff
changeset
|
111 } |
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:
2780
diff
changeset
|
112 } |
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:
2780
diff
changeset
|
113 |
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:
2780
diff
changeset
|
114 private void iterateReverse(IdentityHashMap<Block, Block> mark, BlockClosure closure, List<Block> list) { |
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:
2780
diff
changeset
|
115 for (int i = list.size() - 1; i >= 0; i--) { |
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:
2780
diff
changeset
|
116 list.get(i).iterate(mark, closure); |
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:
2780
diff
changeset
|
117 } |
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:
2780
diff
changeset
|
118 } |
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:
2780
diff
changeset
|
119 |
2751
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
120 @Override |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
121 public String toString() { |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
122 return "B" + blockID; |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2744
diff
changeset
|
123 } |
2800
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
124 |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
125 public Block dominator() { |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
126 return dominator; |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
127 } |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
128 |
2801
2af109bec0c0
Make block contains a list of nodes instead a list of instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2800
diff
changeset
|
129 public void setInstructions(List<Node> instructions) { |
2800
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
130 this.instructions = instructions; |
e3a0630a1dab
added code for computing dominators.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2793
diff
changeset
|
131 } |
2744
45a58c9536de
Added BFS node iteration. Started drafting scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
132 } |