Mercurial > hg > truffle
diff graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.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 | 127db58b044e |
children | 43ffa0e47a46 |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java Fri May 20 16:56:58 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java Sat May 21 17:46:54 2011 +0200 @@ -28,6 +28,7 @@ import com.sun.c1x.alloc.*; import com.sun.c1x.debug.*; import com.sun.c1x.ir.*; +import com.sun.c1x.util.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; @@ -203,4 +204,18 @@ public FrameState stateBefore() { return stateBefore; } + + public void replaceWith(LIRBlock other) { + for (LIRBlock pred : predecessors) { + Util.replaceAllInList(this, other, pred.successors); + } + for (int i = 0; i < other.predecessors.size(); ++i) { + if (other.predecessors.get(i) == this) { + other.predecessors.remove(i); + other.predecessors.addAll(i, this.predecessors); + } + } + successors.clear(); + predecessors.clear(); + } }