diff options
author | kobalicek <kobalicek.petr@gmail.com> | 2022-02-25 00:39:07 +0300 |
---|---|---|
committer | kobalicek <kobalicek.petr@gmail.com> | 2022-02-25 00:39:07 +0300 |
commit | 6efd4d563dee6832224295fa3bbf1647964246c4 (patch) | |
tree | 0b9de680243abaca6f4460f51f86c0950caaea3e | |
parent | a4e1e88374142f4a842892f9c4bd0b0776fdcd0a (diff) |
Added missing baseReg() and indexReg() to arm::Mem operand
-rw-r--r-- | src/asmjit/arm/armoperand.h | 79 |
1 files changed, 52 insertions, 27 deletions
diff --git a/src/asmjit/arm/armoperand.h b/src/asmjit/arm/armoperand.h index e7803e9..ede829d 100644 --- a/src/asmjit/arm/armoperand.h +++ b/src/asmjit/arm/armoperand.h @@ -455,11 +455,12 @@ public: //! \} - //! \name ARM Specific Features + //! \name Clone //! \{ //! Clones the memory operand. inline constexpr Mem clone() const noexcept { return Mem(*this); } + //! Gets new memory operand adjusted by `off`. inline Mem cloneAdjusted(int64_t off) const noexcept { Mem result(*this); @@ -467,6 +468,51 @@ public: return result; } + //! Clones the memory operand and makes it pre-index. + inline Mem pre() const noexcept { + Mem result(*this); + result.setPredicate(kOffsetPreIndex); + return result; + } + + //! Clones the memory operand, applies a given offset `off` and makes it pre-index. + inline Mem pre(int64_t off) const noexcept { + Mem result(*this); + result.setPredicate(kOffsetPreIndex); + result.addOffset(off); + return result; + } + + //! Clones the memory operand and makes it post-index. + inline Mem post() const noexcept { + Mem result(*this); + result.setPredicate(kOffsetPreIndex); + return result; + } + + //! Clones the memory operand, applies a given offset `off` and makes it post-index. + inline Mem post(int64_t off) const noexcept { + Mem result(*this); + result.setPredicate(kOffsetPostIndex); + result.addOffset(off); + return result; + } + + //! \} + + //! \name Base & Index + //! \{ + + //! Converts memory `baseType` and `baseId` to `arm::Reg` instance. + //! + //! The memory must have a valid base register otherwise the result will be wrong. + inline Reg baseReg() const noexcept { return Reg::fromTypeAndId(baseType(), baseId()); } + + //! Converts memory `indexType` and `indexId` to `arm::Reg` instance. + //! + //! The memory must have a valid index register otherwise the result will be wrong. + inline Reg indexReg() const noexcept { return Reg::fromTypeAndId(indexType(), indexId()); } + using BaseMem::setIndex; inline void setIndex(const BaseReg& index, uint32_t shift) noexcept { @@ -474,6 +520,11 @@ public: setShift(shift); } + //! \} + + //! \name ARM Specific Features + //! \{ + //! Gets whether the memory operand has shift (aka scale) constant. inline constexpr bool hasShift() const noexcept { return _signature.hasField<kSignatureMemShiftValueMask>(); } //! Gets the memory operand's shift (aka scale) constant. @@ -499,32 +550,6 @@ public: inline void makePreIndex() noexcept { setPredicate(kOffsetPreIndex); } inline void makePostIndex() noexcept { setPredicate(kOffsetPostIndex); } - inline Mem pre() const noexcept { - Mem result(*this); - result.setPredicate(kOffsetPreIndex); - return result; - } - - inline Mem pre(int64_t off) const noexcept { - Mem result(*this); - result.setPredicate(kOffsetPreIndex); - result.addOffset(off); - return result; - } - - inline Mem post() const noexcept { - Mem result(*this); - result.setPredicate(kOffsetPreIndex); - return result; - } - - inline Mem post(int64_t off) const noexcept { - Mem result(*this); - result.setPredicate(kOffsetPostIndex); - result.addOffset(off); - return result; - } - //! \} }; |