John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 1 | //===- subzero/src/IceTargetLoweringX8664.h - lowering for x86-64 -*- C++ -*-=// |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 2 | // |
| 3 | // The Subzero Code Generator |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Andrew Scull | 9612d32 | 2015-07-06 14:53:25 -0700 | [diff] [blame] | 9 | /// |
| 10 | /// \file |
| 11 | /// This file declares the TargetLoweringX8664 class, which implements the |
| 12 | /// TargetLowering interface for the X86 64-bit architecture. |
| 13 | /// |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 14 | //===----------------------------------------------------------------------===// |
John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 15 | |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 16 | #ifndef SUBZERO_SRC_ICETARGETLOWERINGX8664_H |
| 17 | #define SUBZERO_SRC_ICETARGETLOWERINGX8664_H |
| 18 | |
John Porto | 453660f | 2015-07-31 14:52:52 -0700 | [diff] [blame] | 19 | #include "IceAssemblerX8664.h" |
John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 20 | #include "IceCfg.h" |
| 21 | #include "IceGlobalContext.h" |
John Porto | 453660f | 2015-07-31 14:52:52 -0700 | [diff] [blame] | 22 | #include "IceInstX8664.h" |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 23 | #include "IceTargetLowering.h" |
John Porto | 453660f | 2015-07-31 14:52:52 -0700 | [diff] [blame] | 24 | #include "IceTargetLoweringX8664Traits.h" |
| 25 | #include "IceTargetLoweringX86Base.h" |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 26 | |
| 27 | namespace Ice { |
| 28 | |
John Porto | 453660f | 2015-07-31 14:52:52 -0700 | [diff] [blame] | 29 | class TargetX8664 final |
| 30 | : public ::Ice::X86Internal::TargetX86Base<TargetX8664> { |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 31 | TargetX8664() = delete; |
| 32 | TargetX8664(const TargetX8664 &) = delete; |
| 33 | TargetX8664 &operator=(const TargetX8664 &) = delete; |
| 34 | |
Andrew Scull | 86df4e9 | 2015-07-30 13:54:44 -0700 | [diff] [blame] | 35 | void emitJumpTable(const Cfg *Func, |
| 36 | const InstJumpTable *JumpTable) const override; |
| 37 | |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 38 | public: |
John Porto | 453660f | 2015-07-31 14:52:52 -0700 | [diff] [blame] | 39 | static TargetX8664 *create(Cfg *Func) { return new TargetX8664(Func); } |
John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 40 | |
| 41 | private: |
John Porto | 453660f | 2015-07-31 14:52:52 -0700 | [diff] [blame] | 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 | } |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | class TargetDataX8664 : public TargetDataLowering { |
| 56 | TargetDataX8664() = delete; |
| 57 | TargetDataX8664(const TargetDataX8664 &) = delete; |
| 58 | TargetDataX8664 &operator=(const TargetDataX8664 &) = delete; |
| 59 | |
| 60 | public: |
John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 61 | ~TargetDataX8664() override = default; |
| 62 | |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 63 | static std::unique_ptr<TargetDataLowering> create(GlobalContext *Ctx) { |
John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 64 | return makeUnique<TargetDataX8664>(Ctx); |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 65 | } |
John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 66 | |
| 67 | void lowerGlobals(const VariableDeclarationList &Vars, |
| 68 | const IceString &SectionSuffix) override; |
| 69 | |
| 70 | void lowerConstants() override; |
Andrew Scull | 86df4e9 | 2015-07-30 13:54:44 -0700 | [diff] [blame] | 71 | void lowerJumpTables() override; |
John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 72 | |
| 73 | private: |
| 74 | ENABLE_MAKE_UNIQUE; |
| 75 | |
| 76 | explicit TargetDataX8664(GlobalContext *Ctx) : TargetDataLowering(Ctx) {} |
John Porto | 453660f | 2015-07-31 14:52:52 -0700 | [diff] [blame] | 77 | template <typename T> static void emitConstantPool(GlobalContext *Ctx); |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | class TargetHeaderX8664 : public TargetHeaderLowering { |
| 81 | TargetHeaderX8664() = delete; |
| 82 | TargetHeaderX8664(const TargetHeaderX8664 &) = delete; |
| 83 | TargetHeaderX8664 &operator=(const TargetHeaderX8664 &) = delete; |
| 84 | |
| 85 | public: |
John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 86 | ~TargetHeaderX8664() = default; |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 87 | |
John Porto | d58f01c | 2015-06-23 15:55:17 -0700 | [diff] [blame] | 88 | static std::unique_ptr<TargetHeaderLowering> create(GlobalContext *Ctx) { |
| 89 | return makeUnique<TargetHeaderX8664>(Ctx); |
| 90 | } |
| 91 | |
| 92 | private: |
| 93 | ENABLE_MAKE_UNIQUE; |
| 94 | |
| 95 | explicit TargetHeaderX8664(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {} |
| 96 | }; |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 97 | } // end of namespace Ice |
| 98 | |
Jim Stichnoth | 20b71f5 | 2015-06-24 15:52:24 -0700 | [diff] [blame] | 99 | #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664_H |