| OLD | NEW |
| 1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- 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 // This file declares the TargetLowering and LoweringContext | 10 // This file declares the TargetLowering and LoweringContext |
| 11 // classes. TargetLowering is an abstract class used to drive the | 11 // classes. TargetLowering is an abstract class used to drive the |
| 12 // translation/lowering process. LoweringContext maintains a | 12 // translation/lowering process. LoweringContext maintains a |
| 13 // context for lowering each instruction, offering conveniences such | 13 // context for lowering each instruction, offering conveniences such |
| 14 // as iterating over non-deleted instructions. | 14 // as iterating over non-deleted instructions. |
| 15 // | 15 // |
| 16 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
| 17 | 17 |
| 18 #ifndef SUBZERO_SRC_ICETARGETLOWERING_H | 18 #ifndef SUBZERO_SRC_ICETARGETLOWERING_H |
| 19 #define SUBZERO_SRC_ICETARGETLOWERING_H | 19 #define SUBZERO_SRC_ICETARGETLOWERING_H |
| 20 | 20 |
| 21 #include "IceDefs.h" | 21 #include "IceDefs.h" |
| 22 #include "IceInst.h" // for the names of the Inst subtypes | 22 #include "IceInst.h" // for the names of the Inst subtypes |
| 23 #include "IceTypes.h" | 23 #include "IceTypes.h" |
| 24 | 24 |
| 25 namespace Ice { | 25 namespace Ice { |
| 26 | 26 |
| 27 class Assembler; | |
| 28 | |
| 29 // LoweringContext makes it easy to iterate through non-deleted | 27 // LoweringContext makes it easy to iterate through non-deleted |
| 30 // instructions in a node, and insert new (lowered) instructions at | 28 // instructions in a node, and insert new (lowered) instructions at |
| 31 // the current point. Along with the instruction list container and | 29 // the current point. Along with the instruction list container and |
| 32 // associated iterators, it holds the current node, which is needed | 30 // associated iterators, it holds the current node, which is needed |
| 33 // when inserting new instructions in order to track whether variables | 31 // when inserting new instructions in order to track whether variables |
| 34 // are used as single-block or multi-block. | 32 // are used as single-block or multi-block. |
| 35 class LoweringContext { | 33 class LoweringContext { |
| 36 LoweringContext(const LoweringContext &) = delete; | 34 LoweringContext(const LoweringContext &) = delete; |
| 37 LoweringContext &operator=(const LoweringContext &) = delete; | 35 LoweringContext &operator=(const LoweringContext &) = delete; |
| 38 | 36 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void skipDeleted(InstList::iterator &I) const; | 85 void skipDeleted(InstList::iterator &I) const; |
| 88 void advanceForward(InstList::iterator &I) const; | 86 void advanceForward(InstList::iterator &I) const; |
| 89 }; | 87 }; |
| 90 | 88 |
| 91 class TargetLowering { | 89 class TargetLowering { |
| 92 TargetLowering(const TargetLowering &) = delete; | 90 TargetLowering(const TargetLowering &) = delete; |
| 93 TargetLowering &operator=(const TargetLowering &) = delete; | 91 TargetLowering &operator=(const TargetLowering &) = delete; |
| 94 | 92 |
| 95 public: | 93 public: |
| 96 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); | 94 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); |
| 97 static Assembler *createAssembler(TargetArch Target, Cfg *Func); | 95 static std::unique_ptr<Assembler> createAssembler(TargetArch Target, |
| 96 Cfg *Func); |
| 98 void translate() { | 97 void translate() { |
| 99 switch (Ctx->getOptLevel()) { | 98 switch (Ctx->getOptLevel()) { |
| 100 case Opt_m1: | 99 case Opt_m1: |
| 101 translateOm1(); | 100 translateOm1(); |
| 102 break; | 101 break; |
| 103 case Opt_0: | 102 case Opt_0: |
| 104 translateO0(); | 103 translateO0(); |
| 105 break; | 104 break; |
| 106 case Opt_1: | 105 case Opt_1: |
| 107 translateO1(); | 106 translateO1(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 virtual void lower(const VariableDeclaration &Var) = 0; | 261 virtual void lower(const VariableDeclaration &Var) = 0; |
| 263 | 262 |
| 264 protected: | 263 protected: |
| 265 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 264 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
| 266 GlobalContext *Ctx; | 265 GlobalContext *Ctx; |
| 267 }; | 266 }; |
| 268 | 267 |
| 269 } // end of namespace Ice | 268 } // end of namespace Ice |
| 270 | 269 |
| 271 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 270 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
| OLD | NEW |