OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX8664.h - lowering for x86-64 -*- C++ -*-=// | 1 //===- subzero/src/IceTargetLoweringX8664.h - lowering for x86-64 -*- 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 TargetLoweringX8664 class, which implements the | 11 /// \brief Declares the TargetLoweringX8664 class, which implements the |
12 /// TargetLowering interface for the X86 64-bit architecture. | 12 /// TargetLowering interface for the X86 64-bit architecture. |
13 /// | 13 /// |
14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
15 | 15 |
16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX8664_H | 16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX8664_H |
17 #define SUBZERO_SRC_ICETARGETLOWERINGX8664_H | 17 #define SUBZERO_SRC_ICETARGETLOWERINGX8664_H |
18 | 18 |
19 #include "IceAssemblerX8664.h" | 19 #include "IceAssemblerX8664.h" |
20 #include "IceCfg.h" | 20 #include "IceCfg.h" |
21 #include "IceGlobalContext.h" | 21 #include "IceGlobalContext.h" |
22 #include "IceInstX8664.h" | 22 #include "IceInstX8664.h" |
23 #include "IceTargetLowering.h" | 23 #include "IceTargetLowering.h" |
| 24 #define X86NAMESPACE X8664 |
| 25 #include "IceTargetLoweringX86Base.h" |
| 26 #undef X86NAMESPACE |
24 #include "IceTargetLoweringX8664Traits.h" | 27 #include "IceTargetLoweringX8664Traits.h" |
25 #include "IceTargetLoweringX86Base.h" | |
26 | 28 |
27 namespace Ice { | 29 namespace Ice { |
| 30 namespace X8664 { |
28 | 31 |
29 class TargetX8664 final | 32 class TargetX8664 final : public X8664::TargetX86Base<X8664::Traits> { |
30 : public ::Ice::X86Internal::TargetX86Base<TargetX8664> { | |
31 TargetX8664() = delete; | 33 TargetX8664() = delete; |
32 TargetX8664(const TargetX8664 &) = delete; | 34 TargetX8664(const TargetX8664 &) = delete; |
33 TargetX8664 &operator=(const TargetX8664 &) = delete; | 35 TargetX8664 &operator=(const TargetX8664 &) = 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 ~TargetX8664() = default; | 41 ~TargetX8664() = 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<TargetX8664>(Func); | 44 return makeUnique<TargetX8664>(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<X8664::AssemblerX8664>(); | 48 return makeUnique<X8664::AssemblerX8664>(); |
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<TargetX8664>; | 60 friend class X8664::TargetX86Base<X8664::Traits>; |
59 | 61 |
60 explicit TargetX8664(Cfg *Func) | 62 explicit TargetX8664(Cfg *Func) |
61 : ::Ice::X86Internal::TargetX86Base<TargetX8664>(Func) {} | 63 : ::Ice::X8664::TargetX86Base<X8664::Traits>(Func) {} |
62 | 64 |
63 Operand *createNaClReadTPSrcOperand() { | 65 Operand *createNaClReadTPSrcOperand() { |
64 Variable *TDB = makeReg(IceType_i32); | 66 Variable *TDB = makeReg(IceType_i32); |
65 InstCall *Call = makeHelperCall(H_call_read_tp, TDB, 0); | 67 InstCall *Call = makeHelperCall(H_call_read_tp, TDB, 0); |
66 lowerCall(Call); | 68 lowerCall(Call); |
67 return TDB; | 69 return TDB; |
68 } | 70 } |
69 }; | 71 }; |
70 | 72 |
71 class TargetDataX8664 : public TargetDataLowering { | 73 class TargetDataX8664 : public TargetDataLowering { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 static std::unique_ptr<TargetHeaderLowering> create(GlobalContext *Ctx) { | 106 static std::unique_ptr<TargetHeaderLowering> create(GlobalContext *Ctx) { |
105 return makeUnique<TargetHeaderX8664>(Ctx); | 107 return makeUnique<TargetHeaderX8664>(Ctx); |
106 } | 108 } |
107 | 109 |
108 private: | 110 private: |
109 ENABLE_MAKE_UNIQUE; | 111 ENABLE_MAKE_UNIQUE; |
110 | 112 |
111 explicit TargetHeaderX8664(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {} | 113 explicit TargetHeaderX8664(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {} |
112 }; | 114 }; |
113 | 115 |
| 116 } // end of namespace X8664 |
114 } // end of namespace Ice | 117 } // end of namespace Ice |
115 | 118 |
116 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664_H | 119 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664_H |
OLD | NEW |