Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/graph/CriticalEdgeFinder.java @ 2790:50677668afe3
Towards making goto removal work.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 25 May 2011 19:29:40 +0200 |
parents | aeccd2af4e9e |
children | d6bf240963fb |
comparison
equal
deleted
inserted
replaced
2789:aeccd2af4e9e | 2790:50677668afe3 |
---|---|
103 LIRBlock newSucc = new LIRBlock(lirBlocks.size()); | 103 LIRBlock newSucc = new LIRBlock(lirBlocks.size()); |
104 lirBlocks.add(newSucc); | 104 lirBlocks.add(newSucc); |
105 | 105 |
106 // This goto is not a safepoint. | 106 // This goto is not a safepoint. |
107 Goto e = new Goto(null, graph); | 107 Goto e = new Goto(null, graph); |
108 | |
109 //TTY.println("SPLITTING NODE"); | |
110 // link predecessor to new block | |
111 // if (source.getInstructions().size() > 0) { | |
112 | |
113 Instruction sourceInstruction = source.getInstructions().get(source.getInstructions().size() - 1); | 108 Instruction sourceInstruction = source.getInstructions().get(source.getInstructions().size() - 1); |
114 Instruction targetInstruction = target.getInstructions().get(0); | 109 Instruction targetInstruction = target.getInstructions().get(0); |
115 int replacedIndex = sourceInstruction.successors().indexOf(targetInstruction); | 110 int sourceInstructionPredIndex = targetInstruction.predecessors().indexOf(sourceInstruction); |
111 int replacedIndex = targetInstruction.predecessorsIndex().get(sourceInstructionPredIndex); | |
116 assert replacedIndex != -1 && sourceInstruction.successors().get(replacedIndex) != null; | 112 assert replacedIndex != -1 && sourceInstruction.successors().get(replacedIndex) != null; |
117 e.successors().setAndClear(1, sourceInstruction, replacedIndex); | 113 e.successors().setAndClear(1, sourceInstruction, replacedIndex); |
118 sourceInstruction.successors().set(replacedIndex, e); | 114 sourceInstruction.successors().set(replacedIndex, e); |
119 newSucc.getInstructions().add(e); | 115 newSucc.getInstructions().add(e); |
120 // assert e.successors().get(0) != null; | |
121 assert e.defaultSuccessor() != null; | 116 assert e.defaultSuccessor() != null; |
122 // } | |
123 | |
124 | |
125 source.substituteSuccessor(target, newSucc); | 117 source.substituteSuccessor(target, newSucc); |
126 target.substitutePredecessor(source, newSucc); | 118 target.substitutePredecessor(source, newSucc); |
127 newSucc.blockPredecessors().add(source); | 119 newSucc.blockPredecessors().add(source); |
128 newSucc.blockSuccessors().add(target); | 120 newSucc.blockSuccessors().add(target); |
129 | |
130 return newSucc; | 121 return newSucc; |
131 } | 122 } |
132 } | 123 } |