comparison graal/GraalCompiler/src/com/sun/c1x/graph/IR.java @ 2602:0c6564c254af

new node layout: BlockBegin, BlockEnd -Dc1x.dot=regex for pdf output escape dot graph labels (<, >, &)
author Lukas Stadler <lukas.stadler@jku.at>
date Fri, 06 May 2011 10:25:37 +0200
parents fec99fc30af1
children 3558ca7088c0
comparison
equal deleted inserted replaced
2601:224e8b4007bd 2602:0c6564c254af
22 */ 22 */
23 package com.sun.c1x.graph; 23 package com.sun.c1x.graph;
24 24
25 import java.util.*; 25 import java.util.*;
26 26
27 import com.oracle.graal.graph.*;
27 import com.sun.c1x.*; 28 import com.sun.c1x.*;
28 import com.sun.c1x.debug.*; 29 import com.sun.c1x.debug.*;
29 import com.sun.c1x.ir.*; 30 import com.sun.c1x.ir.*;
30 import com.sun.c1x.observer.*; 31 import com.sun.c1x.observer.*;
31 import com.sun.c1x.value.*; 32 import com.sun.c1x.value.*;
59 /** 60 /**
60 * The linear-scan ordered list of blocks. 61 * The linear-scan ordered list of blocks.
61 */ 62 */
62 private List<BlockBegin> orderedBlocks; 63 private List<BlockBegin> orderedBlocks;
63 64
65 private final Graph graph = new Graph();
66
64 /** 67 /**
65 * Creates a new IR instance for the specified compilation. 68 * Creates a new IR instance for the specified compilation.
66 * @param compilation the compilation 69 * @param compilation the compilation
67 */ 70 */
68 public IR(C1XCompilation compilation) { 71 public IR(C1XCompilation compilation) {
91 } 94 }
92 } 95 }
93 96
94 private void buildGraph() { 97 private void buildGraph() {
95 // Graph builder must set the startBlock and the osrEntryBlock 98 // Graph builder must set the startBlock and the osrEntryBlock
96 new GraphBuilder(compilation, this).build(); 99 new GraphBuilder(compilation, this, graph).build();
97 assert startBlock != null; 100 assert startBlock != null;
98 verifyAndPrint("After graph building"); 101 verifyAndPrint("After graph building");
99 102
100 if (C1XOptions.PrintCompilation) { 103 if (C1XOptions.PrintCompilation) {
101 TTY.print(String.format("%3d blocks | ", this.numberOfBlocks())); 104 TTY.print(String.format("%3d blocks | ", this.numberOfBlocks()));
171 } else { 174 } else {
172 bci = source.end().bci(); 175 bci = source.end().bci();
173 } 176 }
174 177
175 // create new successor and mark it for special block order treatment 178 // create new successor and mark it for special block order treatment
176 BlockBegin newSucc = new BlockBegin(bci, nextBlockNumber()); 179 BlockBegin newSucc = new BlockBegin(bci, nextBlockNumber(), graph);
177 180
178 newSucc.setCriticalEdgeSplit(true); 181 newSucc.setCriticalEdgeSplit(true);
179 182
180 // This goto is not a safepoint. 183 // This goto is not a safepoint.
181 Goto e = new Goto(target, null, false); 184 Goto e = new Goto(target, null, false, graph);
182 newSucc.appendNext(e, bci); 185 newSucc.appendNext(e, bci);
183 newSucc.setEnd(e); 186 newSucc.setEnd(e);
184 // setup states 187 // setup states
185 FrameState s = source.end().stateAfter(); 188 FrameState s = source.end().stateAfter();
186 newSucc.setStateBefore(s); 189 newSucc.setStateBefore(s);
224 pred.end().substituteSuccessor(oldBlock, newBlock); 227 pred.end().substituteSuccessor(oldBlock, newBlock);
225 // and add each predecessor to the successor 228 // and add each predecessor to the successor
226 newBlock.addPredecessor(pred); 229 newBlock.addPredecessor(pred);
227 } 230 }
228 // this block is now disconnected; remove all its incoming and outgoing edges 231 // this block is now disconnected; remove all its incoming and outgoing edges
229 oldBlock.blockPredecessors().clear(); 232 // oldBlock.blockPredecessors().clear();
230 oldBlock.end().blockSuccessors().clear(); 233 // oldBlock.end().blockSuccessors().clear();
231 } 234 }
232 235
233 /** 236 /**
234 * Disconnects the specified block from all other blocks. 237 * Disconnects the specified block from all other blocks.
235 * @param block the block to remove from the graph 238 * @param block the block to remove from the graph
271 * @return the number of locks 274 * @return the number of locks
272 */ 275 */
273 public final int maxLocks() { 276 public final int maxLocks() {
274 return maxLocks; 277 return maxLocks;
275 } 278 }
279
280 public Graph graph() {
281 return graph;
282 }
276 } 283 }