OLD | NEW |
1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - Low-level x86 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 InstX8632 and OperandX8632 classes and | 10 // This file declares the InstX8632 and OperandX8632 classes and |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 Cvt, | 144 Cvt, |
145 Div, | 145 Div, |
146 Divss, | 146 Divss, |
147 Fld, | 147 Fld, |
148 Fstp, | 148 Fstp, |
149 Icmp, | 149 Icmp, |
150 Idiv, | 150 Idiv, |
151 Imul, | 151 Imul, |
152 Label, | 152 Label, |
153 Load, | 153 Load, |
| 154 Mfence, |
154 Mov, | 155 Mov, |
| 156 Movq, |
155 Movsx, | 157 Movsx, |
156 Movzx, | 158 Movzx, |
157 Mul, | 159 Mul, |
158 Mulss, | 160 Mulss, |
159 Or, | 161 Or, |
160 Pop, | 162 Pop, |
161 Push, | 163 Push, |
162 Ret, | 164 Ret, |
163 Sar, | 165 Sar, |
164 Sbb, | 166 Sbb, |
165 Shl, | 167 Shl, |
166 Shld, | 168 Shld, |
167 Shr, | 169 Shr, |
168 Shrd, | 170 Shrd, |
169 Store, | 171 Store, |
| 172 StoreQ, |
170 Sub, | 173 Sub, |
171 Subss, | 174 Subss, |
172 Test, | 175 Test, |
173 Ucomiss, | 176 Ucomiss, |
174 UD2, | 177 UD2, |
| 178 Xadd, |
175 Xor | 179 Xor |
176 }; | 180 }; |
177 static const char *getWidthString(Type Ty); | 181 static const char *getWidthString(Type Ty); |
178 virtual void emit(const Cfg *Func) const = 0; | 182 virtual void emit(const Cfg *Func) const = 0; |
179 virtual void dump(const Cfg *Func) const; | 183 virtual void dump(const Cfg *Func) const; |
180 | 184 |
181 protected: | 185 protected: |
182 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) | 186 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) |
183 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} | 187 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} |
184 virtual ~InstX8632() {} | 188 virtual ~InstX8632() {} |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 virtual void dump(const Cfg *Func) const; | 575 virtual void dump(const Cfg *Func) const; |
572 static bool classof(const Inst *Inst) { return isClassof(Inst, Test); } | 576 static bool classof(const Inst *Inst) { return isClassof(Inst, Test); } |
573 | 577 |
574 private: | 578 private: |
575 InstX8632Test(Cfg *Func, Operand *Source1, Operand *Source2); | 579 InstX8632Test(Cfg *Func, Operand *Source1, Operand *Source2); |
576 InstX8632Test(const InstX8632Test &) LLVM_DELETED_FUNCTION; | 580 InstX8632Test(const InstX8632Test &) LLVM_DELETED_FUNCTION; |
577 InstX8632Test &operator=(const InstX8632Test &) LLVM_DELETED_FUNCTION; | 581 InstX8632Test &operator=(const InstX8632Test &) LLVM_DELETED_FUNCTION; |
578 virtual ~InstX8632Test() {} | 582 virtual ~InstX8632Test() {} |
579 }; | 583 }; |
580 | 584 |
| 585 // Mfence instruction. |
| 586 class InstX8632Mfence : public InstX8632 { |
| 587 public: |
| 588 static InstX8632Mfence *create(Cfg *Func) { |
| 589 return new (Func->allocate<InstX8632Mfence>()) InstX8632Mfence(Func); |
| 590 } |
| 591 virtual void emit(const Cfg *Func) const; |
| 592 virtual void dump(const Cfg *Func) const; |
| 593 static bool classof(const Inst *Inst) { return isClassof(Inst, Mfence); } |
| 594 |
| 595 private: |
| 596 InstX8632Mfence(Cfg *Func); |
| 597 InstX8632Mfence(const InstX8632Mfence &) LLVM_DELETED_FUNCTION; |
| 598 InstX8632Mfence &operator=(const InstX8632Mfence &) LLVM_DELETED_FUNCTION; |
| 599 virtual ~InstX8632Mfence() {} |
| 600 }; |
| 601 |
581 // This is essentially a "mov" instruction with an OperandX8632Mem | 602 // This is essentially a "mov" instruction with an OperandX8632Mem |
582 // operand instead of Variable as the destination. It's important | 603 // operand instead of Variable as the destination. It's important |
583 // for liveness that there is no Dest operand. | 604 // for liveness that there is no Dest operand. |
584 class InstX8632Store : public InstX8632 { | 605 class InstX8632Store : public InstX8632 { |
585 public: | 606 public: |
586 static InstX8632Store *create(Cfg *Func, Operand *Value, OperandX8632 *Mem) { | 607 static InstX8632Store *create(Cfg *Func, Operand *Value, OperandX8632 *Mem) { |
587 return new (Func->allocate<InstX8632Store>()) | 608 return new (Func->allocate<InstX8632Store>()) |
588 InstX8632Store(Func, Value, Mem); | 609 InstX8632Store(Func, Value, Mem); |
589 } | 610 } |
590 virtual void emit(const Cfg *Func) const; | 611 virtual void emit(const Cfg *Func) const; |
(...skipping 19 matching lines...) Expand all Loading... |
610 virtual void dump(const Cfg *Func) const; | 631 virtual void dump(const Cfg *Func) const; |
611 static bool classof(const Inst *Inst) { return isClassof(Inst, Mov); } | 632 static bool classof(const Inst *Inst) { return isClassof(Inst, Mov); } |
612 | 633 |
613 private: | 634 private: |
614 InstX8632Mov(Cfg *Func, Variable *Dest, Operand *Source); | 635 InstX8632Mov(Cfg *Func, Variable *Dest, Operand *Source); |
615 InstX8632Mov(const InstX8632Mov &) LLVM_DELETED_FUNCTION; | 636 InstX8632Mov(const InstX8632Mov &) LLVM_DELETED_FUNCTION; |
616 InstX8632Mov &operator=(const InstX8632Mov &) LLVM_DELETED_FUNCTION; | 637 InstX8632Mov &operator=(const InstX8632Mov &) LLVM_DELETED_FUNCTION; |
617 virtual ~InstX8632Mov() {} | 638 virtual ~InstX8632Mov() {} |
618 }; | 639 }; |
619 | 640 |
| 641 // This is essentially a "movq" instruction with an OperandX8632Mem |
| 642 // operand instead of Variable as the destination. It's important |
| 643 // for liveness that there is no Dest operand. |
| 644 class InstX8632StoreQ : public InstX8632 { |
| 645 public: |
| 646 static InstX8632StoreQ *create(Cfg *Func, Operand *Value, OperandX8632 *Mem) { |
| 647 return new (Func->allocate<InstX8632StoreQ>()) |
| 648 InstX8632StoreQ(Func, Value, Mem); |
| 649 } |
| 650 virtual void emit(const Cfg *Func) const; |
| 651 virtual void dump(const Cfg *Func) const; |
| 652 static bool classof(const Inst *Inst) { return isClassof(Inst, StoreQ); } |
| 653 |
| 654 private: |
| 655 InstX8632StoreQ(Cfg *Func, Operand *Value, OperandX8632 *Mem); |
| 656 InstX8632StoreQ(const InstX8632StoreQ &) LLVM_DELETED_FUNCTION; |
| 657 InstX8632StoreQ &operator=(const InstX8632StoreQ &) LLVM_DELETED_FUNCTION; |
| 658 virtual ~InstX8632StoreQ() {} |
| 659 }; |
| 660 |
| 661 // Movq - copy between XMM registers, or mem64 and XMM registers. |
| 662 class InstX8632Movq : public InstX8632 { |
| 663 public: |
| 664 static InstX8632Movq *create(Cfg *Func, Variable *Dest, Operand *Source) { |
| 665 return new (Func->allocate<InstX8632Movq>()) |
| 666 InstX8632Movq(Func, Dest, Source); |
| 667 } |
| 668 virtual bool isRedundantAssign() const; |
| 669 virtual void emit(const Cfg *Func) const; |
| 670 virtual void dump(const Cfg *Func) const; |
| 671 static bool classof(const Inst *Inst) { return isClassof(Inst, Movq); } |
| 672 |
| 673 private: |
| 674 InstX8632Movq(Cfg *Func, Variable *Dest, Operand *Source); |
| 675 InstX8632Movq(const InstX8632Movq &) LLVM_DELETED_FUNCTION; |
| 676 InstX8632Movq &operator=(const InstX8632Movq &) LLVM_DELETED_FUNCTION; |
| 677 virtual ~InstX8632Movq() {} |
| 678 }; |
| 679 |
620 // Movsx - copy from a narrower integer type to a wider integer | 680 // Movsx - copy from a narrower integer type to a wider integer |
621 // type, with sign extension. | 681 // type, with sign extension. |
622 class InstX8632Movsx : public InstX8632 { | 682 class InstX8632Movsx : public InstX8632 { |
623 public: | 683 public: |
624 static InstX8632Movsx *create(Cfg *Func, Variable *Dest, Operand *Source) { | 684 static InstX8632Movsx *create(Cfg *Func, Variable *Dest, Operand *Source) { |
625 return new (Func->allocate<InstX8632Movsx>()) | 685 return new (Func->allocate<InstX8632Movsx>()) |
626 InstX8632Movsx(Func, Dest, Source); | 686 InstX8632Movsx(Func, Dest, Source); |
627 } | 687 } |
628 virtual void emit(const Cfg *Func) const; | 688 virtual void emit(const Cfg *Func) const; |
629 virtual void dump(const Cfg *Func) const; | 689 virtual void dump(const Cfg *Func) const; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 virtual void dump(const Cfg *Func) const; | 797 virtual void dump(const Cfg *Func) const; |
738 static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } | 798 static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } |
739 | 799 |
740 private: | 800 private: |
741 InstX8632Ret(Cfg *Func, Variable *Source); | 801 InstX8632Ret(Cfg *Func, Variable *Source); |
742 InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION; | 802 InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION; |
743 InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION; | 803 InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION; |
744 virtual ~InstX8632Ret() {} | 804 virtual ~InstX8632Ret() {} |
745 }; | 805 }; |
746 | 806 |
| 807 // Exchanging Add instruction. Exchanges the first operand (destination |
| 808 // operand) with the second operand (source operand), then loads the sum |
| 809 // of the two values into the destination operand. The destination may be |
| 810 // a register or memory, while the source must be a register. |
| 811 // |
| 812 // Both the dest and source are updated. The caller should then insert a |
| 813 // FakeDef to reflect the second udpate. |
| 814 class InstX8632Xadd : public InstX8632 { |
| 815 public: |
| 816 static InstX8632Xadd *create(Cfg *Func, Operand *Dest, Variable *Source, |
| 817 bool Locked) { |
| 818 return new (Func->allocate<InstX8632Xadd>()) |
| 819 InstX8632Xadd(Func, Dest, Source, Locked); |
| 820 } |
| 821 virtual void emit(const Cfg *Func) const; |
| 822 virtual void dump(const Cfg *Func) const; |
| 823 static bool classof(const Inst *Inst) { return isClassof(Inst, Xadd); } |
| 824 |
| 825 private: |
| 826 bool Locked; |
| 827 |
| 828 InstX8632Xadd(Cfg *Func, Operand *Dest, Variable *Source, bool Locked); |
| 829 InstX8632Xadd(const InstX8632Xadd &) LLVM_DELETED_FUNCTION; |
| 830 InstX8632Xadd &operator=(const InstX8632Xadd &) LLVM_DELETED_FUNCTION; |
| 831 virtual ~InstX8632Xadd() {} |
| 832 }; |
| 833 |
747 } // end of namespace Ice | 834 } // end of namespace Ice |
748 | 835 |
749 #endif // SUBZERO_SRC_ICEINSTX8632_H | 836 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |