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 /// This file declares the TargetLoweringX8664 class, which implements the | 11 /// This file 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 "IceCfg.h" | 20 #include "IceCfg.h" |
20 #include "IceGlobalContext.h" | 21 #include "IceGlobalContext.h" |
| 22 #include "IceInstX8664.h" |
21 #include "IceTargetLowering.h" | 23 #include "IceTargetLowering.h" |
| 24 #include "IceTargetLoweringX8664Traits.h" |
| 25 #include "IceTargetLoweringX86Base.h" |
22 | 26 |
23 namespace Ice { | 27 namespace Ice { |
24 | 28 |
25 class TargetX8664 : public TargetLowering { | 29 class TargetX8664 final |
| 30 : public ::Ice::X86Internal::TargetX86Base<TargetX8664> { |
26 TargetX8664() = delete; | 31 TargetX8664() = delete; |
27 TargetX8664(const TargetX8664 &) = delete; | 32 TargetX8664(const TargetX8664 &) = delete; |
28 TargetX8664 &operator=(const TargetX8664 &) = delete; | 33 TargetX8664 &operator=(const TargetX8664 &) = delete; |
29 | 34 |
30 void emitJumpTable(const Cfg *Func, | 35 void emitJumpTable(const Cfg *Func, |
31 const InstJumpTable *JumpTable) const override; | 36 const InstJumpTable *JumpTable) const override; |
32 | 37 |
33 public: | 38 public: |
34 static TargetX8664 *create(Cfg *Func); | 39 static TargetX8664 *create(Cfg *Func) { return new TargetX8664(Func); } |
35 | 40 |
36 private: | 41 private: |
37 explicit TargetX8664(Cfg *Func) : TargetLowering(Func) {} | 42 friend class ::Ice::X86Internal::TargetX86Base<TargetX8664>; |
| 43 |
| 44 explicit TargetX8664(Cfg *Func) |
| 45 : ::Ice::X86Internal::TargetX86Base<TargetX8664>(Func) {} |
| 46 |
| 47 Operand *createNaClReadTPSrcOperand() { |
| 48 Variable *TDB = makeReg(IceType_i32); |
| 49 InstCall *Call = makeHelperCall(H_call_read_tp, TDB, 0); |
| 50 lowerCall(Call); |
| 51 return TDB; |
| 52 } |
38 }; | 53 }; |
39 | 54 |
40 class TargetDataX8664 : public TargetDataLowering { | 55 class TargetDataX8664 : public TargetDataLowering { |
41 TargetDataX8664() = delete; | 56 TargetDataX8664() = delete; |
42 TargetDataX8664(const TargetDataX8664 &) = delete; | 57 TargetDataX8664(const TargetDataX8664 &) = delete; |
43 TargetDataX8664 &operator=(const TargetDataX8664 &) = delete; | 58 TargetDataX8664 &operator=(const TargetDataX8664 &) = delete; |
44 | 59 |
45 public: | 60 public: |
46 ~TargetDataX8664() override = default; | 61 ~TargetDataX8664() override = default; |
47 | 62 |
48 static std::unique_ptr<TargetDataLowering> create(GlobalContext *Ctx) { | 63 static std::unique_ptr<TargetDataLowering> create(GlobalContext *Ctx) { |
49 return makeUnique<TargetDataX8664>(Ctx); | 64 return makeUnique<TargetDataX8664>(Ctx); |
50 } | 65 } |
51 | 66 |
52 void lowerGlobals(const VariableDeclarationList &Vars, | 67 void lowerGlobals(const VariableDeclarationList &Vars, |
53 const IceString &SectionSuffix) override; | 68 const IceString &SectionSuffix) override; |
54 | 69 |
55 void lowerConstants() override; | 70 void lowerConstants() override; |
56 void lowerJumpTables() override; | 71 void lowerJumpTables() override; |
57 | 72 |
58 private: | 73 private: |
59 ENABLE_MAKE_UNIQUE; | 74 ENABLE_MAKE_UNIQUE; |
60 | 75 |
61 explicit TargetDataX8664(GlobalContext *Ctx) : TargetDataLowering(Ctx) {} | 76 explicit TargetDataX8664(GlobalContext *Ctx) : TargetDataLowering(Ctx) {} |
| 77 template <typename T> static void emitConstantPool(GlobalContext *Ctx); |
62 }; | 78 }; |
63 | 79 |
64 class TargetHeaderX8664 : public TargetHeaderLowering { | 80 class TargetHeaderX8664 : public TargetHeaderLowering { |
65 TargetHeaderX8664() = delete; | 81 TargetHeaderX8664() = delete; |
66 TargetHeaderX8664(const TargetHeaderX8664 &) = delete; | 82 TargetHeaderX8664(const TargetHeaderX8664 &) = delete; |
67 TargetHeaderX8664 &operator=(const TargetHeaderX8664 &) = delete; | 83 TargetHeaderX8664 &operator=(const TargetHeaderX8664 &) = delete; |
68 | 84 |
69 public: | 85 public: |
70 ~TargetHeaderX8664() = default; | 86 ~TargetHeaderX8664() = default; |
71 | 87 |
72 static std::unique_ptr<TargetHeaderLowering> create(GlobalContext *Ctx) { | 88 static std::unique_ptr<TargetHeaderLowering> create(GlobalContext *Ctx) { |
73 return makeUnique<TargetHeaderX8664>(Ctx); | 89 return makeUnique<TargetHeaderX8664>(Ctx); |
74 } | 90 } |
75 | 91 |
76 private: | 92 private: |
77 ENABLE_MAKE_UNIQUE; | 93 ENABLE_MAKE_UNIQUE; |
78 | 94 |
79 explicit TargetHeaderX8664(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {} | 95 explicit TargetHeaderX8664(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {} |
80 }; | 96 }; |
81 } // end of namespace Ice | 97 } // end of namespace Ice |
82 | 98 |
83 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664_H | 99 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664_H |
OLD | NEW |