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/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 case kMipsShl: | 39 case kMipsShl: |
40 case kMipsSar: | 40 case kMipsSar: |
41 case kMipsShr: | 41 case kMipsShr: |
42 return is_uint5(value); | 42 return is_uint5(value); |
43 case kMipsAdd: | 43 case kMipsAdd: |
44 case kMipsAnd: | 44 case kMipsAnd: |
45 case kMipsOr: | 45 case kMipsOr: |
46 case kMipsSub: | 46 case kMipsSub: |
47 case kMipsXor: | 47 case kMipsXor: |
48 return is_uint16(value); | 48 return is_uint16(value); |
| 49 case kMipsLb: |
| 50 case kMipsLbu: |
| 51 case kMipsSb: |
| 52 case kMipsLh: |
| 53 case kMipsLhu: |
| 54 case kMipsSh: |
| 55 case kMipsLw: |
| 56 case kMipsSw: |
| 57 case kMipsLwc1: |
| 58 case kMipsSwc1: |
49 case kMipsLdc1: | 59 case kMipsLdc1: |
50 case kMipsSdc1: | 60 case kMipsSdc1: |
| 61 case kCheckedLoadInt8: |
| 62 case kCheckedLoadUint8: |
| 63 case kCheckedLoadInt16: |
| 64 case kCheckedLoadUint16: |
| 65 case kCheckedLoadWord32: |
| 66 case kCheckedStoreWord8: |
| 67 case kCheckedStoreWord16: |
| 68 case kCheckedStoreWord32: |
| 69 case kCheckedLoadFloat32: |
51 case kCheckedLoadFloat64: | 70 case kCheckedLoadFloat64: |
| 71 case kCheckedStoreFloat32: |
52 case kCheckedStoreFloat64: | 72 case kCheckedStoreFloat64: |
53 return std::numeric_limits<int16_t>::min() <= (value + kIntSize) && | 73 // true even for 32b values, offsets > 16b |
54 std::numeric_limits<int16_t>::max() >= (value + kIntSize); | 74 // are handled in assembler-mips.cc |
| 75 return is_int32(value); |
55 default: | 76 default: |
56 return is_int16(value); | 77 return is_int16(value); |
57 } | 78 } |
58 } | 79 } |
59 | 80 |
60 private: | 81 private: |
61 bool ImmediateFitsAddrMode1Instruction(int32_t imm) const { | 82 bool ImmediateFitsAddrMode1Instruction(int32_t imm) const { |
62 TRACE_UNIMPL(); | 83 TRACE_UNIMPL(); |
63 return false; | 84 return false; |
64 } | 85 } |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 case MachineRepresentation::kWord16: | 1779 case MachineRepresentation::kWord16: |
1759 opcode = load_rep.IsSigned() ? kAtomicLoadInt16 : kAtomicLoadUint16; | 1780 opcode = load_rep.IsSigned() ? kAtomicLoadInt16 : kAtomicLoadUint16; |
1760 break; | 1781 break; |
1761 case MachineRepresentation::kWord32: | 1782 case MachineRepresentation::kWord32: |
1762 opcode = kAtomicLoadWord32; | 1783 opcode = kAtomicLoadWord32; |
1763 break; | 1784 break; |
1764 default: | 1785 default: |
1765 UNREACHABLE(); | 1786 UNREACHABLE(); |
1766 return; | 1787 return; |
1767 } | 1788 } |
| 1789 |
1768 if (g.CanBeImmediate(index, opcode)) { | 1790 if (g.CanBeImmediate(index, opcode)) { |
1769 Emit(opcode | AddressingModeField::encode(kMode_MRI), | 1791 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
1770 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index)); | 1792 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index)); |
1771 } else { | 1793 } else { |
1772 InstructionOperand addr_reg = g.TempRegister(); | 1794 InstructionOperand addr_reg = g.TempRegister(); |
1773 Emit(kMipsAdd | AddressingModeField::encode(kMode_None), addr_reg, | 1795 Emit(kMipsAdd | AddressingModeField::encode(kMode_None), addr_reg, |
1774 g.UseRegister(index), g.UseRegister(base)); | 1796 g.UseRegister(index), g.UseRegister(base)); |
1775 // Emit desired load opcode, using temp addr_reg. | 1797 // Emit desired load opcode, using temp addr_reg. |
1776 Emit(opcode | AddressingModeField::encode(kMode_MRI), | 1798 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
1777 g.DefineAsRegister(node), addr_reg, g.TempImmediate(0)); | 1799 g.DefineAsRegister(node), addr_reg, g.TempImmediate(0)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || | 1870 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || |
1849 IsMipsArchVariant(kMips32r2)); | 1871 IsMipsArchVariant(kMips32r2)); |
1850 return MachineOperatorBuilder::AlignmentRequirements:: | 1872 return MachineOperatorBuilder::AlignmentRequirements:: |
1851 NoUnalignedAccessSupport(); | 1873 NoUnalignedAccessSupport(); |
1852 } | 1874 } |
1853 } | 1875 } |
1854 | 1876 |
1855 } // namespace compiler | 1877 } // namespace compiler |
1856 } // namespace internal | 1878 } // namespace internal |
1857 } // namespace v8 | 1879 } // namespace v8 |
OLD | NEW |