comparison graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java @ 6329:92bc58dc5b5e

More clean up and documentation in api.code and api.meta.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 07 Sep 2012 13:40:53 +0200
parents 9418ff4c9e7c
children b76534871d06
comparison
equal deleted inserted replaced
6328:6e66d97a16ae 6329:92bc58dc5b5e
1019 * Determines the register priority for an instruction's output/result operand. 1019 * Determines the register priority for an instruction's output/result operand.
1020 */ 1020 */
1021 static RegisterPriority registerPriorityOfOutputOperand(LIRInstruction op) { 1021 static RegisterPriority registerPriorityOfOutputOperand(LIRInstruction op) {
1022 if (op instanceof MoveOp) { 1022 if (op instanceof MoveOp) {
1023 MoveOp move = (MoveOp) op; 1023 MoveOp move = (MoveOp) op;
1024 if (isStackSlot(move.getInput()) && move.getInput().kind != Kind.Object) { 1024 if (isStackSlot(move.getInput()) && move.getInput().getKind() != Kind.Object) {
1025 // method argument (condition must be equal to handleMethodArguments) 1025 // method argument (condition must be equal to handleMethodArguments)
1026 return RegisterPriority.None; 1026 return RegisterPriority.None;
1027 } 1027 }
1028 } 1028 }
1029 1029
1049 * spill slot. 1049 * spill slot.
1050 */ 1050 */
1051 void handleMethodArguments(LIRInstruction op) { 1051 void handleMethodArguments(LIRInstruction op) {
1052 if (op instanceof MoveOp) { 1052 if (op instanceof MoveOp) {
1053 MoveOp move = (MoveOp) op; 1053 MoveOp move = (MoveOp) op;
1054 if (isStackSlot(move.getInput()) && move.getInput().kind != Kind.Object) { 1054 if (isStackSlot(move.getInput()) && move.getInput().getKind() != Kind.Object) {
1055 StackSlot slot = (StackSlot) move.getInput(); 1055 StackSlot slot = (StackSlot) move.getInput();
1056 if (GraalOptions.DetailedAsserts) { 1056 if (GraalOptions.DetailedAsserts) {
1057 assert op.id() > 0 : "invalid id"; 1057 assert op.id() > 0 : "invalid id";
1058 assert blockForId(op.id()).numberOfPreds() == 0 : "move from stack must be in first block"; 1058 assert blockForId(op.id()).numberOfPreds() == 0 : "move from stack must be in first block";
1059 assert isVariable(move.getResult()) : "result of move must be a variable"; 1059 assert isVariable(move.getResult()) : "result of move must be a variable";
1152 1152
1153 op.forEachOutput(new ValueProcedure() { 1153 op.forEachOutput(new ValueProcedure() {
1154 @Override 1154 @Override
1155 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) { 1155 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
1156 if (isVariableOrRegister(operand)) { 1156 if (isVariableOrRegister(operand)) {
1157 addDef(operand, opId, registerPriorityOfOutputOperand(op), operand.kind.stackKind()); 1157 addDef(operand, opId, registerPriorityOfOutputOperand(op), operand.getKind().stackKind());
1158 addRegisterHint(op, operand, mode, flags); 1158 addRegisterHint(op, operand, mode, flags);
1159 } 1159 }
1160 return operand; 1160 return operand;
1161 } 1161 }
1162 }); 1162 });
1163 op.forEachTemp(new ValueProcedure() { 1163 op.forEachTemp(new ValueProcedure() {
1164 @Override 1164 @Override
1165 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) { 1165 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
1166 if (isVariableOrRegister(operand)) { 1166 if (isVariableOrRegister(operand)) {
1167 addTemp(operand, opId, RegisterPriority.MustHaveRegister, operand.kind.stackKind()); 1167 addTemp(operand, opId, RegisterPriority.MustHaveRegister, operand.getKind().stackKind());
1168 addRegisterHint(op, operand, mode, flags); 1168 addRegisterHint(op, operand, mode, flags);
1169 } 1169 }
1170 return operand; 1170 return operand;
1171 } 1171 }
1172 }); 1172 });
1173 op.forEachAlive(new ValueProcedure() { 1173 op.forEachAlive(new ValueProcedure() {
1174 @Override 1174 @Override
1175 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) { 1175 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
1176 if (isVariableOrRegister(operand)) { 1176 if (isVariableOrRegister(operand)) {
1177 RegisterPriority p = registerPriorityOfInputOperand(flags); 1177 RegisterPriority p = registerPriorityOfInputOperand(flags);
1178 addUse(operand, blockFrom, opId + 1, p, operand.kind.stackKind()); 1178 addUse(operand, blockFrom, opId + 1, p, operand.getKind().stackKind());
1179 addRegisterHint(op, operand, mode, flags); 1179 addRegisterHint(op, operand, mode, flags);
1180 } 1180 }
1181 return operand; 1181 return operand;
1182 } 1182 }
1183 }); 1183 });
1184 op.forEachInput(new ValueProcedure() { 1184 op.forEachInput(new ValueProcedure() {
1185 @Override 1185 @Override
1186 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) { 1186 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
1187 if (isVariableOrRegister(operand)) { 1187 if (isVariableOrRegister(operand)) {
1188 RegisterPriority p = registerPriorityOfInputOperand(flags); 1188 RegisterPriority p = registerPriorityOfInputOperand(flags);
1189 addUse(operand, blockFrom, opId, p, operand.kind.stackKind()); 1189 addUse(operand, blockFrom, opId, p, operand.getKind().stackKind());
1190 addRegisterHint(op, operand, mode, flags); 1190 addRegisterHint(op, operand, mode, flags);
1191 } 1191 }
1192 return operand; 1192 return operand;
1193 } 1193 }
1194 }); 1194 });
1198 // Treat these operands as temp values (if the live range is extended 1198 // Treat these operands as temp values (if the live range is extended
1199 // to a call site, the value would be in a register at the call otherwise) 1199 // to a call site, the value would be in a register at the call otherwise)
1200 op.forEachState(new ValueProcedure() { 1200 op.forEachState(new ValueProcedure() {
1201 @Override 1201 @Override
1202 public Value doValue(Value operand) { 1202 public Value doValue(Value operand) {
1203 addUse(operand, blockFrom, opId + 1, RegisterPriority.None, operand.kind.stackKind()); 1203 addUse(operand, blockFrom, opId + 1, RegisterPriority.None, operand.getKind().stackKind());
1204 return operand; 1204 return operand;
1205 } 1205 }
1206 }); 1206 });
1207 1207
1208 // special steps for some instructions (especially moves) 1208 // special steps for some instructions (especially moves)