| 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 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 class LoweringContext { | 34 class LoweringContext { |
| 35 public: | 35 public: |
| 36 LoweringContext() : Node(NULL) {} | 36 LoweringContext() : Node(NULL) {} |
| 37 ~LoweringContext() {} | 37 ~LoweringContext() {} |
| 38 void init(CfgNode *Node); | 38 void init(CfgNode *Node); |
| 39 Inst *getNextInst() const { | 39 Inst *getNextInst() const { |
| 40 if (Next == End) | 40 if (Next == End) |
| 41 return NULL; | 41 return NULL; |
| 42 return *Next; | 42 return *Next; |
| 43 } | 43 } |
| 44 Inst *getNextInst(InstList::iterator &Iter) const { |
| 45 advance(Iter); |
| 46 if (Iter == End) |
| 47 return NULL; |
| 48 return *Iter; |
| 49 } |
| 44 CfgNode *getNode() const { return Node; } | 50 CfgNode *getNode() const { return Node; } |
| 45 bool atEnd() const { return Cur == End; } | 51 bool atEnd() const { return Cur == End; } |
| 46 InstList::iterator getCur() const { return Cur; } | 52 InstList::iterator getCur() const { return Cur; } |
| 47 InstList::iterator getEnd() const { return End; } | 53 InstList::iterator getEnd() const { return End; } |
| 48 void insert(Inst *Inst); | 54 void insert(Inst *Inst); |
| 49 void advanceCur() { Cur = Next; } | 55 void advanceCur() { Cur = Next; } |
| 50 void advanceNext() { advance(Next); } | 56 void advanceNext() { advance(Next); } |
| 51 void setInsertPoint(const InstList::iterator &Position) { Next = Position; } | 57 void setInsertPoint(const InstList::iterator &Position) { Next = Position; } |
| 52 | 58 |
| 53 private: | 59 private: |
| 54 // Node is the argument to Inst::updateVars(). | 60 // Node is the argument to Inst::updateVars(). |
| 55 CfgNode *Node; | 61 CfgNode *Node; |
| 56 // Cur points to the current instruction being considered. It is | 62 // Cur points to the current instruction being considered. It is |
| 57 // guaranteed to point to a non-deleted instruction, or to be End. | 63 // guaranteed to point to a non-deleted instruction, or to be End. |
| 58 InstList::iterator Cur; | 64 InstList::iterator Cur; |
| 59 // Next doubles as a pointer to the next valid instruction (if any), | 65 // Next doubles as a pointer to the next valid instruction (if any), |
| 60 // and the new-instruction insertion point. It is also updated for | 66 // and the new-instruction insertion point. It is also updated for |
| 61 // the caller in case the lowering consumes more than one high-level | 67 // the caller in case the lowering consumes more than one high-level |
| 62 // instruction. It is guaranteed to point to a non-deleted | 68 // instruction. It is guaranteed to point to a non-deleted |
| 63 // instruction after Cur, or to be End. TODO: Consider separating | 69 // instruction after Cur, or to be End. TODO: Consider separating |
| 64 // the notion of "next valid instruction" and "new instruction | 70 // the notion of "next valid instruction" and "new instruction |
| 65 // insertion point", to avoid confusion when previously-deleted | 71 // insertion point", to avoid confusion when previously-deleted |
| 66 // instructions come between the two points. | 72 // instructions come between the two points. |
| 67 InstList::iterator Next; | 73 InstList::iterator Next; |
| 68 // End is a copy of Insts.end(), used if Next needs to be advanced. | 74 // End is a copy of Insts.end(), used if Next needs to be advanced. |
| 69 InstList::iterator End; | 75 InstList::iterator End; |
| 70 | 76 |
| 71 void skipDeleted(InstList::iterator &I); | 77 void skipDeleted(InstList::iterator &I) const; |
| 72 void advance(InstList::iterator &I); | 78 void advance(InstList::iterator &I) const; |
| 73 LoweringContext(const LoweringContext &) LLVM_DELETED_FUNCTION; | 79 LoweringContext(const LoweringContext &) LLVM_DELETED_FUNCTION; |
| 74 LoweringContext &operator=(const LoweringContext &) LLVM_DELETED_FUNCTION; | 80 LoweringContext &operator=(const LoweringContext &) LLVM_DELETED_FUNCTION; |
| 75 }; | 81 }; |
| 76 | 82 |
| 77 class TargetLowering { | 83 class TargetLowering { |
| 78 public: | 84 public: |
| 79 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); | 85 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); |
| 80 void translate() { | 86 void translate() { |
| 81 switch (Ctx->getOptLevel()) { | 87 switch (Ctx->getOptLevel()) { |
| 82 case Opt_m1: | 88 case Opt_m1: |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 private: | 231 private: |
| 226 TargetGlobalInitLowering(const TargetGlobalInitLowering &) | 232 TargetGlobalInitLowering(const TargetGlobalInitLowering &) |
| 227 LLVM_DELETED_FUNCTION; | 233 LLVM_DELETED_FUNCTION; |
| 228 TargetGlobalInitLowering & | 234 TargetGlobalInitLowering & |
| 229 operator=(const TargetGlobalInitLowering &) LLVM_DELETED_FUNCTION; | 235 operator=(const TargetGlobalInitLowering &) LLVM_DELETED_FUNCTION; |
| 230 }; | 236 }; |
| 231 | 237 |
| 232 } // end of namespace Ice | 238 } // end of namespace Ice |
| 233 | 239 |
| 234 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 240 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
| OLD | NEW |