| Index: src/lithium-allocator.cc
|
| ===================================================================
|
| --- src/lithium-allocator.cc (revision 6941)
|
| +++ src/lithium-allocator.cc (working copy)
|
| @@ -27,7 +27,6 @@
|
|
|
| #include "lithium-allocator.h"
|
|
|
| -#include "data-flow.h"
|
| #include "hydrogen.h"
|
| #include "string-stream.h"
|
|
|
| @@ -107,9 +106,6 @@
|
| case LUnallocated::SAME_AS_FIRST_INPUT:
|
| stream->Add("(1)");
|
| break;
|
| - case LUnallocated::SAME_AS_ANY_INPUT:
|
| - stream->Add("(A)");
|
| - break;
|
| case LUnallocated::ANY:
|
| stream->Add("(-)");
|
| break;
|
| @@ -834,6 +830,13 @@
|
| } else if (cur_input->policy() == LUnallocated::WRITABLE_REGISTER) {
|
| LUnallocated* input_copy = cur_input->CopyUnconstrained();
|
| cur_input->set_virtual_register(next_virtual_register_++);
|
| +
|
| + if (RequiredRegisterKind(input_copy->virtual_register()) ==
|
| + DOUBLE_REGISTERS) {
|
| + double_artificial_registers_.Add(
|
| + cur_input->virtual_register() - first_artificial_register_);
|
| + }
|
| +
|
| second->AddTemp(cur_input);
|
| AddConstraintsGapMove(gap_index, input_copy, cur_input);
|
| }
|
| @@ -937,6 +940,9 @@
|
| curr_position.InstructionEnd());
|
| }
|
| }
|
| + }
|
| +
|
| + if (summary->IsCall() || summary->IsSaveDoubles()) {
|
| for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; ++i) {
|
| if (output == NULL || !output->IsDoubleRegister() ||
|
| output->index() != i) {
|
| @@ -1036,6 +1042,7 @@
|
|
|
| void LAllocator::MeetRegisterConstraints() {
|
| HPhase phase("Register constraints", chunk());
|
| + first_artificial_register_ = next_virtual_register_;
|
| const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
|
| for (int i = 0; i < blocks->length(); ++i) {
|
| HBasicBlock* block = blocks->at(i);
|
| @@ -1564,19 +1571,50 @@
|
|
|
|
|
| RegisterKind LAllocator::RequiredRegisterKind(int virtual_register) const {
|
| - HValue* value = graph()->LookupValue(virtual_register);
|
| - if (value != NULL && value->representation().IsDouble()) {
|
| + if (virtual_register < first_artificial_register_) {
|
| + HValue* value = graph()->LookupValue(virtual_register);
|
| + if (value != NULL && value->representation().IsDouble()) {
|
| + return DOUBLE_REGISTERS;
|
| + }
|
| + } else if (double_artificial_registers_.Contains(
|
| + virtual_register - first_artificial_register_)) {
|
| return DOUBLE_REGISTERS;
|
| }
|
| +
|
| return GENERAL_REGISTERS;
|
| }
|
|
|
|
|
| void LAllocator::MarkAsCall() {
|
| - current_summary()->MarkAsCall();
|
| + // Call instructions can use only fixed registers as
|
| + // temporaries and outputs because all registers
|
| + // are blocked by the calling convention.
|
| + // Inputs can use either fixed register or have a short lifetime (be
|
| + // used at start of the instruction).
|
| + InstructionSummary* summary = current_summary();
|
| +#ifdef DEBUG
|
| + ASSERT(summary->Output() == NULL ||
|
| + LUnallocated::cast(summary->Output())->HasFixedPolicy() ||
|
| + !LUnallocated::cast(summary->Output())->HasRegisterPolicy());
|
| + for (int i = 0; i < summary->InputCount(); i++) {
|
| + ASSERT(LUnallocated::cast(summary->InputAt(i))->HasFixedPolicy() ||
|
| + LUnallocated::cast(summary->InputAt(i))->IsUsedAtStart() ||
|
| + !LUnallocated::cast(summary->InputAt(i))->HasRegisterPolicy());
|
| + }
|
| + for (int i = 0; i < summary->TempCount(); i++) {
|
| + ASSERT(LUnallocated::cast(summary->TempAt(i))->HasFixedPolicy() ||
|
| + !LUnallocated::cast(summary->TempAt(i))->HasRegisterPolicy());
|
| + }
|
| +#endif
|
| + summary->MarkAsCall();
|
| }
|
|
|
|
|
| +void LAllocator::MarkAsSaveDoubles() {
|
| + current_summary()->MarkAsSaveDoubles();
|
| +}
|
| +
|
| +
|
| void LAllocator::RecordDefinition(HInstruction* instr, LUnallocated* operand) {
|
| operand->set_virtual_register(instr->id());
|
| current_summary()->SetOutput(operand);
|
|
|