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