Index: src/compiler/instruction.cc |
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc |
index 7d1851a94d579af844f1c0273e064c4bd724ab7f..ce2c076615cc612c87328950497de2f7cf81c591 100644 |
--- a/src/compiler/instruction.cc |
+++ b/src/compiler/instruction.cc |
@@ -117,6 +117,47 @@ bool ParallelMove::IsRedundant() const { |
} |
+static void SetOperand(UnallocatedOperand* loc, InstructionOperand* value) { |
+ if (value->IsUnallocated()) { |
+ loc[0] = *UnallocatedOperand::cast(value); |
+ } else { |
+ InstructionOperand* casted = static_cast<InstructionOperand*>(loc); |
+ casted[0] = *value; |
+ } |
+} |
+ |
+ |
+Instruction::Instruction(InstructionCode opcode) |
+ : opcode_(opcode), |
+ bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) | |
+ TempCountField::encode(0) | IsCallField::encode(false) | |
+ IsControlField::encode(false)), |
+ pointer_map_(NULL) {} |
+ |
+ |
+Instruction::Instruction(InstructionCode opcode, size_t output_count, |
+ InstructionOperand** outputs, size_t input_count, |
+ InstructionOperand** inputs, size_t temp_count, |
+ InstructionOperand** temps) |
+ : opcode_(opcode), |
+ bit_field_(OutputCountField::encode(output_count) | |
+ InputCountField::encode(input_count) | |
+ TempCountField::encode(temp_count) | |
+ IsCallField::encode(false) | IsControlField::encode(false)), |
+ pointer_map_(NULL) { |
+ size_t offset = 0; |
+ for (size_t i = 0; i < output_count; ++i) { |
+ SetOperand(&operands_[offset++], outputs[i]); |
+ } |
+ for (size_t i = 0; i < input_count; ++i) { |
+ SetOperand(&operands_[offset++], inputs[i]); |
+ } |
+ for (size_t i = 0; i < temp_count; ++i) { |
+ SetOperand(&operands_[offset++], temps[i]); |
+ } |
+} |
+ |
+ |
bool GapInstruction::IsRedundant() const { |
for (int i = GapInstruction::FIRST_INNER_POSITION; |
i <= GapInstruction::LAST_INNER_POSITION; i++) { |