OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/compiler/linkage.h" | 6 #include "src/compiler/linkage.h" |
7 #include "src/compiler/register-allocator.h" | 7 #include "src/compiler/register-allocator.h" |
8 #include "src/string-stream.h" | 8 #include "src/string-stream.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return true; | 73 return true; |
74 } | 74 } |
75 } | 75 } |
76 return false; | 76 return false; |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 bool IsOutputDoubleRegisterOf(Instruction* instr, DoubleRegister reg) { | 80 bool IsOutputDoubleRegisterOf(Instruction* instr, DoubleRegister reg) { |
81 for (size_t i = 0; i < instr->OutputCount(); i++) { | 81 for (size_t i = 0; i < instr->OutputCount(); i++) { |
82 InstructionOperand* output = instr->OutputAt(i); | 82 InstructionOperand* output = instr->OutputAt(i); |
83 if (output->IsDoubleRegister() && | 83 if (output->IsFPRegister() && |
84 LocationOperand::cast(output)->GetDoubleRegister().is(reg)) { | 84 LocationOperand::cast(output)->GetDoubleRegister().is(reg)) { |
85 return true; | 85 return true; |
86 } | 86 } |
87 } | 87 } |
88 return false; | 88 return false; |
89 } | 89 } |
90 | 90 |
91 | 91 |
92 // TODO(dcarney): fix frame to allow frame accesses to half size location. | 92 // TODO(dcarney): fix frame to allow frame accesses to half size location. |
93 int GetByteWidth(MachineRepresentation rep) { | 93 int GetByteWidth(MachineRepresentation rep) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 UsePositionHintType UsePosition::HintTypeForOperand( | 343 UsePositionHintType UsePosition::HintTypeForOperand( |
344 const InstructionOperand& op) { | 344 const InstructionOperand& op) { |
345 switch (op.kind()) { | 345 switch (op.kind()) { |
346 case InstructionOperand::CONSTANT: | 346 case InstructionOperand::CONSTANT: |
347 case InstructionOperand::IMMEDIATE: | 347 case InstructionOperand::IMMEDIATE: |
348 case InstructionOperand::EXPLICIT: | 348 case InstructionOperand::EXPLICIT: |
349 return UsePositionHintType::kNone; | 349 return UsePositionHintType::kNone; |
350 case InstructionOperand::UNALLOCATED: | 350 case InstructionOperand::UNALLOCATED: |
351 return UsePositionHintType::kUnresolved; | 351 return UsePositionHintType::kUnresolved; |
352 case InstructionOperand::ALLOCATED: | 352 case InstructionOperand::ALLOCATED: |
353 if (op.IsRegister() || op.IsDoubleRegister()) { | 353 if (op.IsRegister() || op.IsFPRegister()) { |
354 return UsePositionHintType::kOperand; | 354 return UsePositionHintType::kOperand; |
355 } else { | 355 } else { |
356 DCHECK(op.IsStackSlot() || op.IsDoubleStackSlot()); | 356 DCHECK(op.IsStackSlot() || op.IsFPStackSlot()); |
357 return UsePositionHintType::kNone; | 357 return UsePositionHintType::kNone; |
358 } | 358 } |
359 case InstructionOperand::INVALID: | 359 case InstructionOperand::INVALID: |
360 break; | 360 break; |
361 } | 361 } |
362 UNREACHABLE(); | 362 UNREACHABLE(); |
363 return UsePositionHintType::kNone; | 363 return UsePositionHintType::kNone; |
364 } | 364 } |
365 | 365 |
366 | 366 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 719 } |
720 | 720 |
721 | 721 |
722 void LiveRange::ConvertUsesToOperand(const InstructionOperand& op, | 722 void LiveRange::ConvertUsesToOperand(const InstructionOperand& op, |
723 const InstructionOperand& spill_op) { | 723 const InstructionOperand& spill_op) { |
724 for (UsePosition* pos = first_pos(); pos != nullptr; pos = pos->next()) { | 724 for (UsePosition* pos = first_pos(); pos != nullptr; pos = pos->next()) { |
725 DCHECK(Start() <= pos->pos() && pos->pos() <= End()); | 725 DCHECK(Start() <= pos->pos() && pos->pos() <= End()); |
726 if (!pos->HasOperand()) continue; | 726 if (!pos->HasOperand()) continue; |
727 switch (pos->type()) { | 727 switch (pos->type()) { |
728 case UsePositionType::kRequiresSlot: | 728 case UsePositionType::kRequiresSlot: |
729 DCHECK(spill_op.IsStackSlot() || spill_op.IsDoubleStackSlot()); | 729 DCHECK(spill_op.IsStackSlot() || spill_op.IsFPStackSlot()); |
730 InstructionOperand::ReplaceWith(pos->operand(), &spill_op); | 730 InstructionOperand::ReplaceWith(pos->operand(), &spill_op); |
731 break; | 731 break; |
732 case UsePositionType::kRequiresRegister: | 732 case UsePositionType::kRequiresRegister: |
733 DCHECK(op.IsRegister() || op.IsDoubleRegister()); | 733 DCHECK(op.IsRegister() || op.IsFPRegister()); |
734 // Fall through. | 734 // Fall through. |
735 case UsePositionType::kAny: | 735 case UsePositionType::kAny: |
736 InstructionOperand::ReplaceWith(pos->operand(), &op); | 736 InstructionOperand::ReplaceWith(pos->operand(), &op); |
737 break; | 737 break; |
738 } | 738 } |
739 } | 739 } |
740 } | 740 } |
741 | 741 |
742 | 742 |
743 // This implements an ordering on live ranges so that they are ordered by their | 743 // This implements an ordering on live ranges so that they are ordered by their |
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 TopLevelLiveRange* LiveRangeBuilder::LiveRangeFor(InstructionOperand* operand) { | 1942 TopLevelLiveRange* LiveRangeBuilder::LiveRangeFor(InstructionOperand* operand) { |
1943 if (operand->IsUnallocated()) { | 1943 if (operand->IsUnallocated()) { |
1944 return data()->GetOrCreateLiveRangeFor( | 1944 return data()->GetOrCreateLiveRangeFor( |
1945 UnallocatedOperand::cast(operand)->virtual_register()); | 1945 UnallocatedOperand::cast(operand)->virtual_register()); |
1946 } else if (operand->IsConstant()) { | 1946 } else if (operand->IsConstant()) { |
1947 return data()->GetOrCreateLiveRangeFor( | 1947 return data()->GetOrCreateLiveRangeFor( |
1948 ConstantOperand::cast(operand)->virtual_register()); | 1948 ConstantOperand::cast(operand)->virtual_register()); |
1949 } else if (operand->IsRegister()) { | 1949 } else if (operand->IsRegister()) { |
1950 return FixedLiveRangeFor( | 1950 return FixedLiveRangeFor( |
1951 LocationOperand::cast(operand)->GetRegister().code()); | 1951 LocationOperand::cast(operand)->GetRegister().code()); |
1952 } else if (operand->IsDoubleRegister()) { | 1952 } else if (operand->IsFPRegister()) { |
1953 return FixedDoubleLiveRangeFor( | 1953 return FixedDoubleLiveRangeFor( |
1954 LocationOperand::cast(operand)->GetDoubleRegister().code()); | 1954 LocationOperand::cast(operand)->GetDoubleRegister().code()); |
1955 } else { | 1955 } else { |
1956 return nullptr; | 1956 return nullptr; |
1957 } | 1957 } |
1958 } | 1958 } |
1959 | 1959 |
1960 | 1960 |
1961 UsePosition* LiveRangeBuilder::NewUsePosition(LifetimePosition pos, | 1961 UsePosition* LiveRangeBuilder::NewUsePosition(LifetimePosition pos, |
1962 InstructionOperand* operand, | 1962 InstructionOperand* operand, |
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3657 } | 3657 } |
3658 } | 3658 } |
3659 } | 3659 } |
3660 } | 3660 } |
3661 } | 3661 } |
3662 | 3662 |
3663 | 3663 |
3664 } // namespace compiler | 3664 } // namespace compiler |
3665 } // namespace internal | 3665 } // namespace internal |
3666 } // namespace v8 | 3666 } // namespace v8 |
OLD | NEW |