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 16 matching lines...) Expand all Loading... | |
27 // Returns the name the node was created with. If no name was given, | 27 // Returns the name the node was created with. If no name was given, |
28 // it synthesizes a (hopefully) unique name. | 28 // it synthesizes a (hopefully) unique name. |
29 IceString CfgNode::getName() const { | 29 IceString CfgNode::getName() const { |
30 if (!Name.empty()) | 30 if (!Name.empty()) |
31 return Name; | 31 return Name; |
32 char buf[30]; | 32 char buf[30]; |
33 snprintf(buf, llvm::array_lengthof(buf), "__%u", getIndex()); | 33 snprintf(buf, llvm::array_lengthof(buf), "__%u", getIndex()); |
34 return buf; | 34 return buf; |
35 } | 35 } |
36 | 36 |
37 void CfgNode::setName(IceString &NewName) { | |
38 assert(Name.empty()); | |
Jim Stichnoth
2014/09/10 18:44:23
Document that the assert is to be sure true renami
Karl
2014/09/10 21:14:33
Done.
| |
39 Name = NewName; | |
40 } | |
41 | |
37 // Adds an instruction to either the Phi list or the regular | 42 // Adds an instruction to either the Phi list or the regular |
38 // instruction list. Validates that all Phis are added before all | 43 // instruction list. Validates that all Phis are added before all |
39 // regular instructions. | 44 // regular instructions. |
40 void CfgNode::appendInst(Inst *Inst) { | 45 void CfgNode::appendInst(Inst *Inst) { |
41 if (InstPhi *Phi = llvm::dyn_cast<InstPhi>(Inst)) { | 46 if (InstPhi *Phi = llvm::dyn_cast<InstPhi>(Inst)) { |
42 if (!Insts.empty()) { | 47 if (!Insts.empty()) { |
43 Func->setError("Phi instruction added to the middle of a block"); | 48 Func->setError("Phi instruction added to the middle of a block"); |
44 return; | 49 return; |
45 } | 50 } |
46 Phis.push_back(Phi); | 51 Phis.push_back(Phi); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 I != E; ++I) { | 508 I != E; ++I) { |
504 if (I != OutEdges.begin()) | 509 if (I != OutEdges.begin()) |
505 Str << ", "; | 510 Str << ", "; |
506 Str << "%" << (*I)->getName(); | 511 Str << "%" << (*I)->getName(); |
507 } | 512 } |
508 Str << "\n"; | 513 Str << "\n"; |
509 } | 514 } |
510 } | 515 } |
511 | 516 |
512 } // end of namespace Ice | 517 } // end of namespace Ice |
OLD | NEW |