diff options
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r-- | llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMBaseInstrInfo.h | 4 |
2 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp index cecc16ffccb..3dcca392259 100644 --- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -5328,11 +5328,16 @@ ARMBaseInstrInfo::getSerializableBitmaskMachineOperandTargetFlags() const { return makeArrayRef(TargetFlags); } -Optional<DestSourcePair> -ARMBaseInstrInfo::isAddImmediate(const MachineInstr &MI, - int64_t &Offset) const { +Optional<RegImmPair> ARMBaseInstrInfo::isAddImmediate(const MachineInstr &MI, + Register Reg) const { int Sign = 1; unsigned Opcode = MI.getOpcode(); + int64_t Offset = 0; + + // TODO: Handle cases where Reg is a super- or sub-register of the + // destination register. + if (Reg != MI.getOperand(0).getReg()) + return None; // We describe SUBri or ADDri instructions. if (Opcode == ARM::SUBri) @@ -5348,7 +5353,7 @@ ARMBaseInstrInfo::isAddImmediate(const MachineInstr &MI, return None; Offset = MI.getOperand(2).getImm() * Sign; - return DestSourcePair{MI.getOperand(0), MI.getOperand(1)}; + return RegImmPair{MI.getOperand(1).getReg(), Offset}; } bool llvm::registerDefinedBetween(unsigned Reg, diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.h b/llvm/lib/Target/ARM/ARMBaseInstrInfo.h index 8c231bc908a..62695a0d7bb 100644 --- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.h +++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.h @@ -455,8 +455,8 @@ public: return MI.getOperand(3).getReg(); } - Optional<DestSourcePair> isAddImmediate(const MachineInstr &MI, - int64_t &Offset) const override; + Optional<RegImmPair> isAddImmediate(const MachineInstr &MI, + Register Reg) const override; }; /// Get the operands corresponding to the given \p Pred value. By default, the |