OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { | 1433 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { |
1434 // TODO(vegorov): consider saving only caller save (volatile) registers. | 1434 // TODO(vegorov): consider saving only caller save (volatile) registers. |
1435 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); | 1435 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); |
1436 if (fpu_regs_count > 0) { | 1436 if (fpu_regs_count > 0) { |
1437 // Store fpu registers with the lowest register number at the lowest | 1437 // Store fpu registers with the lowest register number at the lowest |
1438 // address. | 1438 // address. |
1439 for (intptr_t reg_idx = kNumberOfVRegisters - 1; | 1439 for (intptr_t reg_idx = kNumberOfVRegisters - 1; |
1440 reg_idx >= 0; --reg_idx) { | 1440 reg_idx >= 0; --reg_idx) { |
1441 VRegister fpu_reg = static_cast<VRegister>(reg_idx); | 1441 VRegister fpu_reg = static_cast<VRegister>(reg_idx); |
1442 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) { | 1442 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) { |
1443 // TODO(zra): Save the whole V register. | 1443 __ PushQuad(fpu_reg); |
1444 __ PushDouble(fpu_reg); | |
1445 } | 1444 } |
1446 } | 1445 } |
1447 } | 1446 } |
1448 | 1447 |
1449 // Store general purpose registers with the highest register number at the | 1448 // Store general purpose registers with the highest register number at the |
1450 // lowest address. | 1449 // lowest address. |
1451 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) { | 1450 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) { |
1452 Register reg = static_cast<Register>(reg_idx); | 1451 Register reg = static_cast<Register>(reg_idx); |
1453 if (locs->live_registers()->ContainsRegister(reg)) { | 1452 if (locs->live_registers()->ContainsRegister(reg)) { |
1454 __ Push(reg); | 1453 __ Push(reg); |
(...skipping 11 matching lines...) Expand all Loading... |
1466 __ Pop(reg); | 1465 __ Pop(reg); |
1467 } | 1466 } |
1468 } | 1467 } |
1469 | 1468 |
1470 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); | 1469 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); |
1471 if (fpu_regs_count > 0) { | 1470 if (fpu_regs_count > 0) { |
1472 // Fpu registers have the lowest register number at the lowest address. | 1471 // Fpu registers have the lowest register number at the lowest address. |
1473 for (intptr_t reg_idx = 0; reg_idx < kNumberOfVRegisters; ++reg_idx) { | 1472 for (intptr_t reg_idx = 0; reg_idx < kNumberOfVRegisters; ++reg_idx) { |
1474 VRegister fpu_reg = static_cast<VRegister>(reg_idx); | 1473 VRegister fpu_reg = static_cast<VRegister>(reg_idx); |
1475 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) { | 1474 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) { |
1476 // TODO(zra): Restore the whole V register. | 1475 __ PopQuad(fpu_reg); |
1477 __ PopDouble(fpu_reg); | |
1478 } | 1476 } |
1479 } | 1477 } |
1480 } | 1478 } |
1481 } | 1479 } |
1482 | 1480 |
1483 | 1481 |
1484 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, | 1482 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, |
1485 Register class_id_reg, | 1483 Register class_id_reg, |
1486 intptr_t argument_count, | 1484 intptr_t argument_count, |
1487 const Array& argument_names, | 1485 const Array& argument_names, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 __ LoadFromOffset(destination.reg(), FP, source_offset, PP); | 1586 __ LoadFromOffset(destination.reg(), FP, source_offset, PP); |
1589 } else { | 1587 } else { |
1590 ASSERT(destination.IsStackSlot()); | 1588 ASSERT(destination.IsStackSlot()); |
1591 const intptr_t source_offset = source.ToStackSlotOffset(); | 1589 const intptr_t source_offset = source.ToStackSlotOffset(); |
1592 const intptr_t dest_offset = destination.ToStackSlotOffset(); | 1590 const intptr_t dest_offset = destination.ToStackSlotOffset(); |
1593 __ LoadFromOffset(TMP, FP, source_offset, PP); | 1591 __ LoadFromOffset(TMP, FP, source_offset, PP); |
1594 __ StoreToOffset(TMP, FP, dest_offset, PP); | 1592 __ StoreToOffset(TMP, FP, dest_offset, PP); |
1595 } | 1593 } |
1596 } else if (source.IsFpuRegister()) { | 1594 } else if (source.IsFpuRegister()) { |
1597 if (destination.IsFpuRegister()) { | 1595 if (destination.IsFpuRegister()) { |
1598 __ fmovdd(destination.fpu_reg(), source.fpu_reg()); | 1596 __ vmov(destination.fpu_reg(), source.fpu_reg()); |
1599 } else { | 1597 } else { |
1600 if (destination.IsDoubleStackSlot()) { | 1598 if (destination.IsDoubleStackSlot()) { |
1601 const intptr_t dest_offset = destination.ToStackSlotOffset(); | 1599 const intptr_t dest_offset = destination.ToStackSlotOffset(); |
1602 VRegister src = source.fpu_reg(); | 1600 VRegister src = source.fpu_reg(); |
1603 __ StoreDToOffset(src, FP, dest_offset, PP); | 1601 __ StoreDToOffset(src, FP, dest_offset, PP); |
1604 } else { | 1602 } else { |
1605 ASSERT(destination.IsQuadStackSlot()); | 1603 ASSERT(destination.IsQuadStackSlot()); |
1606 UNIMPLEMENTED(); | 1604 const intptr_t dest_offset = destination.ToStackSlotOffset(); |
| 1605 __ StoreQToOffset(source.fpu_reg(), FP, dest_offset, PP); |
1607 } | 1606 } |
1608 } | 1607 } |
1609 } else if (source.IsDoubleStackSlot()) { | 1608 } else if (source.IsDoubleStackSlot()) { |
1610 if (destination.IsFpuRegister()) { | 1609 if (destination.IsFpuRegister()) { |
1611 const intptr_t dest_offset = source.ToStackSlotOffset(); | 1610 const intptr_t dest_offset = source.ToStackSlotOffset(); |
1612 const VRegister dst = destination.fpu_reg(); | 1611 const VRegister dst = destination.fpu_reg(); |
1613 __ LoadDFromOffset(dst, FP, dest_offset, PP); | 1612 __ LoadDFromOffset(dst, FP, dest_offset, PP); |
1614 } else { | 1613 } else { |
1615 ASSERT(destination.IsDoubleStackSlot()); | 1614 ASSERT(destination.IsDoubleStackSlot()); |
1616 const intptr_t source_offset = source.ToStackSlotOffset(); | 1615 const intptr_t source_offset = source.ToStackSlotOffset(); |
1617 const intptr_t dest_offset = destination.ToStackSlotOffset(); | 1616 const intptr_t dest_offset = destination.ToStackSlotOffset(); |
1618 __ LoadDFromOffset(VTMP, FP, source_offset, PP); | 1617 __ LoadDFromOffset(VTMP, FP, source_offset, PP); |
1619 __ StoreDToOffset(VTMP, FP, dest_offset, PP); | 1618 __ StoreDToOffset(VTMP, FP, dest_offset, PP); |
1620 } | 1619 } |
1621 } else if (source.IsQuadStackSlot()) { | 1620 } else if (source.IsQuadStackSlot()) { |
1622 UNIMPLEMENTED(); | 1621 if (destination.IsFpuRegister()) { |
| 1622 const intptr_t dest_offset = source.ToStackSlotOffset(); |
| 1623 __ LoadQFromOffset(destination.fpu_reg(), FP, dest_offset, PP); |
| 1624 } else { |
| 1625 ASSERT(destination.IsQuadStackSlot()); |
| 1626 const intptr_t source_offset = source.ToStackSlotOffset(); |
| 1627 const intptr_t dest_offset = destination.ToStackSlotOffset(); |
| 1628 __ LoadQFromOffset(VTMP, FP, source_offset, PP); |
| 1629 __ StoreQToOffset(VTMP, FP, dest_offset, PP); |
| 1630 } |
1623 } else { | 1631 } else { |
1624 ASSERT(source.IsConstant()); | 1632 ASSERT(source.IsConstant()); |
1625 const Object& constant = source.constant(); | 1633 const Object& constant = source.constant(); |
1626 if (destination.IsRegister()) { | 1634 if (destination.IsRegister()) { |
1627 __ LoadObject(destination.reg(), constant, PP); | 1635 __ LoadObject(destination.reg(), constant, PP); |
1628 } else if (destination.IsFpuRegister()) { | 1636 } else if (destination.IsFpuRegister()) { |
1629 const VRegister dst = destination.fpu_reg(); | 1637 const VRegister dst = destination.fpu_reg(); |
1630 __ LoadObject(TMP, constant, PP); | 1638 __ LoadObject(TMP, constant, PP); |
1631 __ LoadDFieldFromOffset(dst, TMP, Double::value_offset(), PP); | 1639 __ LoadDFieldFromOffset(dst, TMP, Double::value_offset(), PP); |
1632 } else if (destination.IsDoubleStackSlot()) { | 1640 } else if (destination.IsDoubleStackSlot()) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1785 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
1778 UNIMPLEMENTED(); | 1786 UNIMPLEMENTED(); |
1779 } | 1787 } |
1780 | 1788 |
1781 | 1789 |
1782 #undef __ | 1790 #undef __ |
1783 | 1791 |
1784 } // namespace dart | 1792 } // namespace dart |
1785 | 1793 |
1786 #endif // defined TARGET_ARCH_ARM64 | 1794 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |