Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/lir/LIRTableSwitch.java @ 2761:d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Sat, 21 May 2011 17:46:54 +0200 |
parents | a2f62de90c76 |
children | 5e8a69041cd7 |
comparison
equal
deleted
inserted
replaced
2760:127db58b044e | 2761:d3398b21faf9 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.sun.c1x.lir; | 23 package com.sun.c1x.lir; |
24 | 24 |
25 import com.sun.c1x.ir.*; | |
25 import com.sun.cri.ci.*; | 26 import com.sun.cri.ci.*; |
26 | 27 |
27 /** | 28 /** |
28 * @author Doug Simon | 29 * @author Doug Simon |
29 */ | 30 */ |
63 buf.append("\ncase ").append(key).append(": [B").append(b.blockID()).append(']'); | 64 buf.append("\ncase ").append(key).append(": [B").append(b.blockID()).append(']'); |
64 key++; | 65 key++; |
65 } | 66 } |
66 return buf.toString(); | 67 return buf.toString(); |
67 } | 68 } |
69 | |
70 | |
71 private LIRBlock substitute(LIRBlock block, LIRBlock oldBlock, LIRBlock newBlock) { | |
72 if (block == oldBlock) { | |
73 LIRInstruction instr = newBlock.lir().instructionsList().get(0); | |
74 assert instr instanceof LIRLabel : "first instruction of block must be label"; | |
75 return newBlock; | |
76 } | |
77 return oldBlock; | |
78 } | |
79 | |
80 public void substitute(LIRBlock oldBlock, LIRBlock newBlock) { | |
81 if (substitute(defaultTarget, oldBlock, newBlock) == newBlock) { | |
82 defaultTarget = newBlock; | |
83 } | |
84 for (int i = 0; i < targets.length; i++) { | |
85 if (substitute(targets[i], oldBlock, newBlock) == newBlock) { | |
86 targets[i] = newBlock; | |
87 } | |
88 } | |
89 } | |
68 } | 90 } |