OLD | NEW |
1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 20 matching lines...) Expand all Loading... |
31 /// OperandARM32Mem and OperandARM32Flex. | 31 /// OperandARM32Mem and OperandARM32Flex. |
32 class OperandARM32 : public Operand { | 32 class OperandARM32 : public Operand { |
33 OperandARM32() = delete; | 33 OperandARM32() = delete; |
34 OperandARM32(const OperandARM32 &) = delete; | 34 OperandARM32(const OperandARM32 &) = delete; |
35 OperandARM32 &operator=(const OperandARM32 &) = delete; | 35 OperandARM32 &operator=(const OperandARM32 &) = delete; |
36 | 36 |
37 public: | 37 public: |
38 enum OperandKindARM32 { | 38 enum OperandKindARM32 { |
39 k__Start = Operand::kTarget, | 39 k__Start = Operand::kTarget, |
40 kMem, | 40 kMem, |
| 41 kShAmtImm, |
41 kFlexStart, | 42 kFlexStart, |
42 kFlexImm = kFlexStart, | 43 kFlexImm = kFlexStart, |
43 kFlexFpImm, | 44 kFlexFpImm, |
44 kFlexFpZero, | 45 kFlexFpZero, |
45 kFlexReg, | 46 kFlexReg, |
46 kFlexEnd = kFlexReg | 47 kFlexEnd = kFlexReg |
47 }; | 48 }; |
48 | 49 |
49 enum ShiftKind { | 50 enum ShiftKind { |
50 kNoShift = -1, | 51 kNoShift = -1, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 ShiftKind ShiftOp, uint16_t ShiftAmt, AddrMode Mode); | 146 ShiftKind ShiftOp, uint16_t ShiftAmt, AddrMode Mode); |
146 | 147 |
147 Variable *Base; | 148 Variable *Base; |
148 ConstantInteger32 *ImmOffset; | 149 ConstantInteger32 *ImmOffset; |
149 Variable *Index; | 150 Variable *Index; |
150 ShiftKind ShiftOp; | 151 ShiftKind ShiftOp; |
151 uint16_t ShiftAmt; | 152 uint16_t ShiftAmt; |
152 AddrMode Mode; | 153 AddrMode Mode; |
153 }; | 154 }; |
154 | 155 |
| 156 /// OperandARM32ShAmtImm represents an Immediate that is used in one of the |
| 157 /// shift-by-immediate instructions (lsl, lsr, and asr), and shift-by-immediate |
| 158 /// shifted registers. |
| 159 class OperandARM32ShAmtImm : public OperandARM32 { |
| 160 OperandARM32ShAmtImm() = delete; |
| 161 OperandARM32ShAmtImm(const OperandARM32ShAmtImm &) = delete; |
| 162 OperandARM32ShAmtImm &operator=(const OperandARM32ShAmtImm &) = delete; |
| 163 |
| 164 public: |
| 165 static OperandARM32ShAmtImm *create(Cfg *Func, ConstantInteger32 *ShAmt) { |
| 166 return new (Func->allocate<OperandARM32ShAmtImm>()) |
| 167 OperandARM32ShAmtImm(ShAmt); |
| 168 } |
| 169 |
| 170 static bool classof(const Operand *Operand) { |
| 171 return Operand->getKind() == static_cast<OperandKind>(kShAmtImm); |
| 172 } |
| 173 |
| 174 void emit(const Cfg *Func) const override; |
| 175 using OperandARM32::dump; |
| 176 void dump(const Cfg *Func, Ostream &Str) const override; |
| 177 |
| 178 uint32_t getShAmtImm() const { return ShAmt->getValue(); } |
| 179 |
| 180 private: |
| 181 explicit OperandARM32ShAmtImm(ConstantInteger32 *SA); |
| 182 |
| 183 const ConstantInteger32 *const ShAmt; |
| 184 }; |
| 185 |
155 /// OperandARM32Flex represent the "flexible second operand" for data-processing | 186 /// OperandARM32Flex represent the "flexible second operand" for data-processing |
156 /// instructions. It can be a rotatable 8-bit constant, or a register with an | 187 /// instructions. It can be a rotatable 8-bit constant, or a register with an |
157 /// optional shift operand. The shift amount can even be a third register. | 188 /// optional shift operand. The shift amount can even be a third register. |
158 class OperandARM32Flex : public OperandARM32 { | 189 class OperandARM32Flex : public OperandARM32 { |
159 OperandARM32Flex() = delete; | 190 OperandARM32Flex() = delete; |
160 OperandARM32Flex(const OperandARM32Flex &) = delete; | 191 OperandARM32Flex(const OperandARM32Flex &) = delete; |
161 OperandARM32Flex &operator=(const OperandARM32Flex &) = delete; | 192 OperandARM32Flex &operator=(const OperandARM32Flex &) = delete; |
162 | 193 |
163 public: | 194 public: |
164 static bool classof(const Operand *Operand) { | 195 static bool classof(const Operand *Operand) { |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 // default implementations. Without this, there is the possibility of ODR | 1346 // default implementations. Without this, there is the possibility of ODR |
1316 // violations and link errors. | 1347 // violations and link errors. |
1317 | 1348 |
1318 template <> void InstARM32Ldr::emit(const Cfg *Func) const; | 1349 template <> void InstARM32Ldr::emit(const Cfg *Func) const; |
1319 template <> void InstARM32Movw::emit(const Cfg *Func) const; | 1350 template <> void InstARM32Movw::emit(const Cfg *Func) const; |
1320 template <> void InstARM32Movt::emit(const Cfg *Func) const; | 1351 template <> void InstARM32Movt::emit(const Cfg *Func) const; |
1321 | 1352 |
1322 } // end of namespace Ice | 1353 } // end of namespace Ice |
1323 | 1354 |
1324 #endif // SUBZERO_SRC_ICEINSTARM32_H | 1355 #endif // SUBZERO_SRC_ICEINSTARM32_H |
OLD | NEW |