Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/lir/LIRTableSwitch.java @ 2718:c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Thu, 19 May 2011 16:05:42 +0200 |
parents | 16b9a8b5ad39 |
children | c379183d1c54 |
comparison
equal
deleted
inserted
replaced
2717:bd85cf08720a | 2718:c1ce2a53d6c3 |
---|---|
64 buf.append("\ncase ").append(key).append(": [B").append(b.blockID).append(']'); | 64 buf.append("\ncase ").append(key).append(": [B").append(b.blockID).append(']'); |
65 key++; | 65 key++; |
66 } | 66 } |
67 return buf.toString(); | 67 return buf.toString(); |
68 } | 68 } |
69 | |
70 private BlockBegin substitute(BlockBegin block, BlockBegin oldBlock, BlockBegin newBlock) { | |
71 if (block == oldBlock) { | |
72 LIRInstruction instr = newBlock.lir().instructionsList().get(0); | |
73 assert instr instanceof LIRLabel : "first instruction of block must be label"; | |
74 return newBlock; | |
75 } | |
76 return oldBlock; | |
77 } | |
78 | |
79 public void substitute(BlockBegin oldBlock, BlockBegin newBlock) { | |
80 if (substitute(defaultTarget, oldBlock, newBlock) == newBlock) { | |
81 defaultTarget = newBlock; | |
82 } | |
83 for (int i = 0; i < targets.length; i++) { | |
84 if (substitute(targets[i], oldBlock, newBlock) == newBlock) { | |
85 targets[i] = newBlock; | |
86 } | |
87 } | |
88 } | |
89 } | 69 } |