OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_ARM64_ASSEMBLER_ARM64_H_ | 5 #ifndef V8_ARM64_ASSEMBLER_ARM64_H_ |
6 #define V8_ARM64_ASSEMBLER_ARM64_H_ | 6 #define V8_ARM64_ASSEMBLER_ARM64_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 Extend extend_; | 692 Extend extend_; |
693 unsigned shift_amount_; | 693 unsigned shift_amount_; |
694 }; | 694 }; |
695 | 695 |
696 | 696 |
697 // MemOperand represents a memory operand in a load or store instruction. | 697 // MemOperand represents a memory operand in a load or store instruction. |
698 class MemOperand { | 698 class MemOperand { |
699 public: | 699 public: |
700 inline MemOperand(); | 700 inline MemOperand(); |
701 inline explicit MemOperand(Register base, | 701 inline explicit MemOperand(Register base, |
702 ptrdiff_t offset = 0, | 702 int64_t offset = 0, |
703 AddrMode addrmode = Offset); | 703 AddrMode addrmode = Offset); |
704 inline explicit MemOperand(Register base, | 704 inline explicit MemOperand(Register base, |
705 Register regoffset, | 705 Register regoffset, |
706 Shift shift = LSL, | 706 Shift shift = LSL, |
707 unsigned shift_amount = 0); | 707 unsigned shift_amount = 0); |
708 inline explicit MemOperand(Register base, | 708 inline explicit MemOperand(Register base, |
709 Register regoffset, | 709 Register regoffset, |
710 Extend extend, | 710 Extend extend, |
711 unsigned shift_amount = 0); | 711 unsigned shift_amount = 0); |
712 inline explicit MemOperand(Register base, | 712 inline explicit MemOperand(Register base, |
713 const Operand& offset, | 713 const Operand& offset, |
714 AddrMode addrmode = Offset); | 714 AddrMode addrmode = Offset); |
715 | 715 |
716 const Register& base() const { return base_; } | 716 const Register& base() const { return base_; } |
717 const Register& regoffset() const { return regoffset_; } | 717 const Register& regoffset() const { return regoffset_; } |
718 ptrdiff_t offset() const { return offset_; } | 718 int64_t offset() const { return offset_; } |
719 AddrMode addrmode() const { return addrmode_; } | 719 AddrMode addrmode() const { return addrmode_; } |
720 Shift shift() const { return shift_; } | 720 Shift shift() const { return shift_; } |
721 Extend extend() const { return extend_; } | 721 Extend extend() const { return extend_; } |
722 unsigned shift_amount() const { return shift_amount_; } | 722 unsigned shift_amount() const { return shift_amount_; } |
723 inline bool IsImmediateOffset() const; | 723 inline bool IsImmediateOffset() const; |
724 inline bool IsRegisterOffset() const; | 724 inline bool IsRegisterOffset() const; |
725 inline bool IsPreIndex() const; | 725 inline bool IsPreIndex() const; |
726 inline bool IsPostIndex() const; | 726 inline bool IsPostIndex() const; |
727 | 727 |
728 // For offset modes, return the offset as an Operand. This helper cannot | 728 // For offset modes, return the offset as an Operand. This helper cannot |
729 // handle indexed modes. | 729 // handle indexed modes. |
730 inline Operand OffsetAsOperand() const; | 730 inline Operand OffsetAsOperand() const; |
731 | 731 |
732 enum PairResult { | 732 enum PairResult { |
733 kNotPair, // Can't use a pair instruction. | 733 kNotPair, // Can't use a pair instruction. |
734 kPairAB, // Can use a pair instruction (operandA has lower address). | 734 kPairAB, // Can use a pair instruction (operandA has lower address). |
735 kPairBA // Can use a pair instruction (operandB has lower address). | 735 kPairBA // Can use a pair instruction (operandB has lower address). |
736 }; | 736 }; |
737 // Check if two MemOperand are consistent for stp/ldp use. | 737 // Check if two MemOperand are consistent for stp/ldp use. |
738 static PairResult AreConsistentForPair(const MemOperand& operandA, | 738 static PairResult AreConsistentForPair(const MemOperand& operandA, |
739 const MemOperand& operandB, | 739 const MemOperand& operandB, |
740 int access_size_log2 = kXRegSizeLog2); | 740 int access_size_log2 = kXRegSizeLog2); |
741 | 741 |
742 private: | 742 private: |
743 Register base_; | 743 Register base_; |
744 Register regoffset_; | 744 Register regoffset_; |
745 ptrdiff_t offset_; | 745 int64_t offset_; |
746 AddrMode addrmode_; | 746 AddrMode addrmode_; |
747 Shift shift_; | 747 Shift shift_; |
748 Extend extend_; | 748 Extend extend_; |
749 unsigned shift_amount_; | 749 unsigned shift_amount_; |
750 }; | 750 }; |
751 | 751 |
752 | 752 |
753 class ConstPool { | 753 class ConstPool { |
754 public: | 754 public: |
755 explicit ConstPool(Assembler* assm) | 755 explicit ConstPool(Assembler* assm) |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 | 1926 |
1927 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockPoolsScope); | 1927 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockPoolsScope); |
1928 }; | 1928 }; |
1929 | 1929 |
1930 protected: | 1930 protected: |
1931 inline const Register& AppropriateZeroRegFor(const CPURegister& reg) const; | 1931 inline const Register& AppropriateZeroRegFor(const CPURegister& reg) const; |
1932 | 1932 |
1933 void LoadStore(const CPURegister& rt, | 1933 void LoadStore(const CPURegister& rt, |
1934 const MemOperand& addr, | 1934 const MemOperand& addr, |
1935 LoadStoreOp op); | 1935 LoadStoreOp op); |
1936 static bool IsImmLSUnscaled(ptrdiff_t offset); | 1936 static bool IsImmLSUnscaled(int64_t offset); |
1937 static bool IsImmLSScaled(ptrdiff_t offset, LSDataSize size); | 1937 static bool IsImmLSScaled(int64_t offset, LSDataSize size); |
1938 | 1938 |
1939 void LoadStorePair(const CPURegister& rt, const CPURegister& rt2, | 1939 void LoadStorePair(const CPURegister& rt, const CPURegister& rt2, |
1940 const MemOperand& addr, LoadStorePairOp op); | 1940 const MemOperand& addr, LoadStorePairOp op); |
1941 static bool IsImmLSPair(ptrdiff_t offset, LSDataSize size); | 1941 static bool IsImmLSPair(int64_t offset, LSDataSize size); |
1942 | 1942 |
1943 void Logical(const Register& rd, | 1943 void Logical(const Register& rd, |
1944 const Register& rn, | 1944 const Register& rn, |
1945 const Operand& operand, | 1945 const Operand& operand, |
1946 LogicalOp op); | 1946 LogicalOp op); |
1947 void LogicalImmediate(const Register& rd, | 1947 void LogicalImmediate(const Register& rd, |
1948 const Register& rn, | 1948 const Register& rn, |
1949 unsigned n, | 1949 unsigned n, |
1950 unsigned imm_s, | 1950 unsigned imm_s, |
1951 unsigned imm_r, | 1951 unsigned imm_r, |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2276 // Verify no relocation information has been emitted. | 2276 // Verify no relocation information has been emitted. |
2277 DCHECK(IsConstPoolEmpty()); | 2277 DCHECK(IsConstPoolEmpty()); |
2278 // Flush the Instruction cache. | 2278 // Flush the Instruction cache. |
2279 size_t length = buffer_size_ - kGap; | 2279 size_t length = buffer_size_ - kGap; |
2280 CpuFeatures::FlushICache(buffer_, length); | 2280 CpuFeatures::FlushICache(buffer_, length); |
2281 } | 2281 } |
2282 | 2282 |
2283 // See definition of PatchAdrFar() for details. | 2283 // See definition of PatchAdrFar() for details. |
2284 static const int kAdrFarPatchableNNops = 2; | 2284 static const int kAdrFarPatchableNNops = 2; |
2285 static const int kAdrFarPatchableNInstrs = kAdrFarPatchableNNops + 2; | 2285 static const int kAdrFarPatchableNInstrs = kAdrFarPatchableNNops + 2; |
2286 void PatchAdrFar(ptrdiff_t target_offset); | 2286 void PatchAdrFar(int64_t target_offset); |
2287 }; | 2287 }; |
2288 | 2288 |
2289 | 2289 |
2290 class EnsureSpace BASE_EMBEDDED { | 2290 class EnsureSpace BASE_EMBEDDED { |
2291 public: | 2291 public: |
2292 explicit EnsureSpace(Assembler* assembler) { | 2292 explicit EnsureSpace(Assembler* assembler) { |
2293 assembler->CheckBufferSpace(); | 2293 assembler->CheckBufferSpace(); |
2294 } | 2294 } |
2295 }; | 2295 }; |
2296 | 2296 |
2297 } } // namespace v8::internal | 2297 } } // namespace v8::internal |
2298 | 2298 |
2299 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ | 2299 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ |
OLD | NEW |