From 81091e62b9330ff1294edd90fb012f8a85ff3866 Mon Sep 17 00:00:00 2001 From: dcarney Date: Mon, 2 Feb 2015 03:38:29 -0800 Subject: [PATCH] [turbofan] push virtual register field down to InstructionOperand BUG= Review URL: https://codereview.chromium.org/893913004 Cr-Commit-Position: refs/heads/master@{#26377} --- src/compiler/instruction-selector-impl.h | 119 +++++++++++---------- src/compiler/instruction.cc | 2 + src/compiler/instruction.h | 83 ++++++++------ src/compiler/register-allocator-verifier.cc | 2 - src/compiler/register-allocator.cc | 5 +- src/compiler/x64/instruction-selector-x64.cc | 5 - test/cctest/compiler/test-instruction.cc | 42 +++++--- .../compiler/instruction-sequence-unittest.cc | 16 +-- 8 files changed, 146 insertions(+), 128 deletions(-) diff --git a/src/compiler/instruction-selector-impl.h b/src/compiler/instruction-selector-impl.h index 26ac2d9..f8e9857 100644 --- a/src/compiler/instruction-selector-impl.h +++ b/src/compiler/instruction-selector-impl.h @@ -22,74 +22,80 @@ class OperandGenerator { : selector_(selector) {} InstructionOperand* DefineAsRegister(Node* node) { - return Define(node, new (zone()) - UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER)); + return Define(node, + new (zone()) UnallocatedOperand( + UnallocatedOperand::MUST_HAVE_REGISTER, GetVReg(node))); } - InstructionOperand* DefineSameAsFirst(Node* result) { - return Define(result, new (zone()) - UnallocatedOperand(UnallocatedOperand::SAME_AS_FIRST_INPUT)); + InstructionOperand* DefineSameAsFirst(Node* node) { + return Define(node, + new (zone()) UnallocatedOperand( + UnallocatedOperand::SAME_AS_FIRST_INPUT, GetVReg(node))); } InstructionOperand* DefineAsFixed(Node* node, Register reg) { - return Define(node, new (zone()) - UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, - Register::ToAllocationIndex(reg))); + return Define(node, new (zone()) UnallocatedOperand( + UnallocatedOperand::FIXED_REGISTER, + Register::ToAllocationIndex(reg), GetVReg(node))); } InstructionOperand* DefineAsFixed(Node* node, DoubleRegister reg) { - return Define(node, new (zone()) - UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, - DoubleRegister::ToAllocationIndex(reg))); + return Define(node, + new (zone()) UnallocatedOperand( + UnallocatedOperand::FIXED_DOUBLE_REGISTER, + DoubleRegister::ToAllocationIndex(reg), GetVReg(node))); } InstructionOperand* DefineAsConstant(Node* node) { selector()->MarkAsDefined(node); - int virtual_register = selector_->GetVirtualRegister(node); + int virtual_register = GetVReg(node); sequence()->AddConstant(virtual_register, ToConstant(node)); return ConstantOperand::Create(virtual_register, zone()); } InstructionOperand* DefineAsLocation(Node* node, LinkageLocation location, MachineType type) { - return Define(node, ToUnallocatedOperand(location, type)); + return Define(node, ToUnallocatedOperand(location, type, GetVReg(node))); } InstructionOperand* Use(Node* node) { - return Use( - node, new (zone()) UnallocatedOperand( - UnallocatedOperand::NONE, UnallocatedOperand::USED_AT_START)); + return Use(node, new (zone()) UnallocatedOperand( + UnallocatedOperand::NONE, + UnallocatedOperand::USED_AT_START, GetVReg(node))); } InstructionOperand* UseRegister(Node* node) { - return Use(node, new (zone()) - UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, - UnallocatedOperand::USED_AT_START)); + return Use(node, new (zone()) UnallocatedOperand( + UnallocatedOperand::MUST_HAVE_REGISTER, + UnallocatedOperand::USED_AT_START, GetVReg(node))); } // Use register or operand for the node. If a register is chosen, it won't // alias any temporary or output registers. InstructionOperand* UseUnique(Node* node) { - return Use(node, new (zone()) UnallocatedOperand(UnallocatedOperand::NONE)); + return Use(node, new (zone()) UnallocatedOperand(UnallocatedOperand::NONE, + GetVReg(node))); } // Use a unique register for the node that does not alias any temporary or // output registers. InstructionOperand* UseUniqueRegister(Node* node) { - return Use(node, new (zone()) - UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER)); + return Use(node, + new (zone()) UnallocatedOperand( + UnallocatedOperand::MUST_HAVE_REGISTER, GetVReg(node))); } InstructionOperand* UseFixed(Node* node, Register reg) { - return Use(node, new (zone()) - UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, - Register::ToAllocationIndex(reg))); + return Use(node, new (zone()) UnallocatedOperand( + UnallocatedOperand::FIXED_REGISTER, + Register::ToAllocationIndex(reg), GetVReg(node))); } InstructionOperand* UseFixed(Node* node, DoubleRegister reg) { - return Use(node, new (zone()) - UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, - DoubleRegister::ToAllocationIndex(reg))); + return Use(node, + new (zone()) UnallocatedOperand( + UnallocatedOperand::FIXED_DOUBLE_REGISTER, + DoubleRegister::ToAllocationIndex(reg), GetVReg(node))); } InstructionOperand* UseImmediate(Node* node) { @@ -99,29 +105,27 @@ class OperandGenerator { InstructionOperand* UseLocation(Node* node, LinkageLocation location, MachineType type) { - return Use(node, ToUnallocatedOperand(location, type)); + return Use(node, ToUnallocatedOperand(location, type, GetVReg(node))); } InstructionOperand* TempRegister() { - UnallocatedOperand* op = - new (zone()) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, - UnallocatedOperand::USED_AT_START); - op->set_virtual_register(sequence()->NextVirtualRegister()); - return op; + return new (zone()) UnallocatedOperand( + UnallocatedOperand::MUST_HAVE_REGISTER, + UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); } InstructionOperand* TempDoubleRegister() { - UnallocatedOperand* op = - new (zone()) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, - UnallocatedOperand::USED_AT_START); - op->set_virtual_register(sequence()->NextVirtualRegister()); + UnallocatedOperand* op = new (zone()) UnallocatedOperand( + UnallocatedOperand::MUST_HAVE_REGISTER, + UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); sequence()->MarkAsDouble(op->virtual_register()); return op; } InstructionOperand* TempRegister(Register reg) { - return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, - Register::ToAllocationIndex(reg)); + return new (zone()) UnallocatedOperand( + UnallocatedOperand::FIXED_REGISTER, Register::ToAllocationIndex(reg), + UnallocatedOperand::kInvalidVirtualRegister); } InstructionOperand* TempImmediate(int32_t imm) { @@ -130,9 +134,8 @@ class OperandGenerator { } InstructionOperand* TempLocation(LinkageLocation location, MachineType type) { - UnallocatedOperand* op = ToUnallocatedOperand(location, type); - op->set_virtual_register(sequence()->NextVirtualRegister()); - return op; + return ToUnallocatedOperand(location, type, + sequence()->NextVirtualRegister()); } InstructionOperand* Label(BasicBlock* block) { @@ -146,6 +149,8 @@ class OperandGenerator { Zone* zone() const { return selector()->instruction_zone(); } private: + int GetVReg(Node* node) const { return selector_->GetVirtualRegister(node); } + static Constant ToConstant(const Node* node) { switch (node->opcode()) { case IrOpcode::kInt32Constant: @@ -171,7 +176,7 @@ class OperandGenerator { UnallocatedOperand* Define(Node* node, UnallocatedOperand* operand) { DCHECK_NOT_NULL(node); DCHECK_NOT_NULL(operand); - operand->set_virtual_register(selector_->GetVirtualRegister(node)); + DCHECK_EQ(operand->virtual_register(), GetVReg(node)); selector()->MarkAsDefined(node); return operand; } @@ -179,36 +184,40 @@ class OperandGenerator { UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { DCHECK_NOT_NULL(node); DCHECK_NOT_NULL(operand); - operand->set_virtual_register(selector_->GetVirtualRegister(node)); + DCHECK_EQ(operand->virtual_register(), GetVReg(node)); selector()->MarkAsUsed(node); return operand; } UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location, - MachineType type) { + MachineType type, + int virtual_register) { if (location.location_ == LinkageLocation::ANY_REGISTER) { // any machine register. - return new (zone()) - UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER); + return new (zone()) UnallocatedOperand( + UnallocatedOperand::MUST_HAVE_REGISTER, virtual_register); } if (location.location_ < 0) { // a location on the caller frame. - return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_SLOT, - location.location_); + return new (zone()) UnallocatedOperand( + UnallocatedOperand::FIXED_SLOT, location.location_, virtual_register); } if (location.location_ > LinkageLocation::ANY_REGISTER) { // a spill location on this (callee) frame. return new (zone()) UnallocatedOperand( UnallocatedOperand::FIXED_SLOT, - location.location_ - LinkageLocation::ANY_REGISTER - 1); + location.location_ - LinkageLocation::ANY_REGISTER - 1, + virtual_register); } // a fixed register. if (RepresentationOf(type) == kRepFloat64) { - return new (zone()) UnallocatedOperand( - UnallocatedOperand::FIXED_DOUBLE_REGISTER, location.location_); + return new (zone()) + UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, + location.location_, virtual_register); } - return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, - location.location_); + return new (zone()) + UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, + location.location_, virtual_register); } InstructionSelector* selector_; diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc index 34a3151..6c358fb 100644 --- a/src/compiler/instruction.cc +++ b/src/compiler/instruction.cc @@ -50,6 +50,8 @@ std::ostream& operator<<(std::ostream& os, return os << "[" << conf->general_register_name(op.index()) << "|R]"; case InstructionOperand::DOUBLE_REGISTER: return os << "[" << conf->double_register_name(op.index()) << "|R]"; + case InstructionOperand::INVALID: + return os << "(x)"; } UNREACHABLE(); return os; diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h index 21750e7..6614d47 100644 --- a/src/compiler/instruction.h +++ b/src/compiler/instruction.h @@ -37,7 +37,10 @@ const InstructionCode kSourcePositionInstruction = -2; class InstructionOperand : public ZoneObject { public: + static const int kInvalidVirtualRegister = -1; + enum Kind { + INVALID, UNALLOCATED, CONSTANT, IMMEDIATE, @@ -47,7 +50,11 @@ class InstructionOperand : public ZoneObject { DOUBLE_REGISTER }; - InstructionOperand(Kind kind, int index) { ConvertTo(kind, index); } + InstructionOperand(Kind kind, int index) + : virtual_register_(kInvalidVirtualRegister) { + DCHECK(kind != INVALID); + ConvertTo(kind, index); + } Kind kind() const { return KindField::decode(value_); } int index() const { return static_cast(value_) >> KindField::kSize; } @@ -65,6 +72,7 @@ class InstructionOperand : public ZoneObject { value_ = KindField::encode(kind); value_ |= bit_cast(index << KindField::kSize); DCHECK(this->index() == index); + if (kind != UNALLOCATED) virtual_register_ = kInvalidVirtualRegister; } // Calls SetUpCache()/TearDownCache() for each subclass. @@ -72,11 +80,15 @@ class InstructionOperand : public ZoneObject { static void TearDownCaches(); protected: - // TODO(dcarney): remove. used to construct the Instruction operand array. - InstructionOperand() : value_(0xffffffff) {} + InstructionOperand(Kind kind, int index, int virtual_register) + : virtual_register_(virtual_register) { + ConvertTo(kind, index); + } typedef BitField KindField; uint32_t value_; + // TODO(dcarney): this should really be unsigned. + int32_t virtual_register_; }; typedef ZoneVector InstructionOperandVector; @@ -116,28 +128,30 @@ class UnallocatedOperand : public InstructionOperand { USED_AT_END }; + // TODO(dcarney): remove this. static const int kInvalidVirtualRegister = -1; - explicit UnallocatedOperand(ExtendedPolicy policy) - : InstructionOperand(UNALLOCATED, 0), - virtual_register_(kInvalidVirtualRegister) { + // This is only for array initialization. + UnallocatedOperand() + : InstructionOperand(INVALID, 0, kInvalidVirtualRegister) {} + + UnallocatedOperand(ExtendedPolicy policy, int virtual_register) + : InstructionOperand(UNALLOCATED, 0, virtual_register) { value_ |= BasicPolicyField::encode(EXTENDED_POLICY); value_ |= ExtendedPolicyField::encode(policy); value_ |= LifetimeField::encode(USED_AT_END); } - UnallocatedOperand(BasicPolicy policy, int index) - : InstructionOperand(UNALLOCATED, 0), - virtual_register_(kInvalidVirtualRegister) { + UnallocatedOperand(BasicPolicy policy, int index, int virtual_register) + : InstructionOperand(UNALLOCATED, 0, virtual_register) { DCHECK(policy == FIXED_SLOT); value_ |= BasicPolicyField::encode(policy); value_ |= static_cast(index) << FixedSlotIndexField::kShift; DCHECK(this->fixed_slot_index() == index); } - UnallocatedOperand(ExtendedPolicy policy, int index) - : InstructionOperand(UNALLOCATED, 0), - virtual_register_(kInvalidVirtualRegister) { + UnallocatedOperand(ExtendedPolicy policy, int index, int virtual_register) + : InstructionOperand(UNALLOCATED, 0, virtual_register) { DCHECK(policy == FIXED_REGISTER || policy == FIXED_DOUBLE_REGISTER); value_ |= BasicPolicyField::encode(EXTENDED_POLICY); value_ |= ExtendedPolicyField::encode(policy); @@ -145,18 +159,16 @@ class UnallocatedOperand : public InstructionOperand { value_ |= FixedRegisterField::encode(index); } - UnallocatedOperand(ExtendedPolicy policy, Lifetime lifetime) - : InstructionOperand(UNALLOCATED, 0), - virtual_register_(kInvalidVirtualRegister) { + UnallocatedOperand(ExtendedPolicy policy, Lifetime lifetime, + int virtual_register) + : InstructionOperand(UNALLOCATED, 0, virtual_register) { value_ |= BasicPolicyField::encode(EXTENDED_POLICY); value_ |= ExtendedPolicyField::encode(policy); value_ |= LifetimeField::encode(lifetime); } UnallocatedOperand* CopyUnconstrained(Zone* zone) { - UnallocatedOperand* result = new (zone) UnallocatedOperand(ANY); - result->set_virtual_register(virtual_register()); - return result; + return new (zone) UnallocatedOperand(ANY, virtual_register()); } static const UnallocatedOperand* cast(const InstructionOperand* op) { @@ -233,7 +245,10 @@ class UnallocatedOperand : public InstructionOperand { } // [basic_policy]: Distinguish between FIXED_SLOT and all other policies. - BasicPolicy basic_policy() const { return BasicPolicyField::decode(value_); } + BasicPolicy basic_policy() const { + DCHECK_EQ(UNALLOCATED, kind()); + return BasicPolicyField::decode(value_); + } // [extended_policy]: Only for non-FIXED_SLOT. The finer-grained policy. ExtendedPolicy extended_policy() const { @@ -255,22 +270,22 @@ class UnallocatedOperand : public InstructionOperand { } // [virtual_register]: The virtual register ID for this operand. - int32_t virtual_register() const { return virtual_register_; } - void set_virtual_register(int32_t id) { virtual_register_ = id; } + int32_t virtual_register() const { + DCHECK_EQ(UNALLOCATED, kind()); + return virtual_register_; + } + + // TODO(dcarney): remove this. + void set_virtual_register(int32_t id) { + DCHECK_EQ(UNALLOCATED, kind()); + virtual_register_ = id; + } // [lifetime]: Only for non-FIXED_SLOT. bool IsUsedAtStart() const { DCHECK(basic_policy() == EXTENDED_POLICY); return LifetimeField::decode(value_) == USED_AT_START; } - - private: - friend class Instruction; - UnallocatedOperand() - : InstructionOperand(), virtual_register_(kInvalidVirtualRegister) {} - - // TODO(dcarney): this should really be unsigned. - int32_t virtual_register_; }; @@ -783,9 +798,8 @@ class PhiInstruction FINAL : public ZoneObject { operands_(zone), output_(nullptr), inputs_(zone) { - UnallocatedOperand* output = - new (zone) UnallocatedOperand(UnallocatedOperand::NONE); - output->set_virtual_register(virtual_register); + UnallocatedOperand* output = new (zone) + UnallocatedOperand(UnallocatedOperand::NONE, virtual_register); output_ = output; inputs_.reserve(reserved_input_count); operands_.reserve(reserved_input_count); @@ -795,9 +809,8 @@ class PhiInstruction FINAL : public ZoneObject { const IntVector& operands() const { return operands_; } void Extend(Zone* zone, int virtual_register) { - UnallocatedOperand* input = - new (zone) UnallocatedOperand(UnallocatedOperand::ANY); - input->set_virtual_register(virtual_register); + UnallocatedOperand* input = new (zone) + UnallocatedOperand(UnallocatedOperand::ANY, virtual_register); operands_.push_back(virtual_register); inputs_.push_back(input); } diff --git a/src/compiler/register-allocator-verifier.cc b/src/compiler/register-allocator-verifier.cc index 276aa88..5afbf72 100644 --- a/src/compiler/register-allocator-verifier.cc +++ b/src/compiler/register-allocator-verifier.cc @@ -40,8 +40,6 @@ void RegisterAllocatorVerifier::VerifyTemp( CHECK_NE(kSameAsFirst, constraint.type_); CHECK_NE(kImmediate, constraint.type_); CHECK_NE(kConstant, constraint.type_); - CHECK_EQ(UnallocatedOperand::kInvalidVirtualRegister, - constraint.virtual_register_); } diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc index 4e5e53b..7a72b9f 100644 --- a/src/compiler/register-allocator.cc +++ b/src/compiler/register-allocator.cc @@ -1076,9 +1076,8 @@ void RegisterAllocator::MeetRegisterConstraintsForLastInstructionInBlock( // Create an unconstrained operand for the same virtual register // and insert a gap move from the fixed output to the operand. - UnallocatedOperand* output_copy = - new (code_zone()) UnallocatedOperand(UnallocatedOperand::ANY); - output_copy->set_virtual_register(output_vreg); + UnallocatedOperand* output_copy = new (code_zone()) + UnallocatedOperand(UnallocatedOperand::ANY, output_vreg); AddGapMove(gap_index, GapInstruction::START, output, output_copy); } diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc index 0e6e220..f19225f 100644 --- a/src/compiler/x64/instruction-selector-x64.cc +++ b/src/compiler/x64/instruction-selector-x64.cc @@ -16,11 +16,6 @@ class X64OperandGenerator FINAL : public OperandGenerator { explicit X64OperandGenerator(InstructionSelector* selector) : OperandGenerator(selector) {} - InstructionOperand* TempRegister(Register reg) { - return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, - Register::ToAllocationIndex(reg)); - } - bool CanBeImmediate(Node* node) { switch (node->opcode()) { case IrOpcode::kInt32Constant: diff --git a/test/cctest/compiler/test-instruction.cc b/test/cctest/compiler/test-instruction.cc index a884d28..da460d1 100644 --- a/test/cctest/compiler/test-instruction.cc +++ b/test/cctest/compiler/test-instruction.cc @@ -90,10 +90,7 @@ class InstructionTester : public HandleAndZoneScope { } UnallocatedOperand* NewUnallocated(int vreg) { - UnallocatedOperand* unallocated = - new (zone()) UnallocatedOperand(UnallocatedOperand::ANY); - unallocated->set_virtual_register(vreg); - return unallocated; + return new (zone()) UnallocatedOperand(UnallocatedOperand::ANY, vreg); } InstructionBlock* BlockAt(BasicBlock* block) { @@ -298,23 +295,36 @@ TEST(InstructionOperands) { CHECK_EQ(0, static_cast(i->TempCount())); } + int vreg = 15; InstructionOperand* outputs[] = { - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER)}; + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg)}; InstructionOperand* inputs[] = { - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER)}; + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg)}; InstructionOperand* temps[] = { - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER), - new (&zone) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER)}; + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg), + new (&zone) + UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg)}; for (size_t i = 0; i < arraysize(outputs); i++) { for (size_t j = 0; j < arraysize(inputs); j++) { diff --git a/test/unittests/compiler/instruction-sequence-unittest.cc b/test/unittests/compiler/instruction-sequence-unittest.cc index 40a59df..4228470 100644 --- a/test/unittests/compiler/instruction-sequence-unittest.cc +++ b/test/unittests/compiler/instruction-sequence-unittest.cc @@ -293,34 +293,26 @@ Instruction* InstructionSequenceTest::NewInstruction( InstructionOperand* InstructionSequenceTest::Unallocated( TestOperand op, UnallocatedOperand::ExtendedPolicy policy) { - auto unallocated = new (zone()) UnallocatedOperand(policy); - unallocated->set_virtual_register(op.vreg_.value_); - return unallocated; + return new (zone()) UnallocatedOperand(policy, op.vreg_.value_); } InstructionOperand* InstructionSequenceTest::Unallocated( TestOperand op, UnallocatedOperand::ExtendedPolicy policy, UnallocatedOperand::Lifetime lifetime) { - auto unallocated = new (zone()) UnallocatedOperand(policy, lifetime); - unallocated->set_virtual_register(op.vreg_.value_); - return unallocated; + return new (zone()) UnallocatedOperand(policy, lifetime, op.vreg_.value_); } InstructionOperand* InstructionSequenceTest::Unallocated( TestOperand op, UnallocatedOperand::ExtendedPolicy policy, int index) { - auto unallocated = new (zone()) UnallocatedOperand(policy, index); - unallocated->set_virtual_register(op.vreg_.value_); - return unallocated; + return new (zone()) UnallocatedOperand(policy, index, op.vreg_.value_); } InstructionOperand* InstructionSequenceTest::Unallocated( TestOperand op, UnallocatedOperand::BasicPolicy policy, int index) { - auto unallocated = new (zone()) UnallocatedOperand(policy, index); - unallocated->set_virtual_register(op.vreg_.value_); - return unallocated; + return new (zone()) UnallocatedOperand(policy, index, op.vreg_.value_); } -- 2.7.4