OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 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 /// \file | 10 /// \file |
11 /// \brief Declares the TargetLoweringX8632 class, which implements the | 11 /// \brief Declares the TargetLoweringX8632 class, which implements the |
12 /// TargetLowering interface for the x86-32 architecture. | 12 /// TargetLowering interface for the x86-32 architecture. |
13 /// | 13 /// |
14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
15 | 15 |
16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
17 #define SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 17 #define SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
18 | 18 |
19 #include "IceAssemblerX8632.h" | 19 #include "IceAssemblerX8632.h" |
20 #include "IceDefs.h" | 20 #include "IceDefs.h" |
21 #include "IceInstX8632.h" | |
22 #include "IceRegistersX8632.h" | 21 #include "IceRegistersX8632.h" |
23 #include "IceTargetLowering.h" | 22 #include "IceTargetLowering.h" |
| 23 #include "IceInstX8632.h" |
| 24 #define X86NAMESPACE X8632 |
| 25 #include "IceTargetLoweringX86Base.h" |
| 26 #undef X86NAMESPACE |
24 #include "IceTargetLoweringX8632Traits.h" | 27 #include "IceTargetLoweringX8632Traits.h" |
25 #include "IceTargetLoweringX86Base.h" | |
26 | 28 |
27 namespace Ice { | 29 namespace Ice { |
| 30 namespace X8632 { |
28 | 31 |
29 class TargetX8632 final | 32 class TargetX8632 final : public ::Ice::X8632::TargetX86Base<X8632::Traits> { |
30 : public ::Ice::X86Internal::TargetX86Base<TargetX8632> { | |
31 TargetX8632() = delete; | 33 TargetX8632() = delete; |
32 TargetX8632(const TargetX8632 &) = delete; | 34 TargetX8632(const TargetX8632 &) = delete; |
33 TargetX8632 &operator=(const TargetX8632 &) = delete; | 35 TargetX8632 &operator=(const TargetX8632 &) = delete; |
34 | 36 |
35 void emitJumpTable(const Cfg *Func, | 37 void emitJumpTable(const Cfg *Func, |
36 const InstJumpTable *JumpTable) const override; | 38 const InstJumpTable *JumpTable) const override; |
37 | 39 |
38 public: | 40 public: |
39 ~TargetX8632() = default; | 41 ~TargetX8632() = default; |
40 | 42 |
41 static std::unique_ptr<::Ice::TargetLowering> create(Cfg *Func) { | 43 static std::unique_ptr<::Ice::TargetLowering> create(Cfg *Func) { |
42 return makeUnique<TargetX8632>(Func); | 44 return makeUnique<TargetX8632>(Func); |
43 } | 45 } |
44 | 46 |
45 std::unique_ptr<::Ice::Assembler> createAssembler() const override { | 47 std::unique_ptr<::Ice::Assembler> createAssembler() const override { |
46 return makeUnique<X8632::AssemblerX8632>(); | 48 return makeUnique<X8632::AssemblerX8632>(); |
47 } | 49 } |
48 | 50 |
49 protected: | 51 protected: |
50 void lowerCall(const InstCall *Instr) override; | 52 void lowerCall(const InstCall *Instr) override; |
51 void lowerArguments() override; | 53 void lowerArguments() override; |
52 void lowerRet(const InstRet *Inst) override; | 54 void lowerRet(const InstRet *Inst) override; |
53 void addProlog(CfgNode *Node) override; | 55 void addProlog(CfgNode *Node) override; |
54 void addEpilog(CfgNode *Node) override; | 56 void addEpilog(CfgNode *Node) override; |
55 | 57 |
56 private: | 58 private: |
57 ENABLE_MAKE_UNIQUE; | 59 ENABLE_MAKE_UNIQUE; |
58 friend class ::Ice::X86Internal::TargetX86Base<TargetX8632>; | 60 friend class X8632::TargetX86Base<X8632::Traits>; |
59 | 61 |
60 Operand *createNaClReadTPSrcOperand() { | 62 Operand *createNaClReadTPSrcOperand() { |
61 Constant *Zero = Ctx->getConstantZero(IceType_i32); | 63 Constant *Zero = Ctx->getConstantZero(IceType_i32); |
62 return Traits::X86OperandMem::create(Func, IceType_i32, nullptr, Zero, | 64 return Traits::X86OperandMem::create(Func, IceType_i32, nullptr, Zero, |
63 nullptr, 0, | 65 nullptr, 0, |
64 Traits::X86OperandMem::SegReg_GS); | 66 Traits::X86OperandMem::SegReg_GS); |
65 } | 67 } |
66 | 68 |
67 explicit TargetX8632(Cfg *Func) : TargetX86Base(Func) {} | 69 explicit TargetX8632(Cfg *Func) : TargetX86Base(Func) {} |
68 }; | 70 }; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return std::unique_ptr<TargetHeaderLowering>(new TargetHeaderX8632(Ctx)); | 103 return std::unique_ptr<TargetHeaderLowering>(new TargetHeaderX8632(Ctx)); |
102 } | 104 } |
103 | 105 |
104 protected: | 106 protected: |
105 explicit TargetHeaderX8632(GlobalContext *Ctx); | 107 explicit TargetHeaderX8632(GlobalContext *Ctx); |
106 | 108 |
107 private: | 109 private: |
108 ~TargetHeaderX8632() = default; | 110 ~TargetHeaderX8632() = default; |
109 }; | 111 }; |
110 | 112 |
| 113 } // end of namespace X8632 |
111 } // end of namespace Ice | 114 } // end of namespace Ice |
112 | 115 |
113 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 116 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |