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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 bool atEnd() const { return Cur == End; } | 57 bool atEnd() const { return Cur == End; } |
58 InstList::iterator getCur() const { return Cur; } | 58 InstList::iterator getCur() const { return Cur; } |
59 InstList::iterator getEnd() const { return End; } | 59 InstList::iterator getEnd() const { return End; } |
60 // Adaptor to enable range-based for loops. | 60 // Adaptor to enable range-based for loops. |
61 InstList::iterator begin() const { return getCur(); } | 61 InstList::iterator begin() const { return getCur(); } |
62 InstList::iterator end() const { return getEnd(); } | 62 InstList::iterator end() const { return getEnd(); } |
63 void insert(Inst *Inst); | 63 void insert(Inst *Inst); |
64 Inst *getLastInserted() const; | 64 Inst *getLastInserted() const; |
65 void advanceCur() { Cur = Next; } | 65 void advanceCur() { Cur = Next; } |
66 void advanceNext() { advanceForward(Next); } | 66 void advanceNext() { advanceForward(Next); } |
| 67 void rewind(); |
67 void setInsertPoint(const InstList::iterator &Position) { Next = Position; } | 68 void setInsertPoint(const InstList::iterator &Position) { Next = Position; } |
68 | 69 |
69 private: | 70 private: |
70 // Node is the argument to Inst::updateVars(). | 71 // Node is the argument to Inst::updateVars(). |
71 CfgNode *Node; | 72 CfgNode *Node; |
72 Inst *LastInserted; | 73 Inst *LastInserted; |
73 // Cur points to the current instruction being considered. It is | 74 // Cur points to the current instruction being considered. It is |
74 // guaranteed to point to a non-deleted instruction, or to be End. | 75 // guaranteed to point to a non-deleted instruction, or to be End. |
75 InstList::iterator Cur; | 76 InstList::iterator Cur; |
76 // Next doubles as a pointer to the next valid instruction (if any), | 77 // Next doubles as a pointer to the next valid instruction (if any), |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 Func->setError("Target doesn't specify O1 lowering steps."); | 128 Func->setError("Target doesn't specify O1 lowering steps."); |
128 } | 129 } |
129 virtual void translateO2() { | 130 virtual void translateO2() { |
130 Func->setError("Target doesn't specify O2 lowering steps."); | 131 Func->setError("Target doesn't specify O2 lowering steps."); |
131 } | 132 } |
132 | 133 |
133 // Tries to do address mode optimization on a single instruction. | 134 // Tries to do address mode optimization on a single instruction. |
134 void doAddressOpt(); | 135 void doAddressOpt(); |
135 // Randomly insert NOPs. | 136 // Randomly insert NOPs. |
136 void doNopInsertion(); | 137 void doNopInsertion(); |
137 // Lowers a single instruction. | 138 // Lowers a single non-Phi instruction. |
138 void lower(); | 139 void lower(); |
| 140 // Does preliminary lowering of the set of Phi instructions in the |
| 141 // current node. The main intention is to do what's needed to keep |
| 142 // the unlowered Phi instructions consistent with the lowered |
| 143 // non-Phi instructions, e.g. to lower 64-bit operands on a 32-bit |
| 144 // target. |
| 145 virtual void prelowerPhis() {} |
| 146 // Lowers a list of "parallel" assignment instructions representing |
| 147 // a topological sort of the Phi instructions. |
| 148 virtual void lowerPhiAssignments(CfgNode *Node, |
| 149 const AssignList &Assignments) = 0; |
139 // Tries to do branch optimization on a single instruction. Returns | 150 // Tries to do branch optimization on a single instruction. Returns |
140 // true if some optimization was done. | 151 // true if some optimization was done. |
141 virtual bool doBranchOpt(Inst * /*I*/, const CfgNode * /*NextNode*/) { | 152 virtual bool doBranchOpt(Inst * /*I*/, const CfgNode * /*NextNode*/) { |
142 return false; | 153 return false; |
143 } | 154 } |
144 | 155 |
145 // Returns a variable pre-colored to the specified physical | 156 // Returns a variable pre-colored to the specified physical |
146 // register. This is generally used to get very direct access to | 157 // register. This is generally used to get very direct access to |
147 // the register such as in the prolog or epilog or for marking | 158 // the register such as in the prolog or epilog or for marking |
148 // scratch registers as killed by a call. If a Type is not | 159 // scratch registers as killed by a call. If a Type is not |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 virtual void lower(const VariableDeclaration &Var) = 0; | 268 virtual void lower(const VariableDeclaration &Var) = 0; |
258 | 269 |
259 protected: | 270 protected: |
260 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 271 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
261 GlobalContext *Ctx; | 272 GlobalContext *Ctx; |
262 }; | 273 }; |
263 | 274 |
264 } // end of namespace Ice | 275 } // end of namespace Ice |
265 | 276 |
266 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 277 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |