Index: src/IceInstARM32.h |
diff --git a/src/IceInstARM32.h b/src/IceInstARM32.h |
index f0240a13514e2a8773f3f2f5bf1d3cd89e90d3c7..41ca5080568053ba2215af7f47b734476a5132ee 100644 |
--- a/src/IceInstARM32.h |
+++ b/src/IceInstARM32.h |
@@ -38,6 +38,7 @@ public: |
enum OperandKindARM32 { |
k__Start = Operand::kTarget, |
kMem, |
+ kShAmtImm, |
kFlexStart, |
kFlexImm = kFlexStart, |
kFlexFpImm, |
@@ -152,6 +153,36 @@ private: |
AddrMode Mode; |
}; |
+/// OperandARM32ShAmtImm represents an Immediate that is used in one of the |
+/// shift-by-immediate instructions (lsl, lsr, and asr), and shift-by-immediate |
+/// shifted registers. |
+class OperandARM32ShAmtImm : public OperandARM32 { |
+ OperandARM32ShAmtImm() = delete; |
+ OperandARM32ShAmtImm(const OperandARM32ShAmtImm &) = delete; |
+ OperandARM32ShAmtImm &operator=(const OperandARM32ShAmtImm &) = delete; |
+ |
+public: |
+ static OperandARM32ShAmtImm *create(Cfg *Func, ConstantInteger32 *ShAmt) { |
+ return new (Func->allocate<OperandARM32ShAmtImm>()) |
+ OperandARM32ShAmtImm(ShAmt); |
+ } |
+ |
+ static bool classof(const Operand *Operand) { |
+ return Operand->getKind() == static_cast<OperandKind>(kShAmtImm); |
+ } |
+ |
+ void emit(const Cfg *Func) const override; |
+ using OperandARM32::dump; |
+ void dump(const Cfg *Func, Ostream &Str) const override; |
+ |
+ uint32_t getShAmtImm() const { return ShAmt->getValue(); } |
+ |
+private: |
+ explicit OperandARM32ShAmtImm(ConstantInteger32 *SA); |
+ |
+ const ConstantInteger32 *const ShAmt; |
+}; |
+ |
/// OperandARM32Flex represent the "flexible second operand" for data-processing |
/// instructions. It can be a rotatable 8-bit constant, or a register with an |
/// optional shift operand. The shift amount can even be a third register. |