OLD | NEW |
1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===// | 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===// |
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 implements the CfgNode class, including the complexities | 10 // This file implements the CfgNode class, including the complexities |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // instruction and delete the old. | 184 // instruction and delete the old. |
185 void CfgNode::doAddressOpt() { | 185 void CfgNode::doAddressOpt() { |
186 TargetLowering *Target = Func->getTarget(); | 186 TargetLowering *Target = Func->getTarget(); |
187 LoweringContext &Context = Target->getContext(); | 187 LoweringContext &Context = Target->getContext(); |
188 Context.init(this); | 188 Context.init(this); |
189 while (!Context.atEnd()) { | 189 while (!Context.atEnd()) { |
190 Target->doAddressOpt(); | 190 Target->doAddressOpt(); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
| 194 void CfgNode::doNopInsertion() { |
| 195 TargetLowering *Target = Func->getTarget(); |
| 196 LoweringContext &Context = Target->getContext(); |
| 197 Context.init(this); |
| 198 while (!Context.atEnd()) { |
| 199 Target->doNopInsertion(); |
| 200 // Ensure Cur=Next, so that the nops are inserted before the current |
| 201 // instruction rather than after. |
| 202 Context.advanceNext(); |
| 203 Context.advanceCur(); |
| 204 } |
| 205 // Insert before all instructions. |
| 206 Context.setInsertPoint(getInsts().begin()); |
| 207 Context.advanceNext(); |
| 208 Context.advanceCur(); |
| 209 Target->doNopInsertion(); |
| 210 } |
| 211 |
194 // Drives the target lowering. Passes the current instruction and the | 212 // Drives the target lowering. Passes the current instruction and the |
195 // next non-deleted instruction for target lowering. | 213 // next non-deleted instruction for target lowering. |
196 void CfgNode::genCode() { | 214 void CfgNode::genCode() { |
197 TargetLowering *Target = Func->getTarget(); | 215 TargetLowering *Target = Func->getTarget(); |
198 LoweringContext &Context = Target->getContext(); | 216 LoweringContext &Context = Target->getContext(); |
199 // Lower only the regular instructions. Defer the Phi instructions. | 217 // Lower only the regular instructions. Defer the Phi instructions. |
200 Context.init(this); | 218 Context.init(this); |
201 while (!Context.atEnd()) { | 219 while (!Context.atEnd()) { |
202 InstList::iterator Orig = Context.getCur(); | 220 InstList::iterator Orig = Context.getCur(); |
203 if (llvm::isa<InstRet>(*Orig)) | 221 if (llvm::isa<InstRet>(*Orig)) |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 I != E; ++I) { | 503 I != E; ++I) { |
486 if (I != OutEdges.begin()) | 504 if (I != OutEdges.begin()) |
487 Str << ", "; | 505 Str << ", "; |
488 Str << "%" << (*I)->getName(); | 506 Str << "%" << (*I)->getName(); |
489 } | 507 } |
490 Str << "\n"; | 508 Str << "\n"; |
491 } | 509 } |
492 } | 510 } |
493 | 511 |
494 } // end of namespace Ice | 512 } // end of namespace Ice |
OLD | NEW |