Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 1 | //===- subzero/src/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// |
| 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 TargetLoweringX8632 class, which |
| 12 | /// implements the TargetLowering interface for the x86-32 |
| 13 | /// architecture. |
| 14 | /// |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 15 | //===----------------------------------------------------------------------===// |
| 16 | |
| 17 | #ifndef SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
| 18 | #define SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
| 19 | |
John Porto | aff4ccf | 2015-06-10 16:35:06 -0700 | [diff] [blame] | 20 | #include "IceAssemblerX8632.h" |
Jim Stichnoth | a18cc9c | 2014-09-30 19:10:22 -0700 | [diff] [blame] | 21 | #include "IceDefs.h" |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 22 | #include "IceInstX8632.h" |
Jan Voung | bd385e4 | 2014-09-18 18:18:10 -0700 | [diff] [blame] | 23 | #include "IceRegistersX8632.h" |
Jim Stichnoth | a18cc9c | 2014-09-30 19:10:22 -0700 | [diff] [blame] | 24 | #include "IceTargetLowering.h" |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 25 | #include "IceTargetLoweringX8632Traits.h" |
John Porto | 5aeed95 | 2015-07-21 13:39:09 -0700 | [diff] [blame] | 26 | #include "IceTargetLoweringX86Base.h" |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 27 | |
| 28 | namespace Ice { |
| 29 | |
John Porto | 5aeed95 | 2015-07-21 13:39:09 -0700 | [diff] [blame] | 30 | class TargetX8632 final |
| 31 | : public ::Ice::X86Internal::TargetX86Base<TargetX8632> { |
Jim Stichnoth | c6ead20 | 2015-02-24 09:30:30 -0800 | [diff] [blame] | 32 | TargetX8632() = delete; |
Jim Stichnoth | 7b451a9 | 2014-10-15 14:39:23 -0700 | [diff] [blame] | 33 | TargetX8632(const TargetX8632 &) = delete; |
| 34 | TargetX8632 &operator=(const TargetX8632 &) = delete; |
| 35 | |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 36 | public: |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 37 | using X86InstructionSet = X8632::Traits::InstructionSet; |
Matt Wala | 0a45051 | 2014-07-30 12:44:39 -0700 | [diff] [blame] | 38 | |
John Porto | 5aeed95 | 2015-07-21 13:39:09 -0700 | [diff] [blame] | 39 | static TargetX8632 *create(Cfg *Func) { return new TargetX8632(Func); } |
Matt Wala | 0a45051 | 2014-07-30 12:44:39 -0700 | [diff] [blame] | 40 | |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 41 | protected: |
John Porto | 5aeed95 | 2015-07-21 13:39:09 -0700 | [diff] [blame] | 42 | Operand *createNaClReadTPSrcOperand() { |
| 43 | Constant *Zero = Ctx->getConstantZero(IceType_i32); |
| 44 | return Traits::X86OperandMem::create(Func, IceType_i32, nullptr, Zero, |
| 45 | nullptr, 0, |
| 46 | Traits::X86OperandMem::SegReg_GS); |
| 47 | } |
| 48 | |
| 49 | private: |
| 50 | friend class ::Ice::X86Internal::TargetX86Base<TargetX8632>; |
| 51 | |
| 52 | explicit TargetX8632(Cfg *Func) : TargetX86Base(Func) {} |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 53 | }; |
| 54 | |
John Porto | 0f86d03 | 2015-06-15 07:44:27 -0700 | [diff] [blame] | 55 | class TargetDataX8632 final : public TargetDataLowering { |
Jan Voung | 72984d8 | 2015-01-29 14:42:38 -0800 | [diff] [blame] | 56 | TargetDataX8632() = delete; |
| 57 | TargetDataX8632(const TargetDataX8632 &) = delete; |
| 58 | TargetDataX8632 &operator=(const TargetDataX8632 &) = delete; |
Jim Stichnoth | 7b451a9 | 2014-10-15 14:39:23 -0700 | [diff] [blame] | 59 | |
Jim Stichnoth | de4ca71 | 2014-06-29 08:13:48 -0700 | [diff] [blame] | 60 | public: |
Jan Voung | fb79284 | 2015-06-11 15:27:50 -0700 | [diff] [blame] | 61 | static std::unique_ptr<TargetDataLowering> create(GlobalContext *Ctx) { |
| 62 | return std::unique_ptr<TargetDataLowering>(new TargetDataX8632(Ctx)); |
Jim Stichnoth | de4ca71 | 2014-06-29 08:13:48 -0700 | [diff] [blame] | 63 | } |
Karl Schimpf | e3f64d0 | 2014-10-07 10:38:22 -0700 | [diff] [blame] | 64 | |
John Porto | 8b1a705 | 2015-06-17 13:20:08 -0700 | [diff] [blame] | 65 | void lowerGlobals(const VariableDeclarationList &Vars, |
| 66 | const IceString &SectionSuffix) override; |
John Porto | 0f86d03 | 2015-06-15 07:44:27 -0700 | [diff] [blame] | 67 | void lowerConstants() override; |
Jim Stichnoth | de4ca71 | 2014-06-29 08:13:48 -0700 | [diff] [blame] | 68 | |
| 69 | protected: |
Jim Stichnoth | c6ead20 | 2015-02-24 09:30:30 -0800 | [diff] [blame] | 70 | explicit TargetDataX8632(GlobalContext *Ctx); |
Jim Stichnoth | de4ca71 | 2014-06-29 08:13:48 -0700 | [diff] [blame] | 71 | |
| 72 | private: |
John Porto | 7e93c62 | 2015-06-23 10:58:57 -0700 | [diff] [blame] | 73 | ~TargetDataX8632() override = default; |
Jim Stichnoth | fa4efea | 2015-01-27 05:06:03 -0800 | [diff] [blame] | 74 | template <typename T> static void emitConstantPool(GlobalContext *Ctx); |
Jim Stichnoth | de4ca71 | 2014-06-29 08:13:48 -0700 | [diff] [blame] | 75 | }; |
| 76 | |
Jan Voung | fb79284 | 2015-06-11 15:27:50 -0700 | [diff] [blame] | 77 | class TargetHeaderX8632 final : public TargetHeaderLowering { |
| 78 | TargetHeaderX8632() = delete; |
| 79 | TargetHeaderX8632(const TargetHeaderX8632 &) = delete; |
| 80 | TargetHeaderX8632 &operator=(const TargetHeaderX8632 &) = delete; |
| 81 | |
| 82 | public: |
| 83 | static std::unique_ptr<TargetHeaderLowering> create(GlobalContext *Ctx) { |
| 84 | return std::unique_ptr<TargetHeaderLowering>(new TargetHeaderX8632(Ctx)); |
| 85 | } |
| 86 | |
| 87 | protected: |
| 88 | explicit TargetHeaderX8632(GlobalContext *Ctx); |
| 89 | |
| 90 | private: |
| 91 | ~TargetHeaderX8632() = default; |
| 92 | }; |
| 93 | |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 94 | } // end of namespace Ice |
| 95 | |
| 96 | #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |