comparison graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java @ 2756:bfcdda4fdd73

Removed the direct connection between BlockBegin and BlockEnd.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Fri, 20 May 2011 14:51:45 +0200
parents c1a9bf38da28
children 27512ea6bbcb
comparison
equal deleted inserted replaced
2754:e91608c2daff 2756:bfcdda4fdd73
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
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.ir; 23 package com.sun.c1x.ir;
24
25 import java.util.*;
24 26
25 import com.oracle.graal.graph.*; 27 import com.oracle.graal.graph.*;
26 import com.sun.c1x.*; 28 import com.sun.c1x.*;
27 import com.sun.c1x.value.*; 29 import com.sun.c1x.value.*;
28 import com.sun.cri.ci.*; 30 import com.sun.cri.ci.*;
110 } 112 }
111 113
112 @Override 114 @Override
113 public BlockBegin block() { 115 public BlockBegin block() {
114 Instruction cur = this; 116 Instruction cur = this;
115 while (!(cur instanceof BlockEnd)) { 117 while (!(cur instanceof BlockBegin)) {
116 cur = cur.next(); 118 List<Node> preds = cur.predecessors();
119 cur = (Instruction) preds.get(0);
117 } 120 }
118 return ((BlockEnd) cur).begin(); 121 return (BlockBegin) cur;
119 } 122 }
120 123
121 /** 124 /**
122 * Compute the value number of this Instruction. Local and global value numbering 125 * Compute the value number of this Instruction. Local and global value numbering
123 * optimizations use a hash map, and the value number provides a hash code. 126 * optimizations use a hash map, and the value number provides a hash code.