| OLD | NEW |
| 1 //===- subzero/src/IceInstX86Base.h - Generic x86 instructions -*- C++ -*--===// | 1 //===- subzero/src/IceInstX86Base.h - Generic 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 /// \file | 10 /// \file |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 Sub, | 125 Sub, |
| 126 SubRMW, | 126 SubRMW, |
| 127 Subps, | 127 Subps, |
| 128 Subss, | 128 Subss, |
| 129 Test, | 129 Test, |
| 130 Ucomiss, | 130 Ucomiss, |
| 131 UD2, | 131 UD2, |
| 132 Xadd, | 132 Xadd, |
| 133 Xchg, | 133 Xchg, |
| 134 Xor, | 134 Xor, |
| 135 XorRMW | 135 XorRMW, |
| 136 |
| 137 /// Intel Architecture Code Analyzer markers. These are not executable so |
| 138 /// must only be used for analysis. |
| 139 IacaStart, |
| 140 IacaEnd |
| 136 }; | 141 }; |
| 137 | 142 |
| 138 static const char *getWidthString(Type Ty); | 143 static const char *getWidthString(Type Ty); |
| 139 static const char *getFldString(Type Ty); | 144 static const char *getFldString(Type Ty); |
| 140 static typename Traits::Cond::BrCond | 145 static typename Traits::Cond::BrCond |
| 141 getOppositeCondition(typename Traits::Cond::BrCond Cond); | 146 getOppositeCondition(typename Traits::Cond::BrCond Cond); |
| 142 void dump(const Cfg *Func) const override; | 147 void dump(const Cfg *Func) const override; |
| 143 | 148 |
| 144 // Shared emit routines for common forms of instructions. | 149 // Shared emit routines for common forms of instructions. |
| 145 // See the definition of emitTwoAddress() for a description of | 150 // See the definition of emitTwoAddress() for a description of |
| (...skipping 2541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2687 void emitIAS(const Cfg *Func) const override; | 2692 void emitIAS(const Cfg *Func) const override; |
| 2688 void dump(const Cfg *Func) const override; | 2693 void dump(const Cfg *Func) const override; |
| 2689 static bool classof(const Inst *Inst) { | 2694 static bool classof(const Inst *Inst) { |
| 2690 return InstX86Base<Machine>::isClassof(Inst, InstX86Base<Machine>::Xchg); | 2695 return InstX86Base<Machine>::isClassof(Inst, InstX86Base<Machine>::Xchg); |
| 2691 } | 2696 } |
| 2692 | 2697 |
| 2693 private: | 2698 private: |
| 2694 InstX86Xchg(Cfg *Func, Operand *Dest, Variable *Source); | 2699 InstX86Xchg(Cfg *Func, Operand *Dest, Variable *Source); |
| 2695 }; | 2700 }; |
| 2696 | 2701 |
| 2702 /// Start marker for the Intel Architecture Code Analyzer. This is not an |
| 2703 /// executable instruction and must only be used for analysis. |
| 2704 template <class Machine> |
| 2705 class InstX86IacaStart final : public InstX86Base<Machine> { |
| 2706 InstX86IacaStart() = delete; |
| 2707 InstX86IacaStart(const InstX86IacaStart &) = delete; |
| 2708 InstX86IacaStart &operator=(const InstX86IacaStart &) = delete; |
| 2709 |
| 2710 public: |
| 2711 static InstX86IacaStart *create(Cfg *Func) { |
| 2712 return new (Func->allocate<InstX86IacaStart>()) InstX86IacaStart(Func); |
| 2713 } |
| 2714 void emit(const Cfg *Func) const override; |
| 2715 void emitIAS(const Cfg *Func) const override; |
| 2716 void dump(const Cfg *Func) const override; |
| 2717 static bool classof(const Inst *Inst) { |
| 2718 return InstX86Base<Machine>::isClassof(Inst, |
| 2719 InstX86Base<Machine>::IacaStart); |
| 2720 } |
| 2721 |
| 2722 private: |
| 2723 InstX86IacaStart(Cfg *Func); |
| 2724 }; |
| 2725 |
| 2726 /// End marker for the Intel Architecture Code Analyzer. This is not an |
| 2727 /// executable instruction and must only be used for analysis. |
| 2728 template <class Machine> |
| 2729 class InstX86IacaEnd final : public InstX86Base<Machine> { |
| 2730 InstX86IacaEnd() = delete; |
| 2731 InstX86IacaEnd(const InstX86IacaEnd &) = delete; |
| 2732 InstX86IacaEnd &operator=(const InstX86IacaEnd &) = delete; |
| 2733 |
| 2734 public: |
| 2735 static InstX86IacaEnd *create(Cfg *Func) { |
| 2736 return new (Func->allocate<InstX86IacaEnd>()) InstX86IacaEnd(Func); |
| 2737 } |
| 2738 void emit(const Cfg *Func) const override; |
| 2739 void emitIAS(const Cfg *Func) const override; |
| 2740 void dump(const Cfg *Func) const override; |
| 2741 static bool classof(const Inst *Inst) { |
| 2742 return InstX86Base<Machine>::isClassof(Inst, InstX86Base<Machine>::IacaEnd); |
| 2743 } |
| 2744 |
| 2745 private: |
| 2746 InstX86IacaEnd(Cfg *Func); |
| 2747 }; |
| 2748 |
| 2697 /// struct Insts is a template that can be used to instantiate all the X86 | 2749 /// struct Insts is a template that can be used to instantiate all the X86 |
| 2698 /// instructions for a target with a simple | 2750 /// instructions for a target with a simple |
| 2699 /// | 2751 /// |
| 2700 /// using Insts = ::Ice::X86Internal::Insts<TargeT>; | 2752 /// using Insts = ::Ice::X86Internal::Insts<TargeT>; |
| 2701 template <class Machine> struct Insts { | 2753 template <class Machine> struct Insts { |
| 2702 using FakeRMW = InstX86FakeRMW<Machine>; | 2754 using FakeRMW = InstX86FakeRMW<Machine>; |
| 2703 using Label = InstX86Label<Machine>; | 2755 using Label = InstX86Label<Machine>; |
| 2704 | 2756 |
| 2705 using AdjustStack = InstX86AdjustStack<Machine>; | 2757 using AdjustStack = InstX86AdjustStack<Machine>; |
| 2706 using Call = InstX86Call<Machine>; | 2758 using Call = InstX86Call<Machine>; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2791 template <typename T = typename InstX86Base<Machine>::Traits> | 2843 template <typename T = typename InstX86Base<Machine>::Traits> |
| 2792 using Fld = typename std::enable_if<T::UsesX87, InstX86Fld<Machine>>::type; | 2844 using Fld = typename std::enable_if<T::UsesX87, InstX86Fld<Machine>>::type; |
| 2793 template <typename T = typename InstX86Base<Machine>::Traits> | 2845 template <typename T = typename InstX86Base<Machine>::Traits> |
| 2794 using Fstp = typename std::enable_if<T::UsesX87, InstX86Fstp<Machine>>::type; | 2846 using Fstp = typename std::enable_if<T::UsesX87, InstX86Fstp<Machine>>::type; |
| 2795 using Pop = InstX86Pop<Machine>; | 2847 using Pop = InstX86Pop<Machine>; |
| 2796 using Push = InstX86Push<Machine>; | 2848 using Push = InstX86Push<Machine>; |
| 2797 using Ret = InstX86Ret<Machine>; | 2849 using Ret = InstX86Ret<Machine>; |
| 2798 using Setcc = InstX86Setcc<Machine>; | 2850 using Setcc = InstX86Setcc<Machine>; |
| 2799 using Xadd = InstX86Xadd<Machine>; | 2851 using Xadd = InstX86Xadd<Machine>; |
| 2800 using Xchg = InstX86Xchg<Machine>; | 2852 using Xchg = InstX86Xchg<Machine>; |
| 2853 |
| 2854 using IacaStart = InstX86IacaStart<Machine>; |
| 2855 using IacaEnd = InstX86IacaEnd<Machine>; |
| 2801 }; | 2856 }; |
| 2802 | 2857 |
| 2803 /// X86 Instructions have static data (particularly, opcodes and instruction | 2858 /// X86 Instructions have static data (particularly, opcodes and instruction |
| 2804 /// emitters). Each X86 target needs to define all of these, so this macro is | 2859 /// emitters). Each X86 target needs to define all of these, so this macro is |
| 2805 /// provided so that, if something changes, then all X86 targets will be updated | 2860 /// provided so that, if something changes, then all X86 targets will be updated |
| 2806 /// automatically. | 2861 /// automatically. |
| 2807 #define X86INSTS_DEFINE_STATIC_DATA(Machine) \ | 2862 #define X86INSTS_DEFINE_STATIC_DATA(Machine) \ |
| 2808 namespace Ice { \ | 2863 namespace Ice { \ |
| 2809 namespace X86Internal { \ | 2864 namespace X86Internal { \ |
| 2810 /* In-place ops */ \ | 2865 /* In-place ops */ \ |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3149 &InstX86Base<Machine>::Traits::Assembler::psrl}; \ | 3204 &InstX86Base<Machine>::Traits::Assembler::psrl}; \ |
| 3150 } \ | 3205 } \ |
| 3151 } | 3206 } |
| 3152 | 3207 |
| 3153 } // end of namespace X86Internal | 3208 } // end of namespace X86Internal |
| 3154 } // end of namespace Ice | 3209 } // end of namespace Ice |
| 3155 | 3210 |
| 3156 #include "IceInstX86BaseImpl.h" | 3211 #include "IceInstX86BaseImpl.h" |
| 3157 | 3212 |
| 3158 #endif // SUBZERO_SRC_ICEINSTX86BASE_H | 3213 #endif // SUBZERO_SRC_ICEINSTX86BASE_H |
| OLD | NEW |