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 // This file declares the InstARM32 and OperandARM32 classes and | 10 // This file declares the InstARM32 and OperandARM32 classes and |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 }; | 84 }; |
85 | 85 |
86 // Provide two constructors. | 86 // Provide two constructors. |
87 // NOTE: The Variable-typed operands have to be registers. | 87 // NOTE: The Variable-typed operands have to be registers. |
88 // | 88 // |
89 // (1) Reg + Imm. The Immediate actually has a limited number of bits | 89 // (1) Reg + Imm. The Immediate actually has a limited number of bits |
90 // for encoding, so check canHoldOffset first. It cannot handle | 90 // for encoding, so check canHoldOffset first. It cannot handle |
91 // general Constant operands like ConstantRelocatable, since a relocatable | 91 // general Constant operands like ConstantRelocatable, since a relocatable |
92 // can potentially take up too many bits. | 92 // can potentially take up too many bits. |
93 static OperandARM32Mem *create(Cfg *Func, Type Ty, Variable *Base, | 93 static OperandARM32Mem *create(Cfg *Func, Type Ty, Variable *Base, |
94 ConstantInteger32 *ImmOffset = nullptr, | 94 ConstantInteger32 *ImmOffset, |
95 AddrMode Mode = Offset) { | 95 AddrMode Mode = Offset) { |
96 return new (Func->allocate<OperandARM32Mem>()) | 96 return new (Func->allocate<OperandARM32Mem>()) |
97 OperandARM32Mem(Func, Ty, Base, ImmOffset, Mode); | 97 OperandARM32Mem(Func, Ty, Base, ImmOffset, Mode); |
98 } | 98 } |
99 // (2) Reg +/- Reg with an optional shift of some kind and amount. | 99 // (2) Reg +/- Reg with an optional shift of some kind and amount. |
100 // Note that this mode is disallowed in the NaCl sandbox. | 100 // Note that this mode is disallowed in the NaCl sandbox. |
101 static OperandARM32Mem *create(Cfg *Func, Type Ty, Variable *Base, | 101 static OperandARM32Mem *create(Cfg *Func, Type Ty, Variable *Base, |
102 Variable *Index, ShiftKind ShiftOp = kNoShift, | 102 Variable *Index, ShiftKind ShiftOp = kNoShift, |
103 uint16_t ShiftAmt = 0, | 103 uint16_t ShiftAmt = 0, |
104 AddrMode Mode = Offset) { | 104 AddrMode Mode = Offset) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 Mov, | 270 Mov, |
271 Movt, | 271 Movt, |
272 Movw, | 272 Movw, |
273 Mul, | 273 Mul, |
274 Mvn, | 274 Mvn, |
275 Orr, | 275 Orr, |
276 Pop, | 276 Pop, |
277 Push, | 277 Push, |
278 Ret, | 278 Ret, |
279 Sbc, | 279 Sbc, |
| 280 Str, |
280 Sub, | 281 Sub, |
281 Umull | 282 Umull |
282 }; | 283 }; |
283 | 284 |
284 static const char *getWidthString(Type Ty); | 285 static const char *getWidthString(Type Ty); |
285 static CondARM32::Cond getOppositeCondition(CondARM32::Cond Cond); | 286 static CondARM32::Cond getOppositeCondition(CondARM32::Cond Cond); |
286 | 287 |
287 void dump(const Cfg *Func) const override; | 288 void dump(const Cfg *Func) const override; |
288 | 289 |
289 protected: | 290 protected: |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 void emit(const Cfg *Func) const override; | 757 void emit(const Cfg *Func) const override; |
757 void emitIAS(const Cfg *Func) const override; | 758 void emitIAS(const Cfg *Func) const override; |
758 void dump(const Cfg *Func) const override; | 759 void dump(const Cfg *Func) const override; |
759 static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } | 760 static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } |
760 | 761 |
761 private: | 762 private: |
762 InstARM32Ret(Cfg *Func, Variable *LR, Variable *Source); | 763 InstARM32Ret(Cfg *Func, Variable *LR, Variable *Source); |
763 ~InstARM32Ret() override {} | 764 ~InstARM32Ret() override {} |
764 }; | 765 }; |
765 | 766 |
| 767 // Store instruction. It's important for liveness that there is no Dest |
| 768 // operand (OperandARM32Mem instead of Dest Variable). |
| 769 class InstARM32Str : public InstARM32Pred { |
| 770 InstARM32Str() = delete; |
| 771 InstARM32Str(const InstARM32Str &) = delete; |
| 772 InstARM32Str &operator=(const InstARM32Str &) = delete; |
| 773 |
| 774 public: |
| 775 // Value must be a register. |
| 776 static InstARM32Str *create(Cfg *Func, Variable *Value, OperandARM32Mem *Mem, |
| 777 CondARM32::Cond Predicate) { |
| 778 return new (Func->allocate<InstARM32Str>()) |
| 779 InstARM32Str(Func, Value, Mem, Predicate); |
| 780 } |
| 781 void emit(const Cfg *Func) const override; |
| 782 void emitIAS(const Cfg *Func) const override; |
| 783 void dump(const Cfg *Func) const override; |
| 784 static bool classof(const Inst *Inst) { return isClassof(Inst, Str); } |
| 785 |
| 786 private: |
| 787 InstARM32Str(Cfg *Func, Variable *Value, OperandARM32Mem *Mem, |
| 788 CondARM32::Cond Predicate); |
| 789 ~InstARM32Str() override {} |
| 790 }; |
| 791 |
766 // Unsigned Multiply Long: d.lo, d.hi := x * y | 792 // Unsigned Multiply Long: d.lo, d.hi := x * y |
767 class InstARM32Umull : public InstARM32Pred { | 793 class InstARM32Umull : public InstARM32Pred { |
768 InstARM32Umull() = delete; | 794 InstARM32Umull() = delete; |
769 InstARM32Umull(const InstARM32Umull &) = delete; | 795 InstARM32Umull(const InstARM32Umull &) = delete; |
770 InstARM32Umull &operator=(const InstARM32Umull &) = delete; | 796 InstARM32Umull &operator=(const InstARM32Umull &) = delete; |
771 | 797 |
772 public: | 798 public: |
773 // Everything must be a register. | 799 // Everything must be a register. |
774 static InstARM32Umull *create(Cfg *Func, Variable *DestLo, Variable *DestHi, | 800 static InstARM32Umull *create(Cfg *Func, Variable *DestLo, Variable *DestHi, |
775 Variable *Src0, Variable *Src1, | 801 Variable *Src0, Variable *Src1, |
(...skipping 16 matching lines...) Expand all Loading... |
792 // Declare partial template specializations of emit() methods that | 818 // Declare partial template specializations of emit() methods that |
793 // already have default implementations. Without this, there is the | 819 // already have default implementations. Without this, there is the |
794 // possibility of ODR violations and link errors. | 820 // possibility of ODR violations and link errors. |
795 | 821 |
796 template <> void InstARM32Movw::emit(const Cfg *Func) const; | 822 template <> void InstARM32Movw::emit(const Cfg *Func) const; |
797 template <> void InstARM32Movt::emit(const Cfg *Func) const; | 823 template <> void InstARM32Movt::emit(const Cfg *Func) const; |
798 | 824 |
799 } // end of namespace Ice | 825 } // end of namespace Ice |
800 | 826 |
801 #endif // SUBZERO_SRC_ICEINSTARM32_H | 827 #endif // SUBZERO_SRC_ICEINSTARM32_H |
OLD | NEW |