| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 lowering ----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 lowering ----*- 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 TargetLoweringX86 template class, which | 10 // This file declares the TargetLoweringX86 template class, which |
| 11 // implements the TargetLowering base interface for the x86 | 11 // implements the TargetLowering base interface for the x86 |
| 12 // architecture. | 12 // architecture. |
| 13 // | 13 // |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H | 16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H |
| 17 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H | 17 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H |
| 18 | 18 |
| 19 #include <type_traits> |
| 19 #include <unordered_map> | 20 #include <unordered_map> |
| 20 | 21 |
| 21 #include "IceDefs.h" | 22 #include "IceDefs.h" |
| 22 #include "IceInst.h" | 23 #include "IceInst.h" |
| 23 #include "IceTargetLowering.h" | 24 #include "IceTargetLowering.h" |
| 24 | 25 |
| 25 namespace Ice { | 26 namespace Ice { |
| 26 namespace X86Internal { | 27 namespace X86Internal { |
| 27 | 28 |
| 28 template <class MachineTraits> class BoolFolding; | 29 template <class MachineTraits> class BoolFolding; |
| 29 | 30 |
| 30 template <class Machine> struct MachineTraits {}; | 31 template <class Machine> struct MachineTraits {}; |
| 31 | 32 |
| 32 template <class Machine> class TargetX86Base : public Machine { | 33 template <class Machine> class TargetX86Base : public Machine { |
| 34 static_assert(std::is_base_of<::Ice::TargetLowering, Machine>::value, |
| 35 "Machine template parameter must be a TargetLowering."); |
| 36 |
| 33 TargetX86Base() = delete; | 37 TargetX86Base() = delete; |
| 34 TargetX86Base(const TargetX86Base &) = delete; | 38 TargetX86Base(const TargetX86Base &) = delete; |
| 35 TargetX86Base &operator=(const TargetX86Base &) = delete; | 39 TargetX86Base &operator=(const TargetX86Base &) = delete; |
| 36 | 40 |
| 37 protected: | 41 protected: |
| 38 using TargetLowering::H_bitcast_16xi1_i16; | 42 using Machine::H_bitcast_16xi1_i16; |
| 39 using TargetLowering::H_bitcast_8xi1_i8; | 43 using Machine::H_bitcast_8xi1_i8; |
| 40 using TargetLowering::H_bitcast_i16_16xi1; | 44 using Machine::H_bitcast_i16_16xi1; |
| 41 using TargetLowering::H_bitcast_i8_8xi1; | 45 using Machine::H_bitcast_i8_8xi1; |
| 42 using TargetLowering::H_call_ctpop_i32; | 46 using Machine::H_call_ctpop_i32; |
| 43 using TargetLowering::H_call_ctpop_i64; | 47 using Machine::H_call_ctpop_i64; |
| 44 using TargetLowering::H_call_longjmp; | 48 using Machine::H_call_longjmp; |
| 45 using TargetLowering::H_call_memcpy; | 49 using Machine::H_call_memcpy; |
| 46 using TargetLowering::H_call_memmove; | 50 using Machine::H_call_memmove; |
| 47 using TargetLowering::H_call_memset; | 51 using Machine::H_call_memset; |
| 48 using TargetLowering::H_call_read_tp; | 52 using Machine::H_call_read_tp; |
| 49 using TargetLowering::H_call_setjmp; | 53 using Machine::H_call_setjmp; |
| 50 using TargetLowering::H_fptosi_f32_i64; | 54 using Machine::H_fptosi_f32_i64; |
| 51 using TargetLowering::H_fptosi_f64_i64; | 55 using Machine::H_fptosi_f64_i64; |
| 52 using TargetLowering::H_fptoui_4xi32_f32; | 56 using Machine::H_fptoui_4xi32_f32; |
| 53 using TargetLowering::H_fptoui_f32_i32; | 57 using Machine::H_fptoui_f32_i32; |
| 54 using TargetLowering::H_fptoui_f32_i64; | 58 using Machine::H_fptoui_f32_i64; |
| 55 using TargetLowering::H_fptoui_f64_i32; | 59 using Machine::H_fptoui_f64_i32; |
| 56 using TargetLowering::H_fptoui_f64_i64; | 60 using Machine::H_fptoui_f64_i64; |
| 57 using TargetLowering::H_frem_f32; | 61 using Machine::H_frem_f32; |
| 58 using TargetLowering::H_frem_f64; | 62 using Machine::H_frem_f64; |
| 59 using TargetLowering::H_sdiv_i64; | 63 using Machine::H_sdiv_i64; |
| 60 using TargetLowering::H_sitofp_i64_f32; | 64 using Machine::H_sitofp_i64_f32; |
| 61 using TargetLowering::H_sitofp_i64_f64; | 65 using Machine::H_sitofp_i64_f64; |
| 62 using TargetLowering::H_srem_i64; | 66 using Machine::H_srem_i64; |
| 63 using TargetLowering::H_udiv_i64; | 67 using Machine::H_udiv_i64; |
| 64 using TargetLowering::H_uitofp_4xi32_4xf32; | 68 using Machine::H_uitofp_4xi32_4xf32; |
| 65 using TargetLowering::H_uitofp_i32_f32; | 69 using Machine::H_uitofp_i32_f32; |
| 66 using TargetLowering::H_uitofp_i32_f64; | 70 using Machine::H_uitofp_i32_f64; |
| 67 using TargetLowering::H_uitofp_i64_f32; | 71 using Machine::H_uitofp_i64_f32; |
| 68 using TargetLowering::H_uitofp_i64_f64; | 72 using Machine::H_uitofp_i64_f64; |
| 69 using TargetLowering::H_urem_i64; | 73 using Machine::H_urem_i64; |
| 70 | 74 |
| 71 using TargetLowering::alignStackSpillAreas; | 75 using Machine::alignStackSpillAreas; |
| 72 using TargetLowering::assignVarStackSlots; | 76 using Machine::assignVarStackSlots; |
| 73 using TargetLowering::inferTwoAddress; | 77 using Machine::inferTwoAddress; |
| 74 using TargetLowering::makeHelperCall; | 78 using Machine::makeHelperCall; |
| 75 using TargetLowering::getVarStackSlotParams; | 79 using Machine::getVarStackSlotParams; |
| 76 | 80 |
| 77 public: | 81 public: |
| 78 using Traits = MachineTraits<Machine>; | 82 using Traits = MachineTraits<Machine>; |
| 79 using BoolFolding = ::Ice::X86Internal::BoolFolding<Traits>; | 83 using BoolFolding = ::Ice::X86Internal::BoolFolding<Traits>; |
| 80 | 84 |
| 81 using TargetLowering::RegSet_All; | 85 using Machine::RegSet_All; |
| 82 using TargetLowering::RegSet_CalleeSave; | 86 using Machine::RegSet_CalleeSave; |
| 83 using TargetLowering::RegSet_CallerSave; | 87 using Machine::RegSet_CallerSave; |
| 84 using TargetLowering::RegSet_FramePointer; | 88 using Machine::RegSet_FramePointer; |
| 85 using TargetLowering::RegSet_None; | 89 using Machine::RegSet_None; |
| 86 using TargetLowering::RegSet_StackPointer; | 90 using Machine::RegSet_StackPointer; |
| 87 using TargetLowering::Context; | 91 using Machine::Context; |
| 88 using TargetLowering::Ctx; | 92 using Machine::Ctx; |
| 89 using TargetLowering::Func; | 93 using Machine::Func; |
| 90 using TargetLowering::RegSetMask; | 94 using RegSetMask = typename Machine::RegSetMask; |
| 91 | 95 |
| 92 using TargetLowering::_bundle_lock; | 96 using Machine::_bundle_lock; |
| 93 using TargetLowering::_bundle_unlock; | 97 using Machine::_bundle_unlock; |
| 94 using TargetLowering::getContext; | 98 using Machine::getContext; |
| 95 using TargetLowering::getStackAdjustment; | 99 using Machine::getStackAdjustment; |
| 96 using TargetLowering::regAlloc; | 100 using Machine::regAlloc; |
| 97 using TargetLowering::resetStackAdjustment; | 101 using Machine::resetStackAdjustment; |
| 98 | 102 |
| 99 static TargetX86Base *create(Cfg *Func) { return new TargetX86Base(Func); } | 103 static TargetX86Base *create(Cfg *Func) { return new TargetX86Base(Func); } |
| 100 | 104 |
| 101 void translateOm1() override; | 105 void translateOm1() override; |
| 102 void translateO2() override; | 106 void translateO2() override; |
| 103 void doLoadOpt(); | 107 void doLoadOpt(); |
| 104 bool doBranchOpt(Inst *I, const CfgNode *NextNode) override; | 108 bool doBranchOpt(Inst *I, const CfgNode *NextNode) override; |
| 105 | 109 |
| 106 SizeT getNumRegisters() const override { return RegX8632::Reg_NUM; } | 110 SizeT getNumRegisters() const override { return RegX8632::Reg_NUM; } |
| 107 Variable *getPhysicalRegister(SizeT RegNum, Type Ty = IceType_void) override; | 111 Variable *getPhysicalRegister(SizeT RegNum, Type Ty = IceType_void) override; |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 private: | 605 private: |
| 602 ~TargetX86Base() override {} | 606 ~TargetX86Base() override {} |
| 603 BoolFolding FoldingInfo; | 607 BoolFolding FoldingInfo; |
| 604 }; | 608 }; |
| 605 } // end of namespace X86Internal | 609 } // end of namespace X86Internal |
| 606 } // end of namespace Ice | 610 } // end of namespace Ice |
| 607 | 611 |
| 608 #include "IceTargetLoweringX86BaseImpl.h" | 612 #include "IceTargetLoweringX86BaseImpl.h" |
| 609 | 613 |
| 610 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H | 614 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H |
| OLD | NEW |