comparison graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java @ 2716:c1a9bf38da28

Removed bci from the Instruction class.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Thu, 19 May 2011 13:59:55 +0200
parents 3ac3dd97d8df
children bfcdda4fdd73
comparison
equal deleted inserted replaced
2715:3ac3dd97d8df 2716:c1a9bf38da28
69 } 69 }
70 70
71 71
72 public static final int SYNCHRONIZATION_ENTRY_BCI = -1; 72 public static final int SYNCHRONIZATION_ENTRY_BCI = -1;
73 73
74 /**
75 * Index of bytecode that generated this node when appended in a basic block.
76 * Negative values indicate special cases.
77 */
78 private int bci;
79
80 private boolean isAppended = false; 74 private boolean isAppended = false;
81 75
82 /** 76 /**
83 * Constructs a new instruction with the specified value type. 77 * Constructs a new instruction with the specified value type.
84 * @param kind the value type for this instruction 78 * @param kind the value type for this instruction
86 * @param successorCount 80 * @param successorCount
87 */ 81 */
88 public Instruction(CiKind kind, int inputCount, int successorCount, Graph graph) { 82 public Instruction(CiKind kind, int inputCount, int successorCount, Graph graph) {
89 super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); 83 super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
90 C1XMetrics.HIRInstructions++; 84 C1XMetrics.HIRInstructions++;
91 }
92
93 /**
94 * Gets the bytecode index of this instruction.
95 * @return the bytecode index of this instruction
96 */
97 public final int bci() {
98 return bci;
99 }
100
101 /**
102 * Sets the bytecode index of this instruction.
103 * @param bci the new bytecode index for this instruction
104 */
105 public final void setBCI(int bci) {
106 assert bci >= 0 || bci == SYNCHRONIZATION_ENTRY_BCI;
107 this.bci = bci;
108 } 85 }
109 86
110 /** 87 /**
111 * Checks whether this instruction has already been added to its basic block. 88 * Checks whether this instruction has already been added to its basic block.
112 * @return {@code true} if this instruction has been added to the basic block containing it 89 * @return {@code true} if this instruction has been added to the basic block containing it
121 * set the next field of a phi, block end, or local instruction. 98 * set the next field of a phi, block end, or local instruction.
122 * @param next the next instruction 99 * @param next the next instruction
123 * @param bci the bytecode index of the next instruction 100 * @param bci the bytecode index of the next instruction
124 * @return the new next instruction 101 * @return the new next instruction
125 */ 102 */
126 public final Instruction appendNext(Instruction next, int bci) { 103 public final Instruction appendNext(Instruction next) {
127 setNext(next); 104 setNext(next);
128 if (next != null) { 105 if (next != null) {
129 assert !(this instanceof BlockEnd); 106 assert !(this instanceof BlockEnd);
130 next.setBCI(bci);
131 next.isAppended = true; 107 next.isAppended = true;
132 } 108 }
133 return next; 109 return next;
134 } 110 }
135 111
136 @Override 112 @Override
137 public BlockBegin block() { 113 public BlockBegin block() {
138 // TODO(tw): Make this more efficient.
139 Instruction cur = this; 114 Instruction cur = this;
140 while (!(cur instanceof BlockEnd)) { 115 while (!(cur instanceof BlockEnd)) {
141 cur = cur.next(); 116 cur = cur.next();
142 } 117 }
143 return ((BlockEnd) cur).begin(); 118 return ((BlockEnd) cur).begin();