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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 CfgNode *Target = *I1; | 193 CfgNode *Target = *I1; |
194 // Consider every Phi instruction at the out-edge. | 194 // Consider every Phi instruction at the out-edge. |
195 for (PhiList::const_iterator I2 = Target->Phis.begin(), | 195 for (PhiList::const_iterator I2 = Target->Phis.begin(), |
196 E2 = Target->Phis.end(); | 196 E2 = Target->Phis.end(); |
197 I2 != E2; ++I2) { | 197 I2 != E2; ++I2) { |
198 Operand *Operand = (*I2)->getOperandForTarget(this); | 198 Operand *Operand = (*I2)->getOperandForTarget(this); |
199 assert(Operand); | 199 assert(Operand); |
200 Variable *Dest = (*I2)->getDest(); | 200 Variable *Dest = (*I2)->getDest(); |
201 assert(Dest); | 201 assert(Dest); |
202 InstAssign *NewInst = InstAssign::create(Func, Dest, Operand); | 202 InstAssign *NewInst = InstAssign::create(Func, Dest, Operand); |
203 // If Src is a variable, set the Src and Dest variables to | |
204 // prefer each other for register allocation. | |
205 if (Variable *Src = llvm::dyn_cast<Variable>(Operand)) { | |
206 bool AllowOverlap = false; | |
207 Dest->setPreferredRegister(Src, AllowOverlap); | |
208 Src->setPreferredRegister(Dest, AllowOverlap); | |
209 } | |
210 if (CmpInstDest == Operand) | 203 if (CmpInstDest == Operand) |
211 Insts.insert(SafeInsertionPoint, NewInst); | 204 Insts.insert(SafeInsertionPoint, NewInst); |
212 else | 205 else |
213 Insts.insert(InsertionPoint, NewInst); | 206 Insts.insert(InsertionPoint, NewInst); |
214 } | 207 } |
215 } | 208 } |
216 } | 209 } |
217 | 210 |
218 // Deletes the phi instructions after the loads and stores are placed. | 211 // Deletes the phi instructions after the loads and stores are placed. |
219 void CfgNode::deletePhis() { | 212 void CfgNode::deletePhis() { |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 I != E; ++I) { | 572 I != E; ++I) { |
580 if (I != OutEdges.begin()) | 573 if (I != OutEdges.begin()) |
581 Str << ", "; | 574 Str << ", "; |
582 Str << "%" << (*I)->getName(); | 575 Str << "%" << (*I)->getName(); |
583 } | 576 } |
584 Str << "\n"; | 577 Str << "\n"; |
585 } | 578 } |
586 } | 579 } |
587 | 580 |
588 } // end of namespace Ice | 581 } // end of namespace Ice |
OLD | NEW |