comparison graal/GraalCompiler/src/com/sun/c1x/graph/CriticalEdgeFinder.java @ 2780:79dda81dd337

Cleanup
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 25 May 2011 11:12:51 +0200
parents 93ec3f067420
children df4c5254c5cc
comparison
equal deleted inserted replaced
2779:93ec3f067420 2780:79dda81dd337
97 * @param target the successor before which to insert a block 97 * @param target the successor before which to insert a block
98 * @return the new block inserted 98 * @return the new block inserted
99 */ 99 */
100 public LIRBlock splitEdge(LIRBlock source, LIRBlock target) { 100 public LIRBlock splitEdge(LIRBlock source, LIRBlock target) {
101 101
102 int backEdgeIndex = target.blockPredecessors().indexOf(source);
103
104 // create new successor and mark it for special block order treatment 102 // create new successor and mark it for special block order treatment
105 LIRBlock newSucc = new LIRBlock(lirBlocks.size()); 103 LIRBlock newSucc = new LIRBlock(lirBlocks.size());
106 lirBlocks.add(newSucc); 104 lirBlocks.add(newSucc);
107 105
108 List<Integer> removePhiInputs = null;
109 for (int i = backEdgeIndex + 1; i < target.blockPredecessors().size(); ++i) {
110 if (target.blockPredecessors().get(i) == source) {
111 if (removePhiInputs == null) {
112 removePhiInputs = new ArrayList<Integer>(4);
113 }
114 removePhiInputs.add(i);
115 }
116 }
117
118 // This goto is not a safepoint. 106 // This goto is not a safepoint.
119 Goto e = new Goto(target.getInstructions().get(0), graph); 107 Goto e = new Goto(target.getInstructions().get(0), graph);
120 newSucc.getInstructions().add(e); 108 newSucc.getInstructions().add(e);
121 //e.reorderSuccessor(0, backEdgeIndex);
122 109
123 // link predecessor to new block 110 // link predecessor to new block
124 ((BlockEnd) source.getInstructions().get(source.getInstructions().size() - 1)).successors().replace(target.getInstructions().get(0), newSucc.getInstructions().get(0)); 111 ((BlockEnd) source.getInstructions().get(source.getInstructions().size() - 1)).successors().replace(target.getInstructions().get(0), newSucc.getInstructions().get(0));
125 /* if (removePhiInputs != null && removePhiInputs.size() > 0) {
126
127 for (Node n : target.getInstructions().get(0).usages()) {
128 if (n instanceof Phi) {
129 Phi phi = (Phi) n;
130 int correction = 0;
131 for (int index : removePhiInputs) {
132 phi.removeInput(index - correction);
133 correction++;
134 }
135 }
136 }
137 }*/
138 112
139 source.substituteSuccessor(target, newSucc); 113 source.substituteSuccessor(target, newSucc);
140 target.substitutePredecessor(source, newSucc); 114 target.substitutePredecessor(source, newSucc);
141 newSucc.blockPredecessors().add(source); 115 newSucc.blockPredecessors().add(source);
142 newSucc.blockSuccessors().add(target); 116 newSucc.blockSuccessors().add(target);