| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // | 297 // |
| 298 // Once the ordering is determined, the Cfg edge is split and the | 298 // Once the ordering is determined, the Cfg edge is split and the |
| 299 // assignment list is lowered by the target lowering layer. The | 299 // assignment list is lowered by the target lowering layer. The |
| 300 // specific placement of the new node within the Cfg node list is | 300 // specific placement of the new node within the Cfg node list is |
| 301 // deferred until later, including after empty node contraction. | 301 // deferred until later, including after empty node contraction. |
| 302 void CfgNode::advancedPhiLowering() { | 302 void CfgNode::advancedPhiLowering() { |
| 303 if (getPhis().empty()) | 303 if (getPhis().empty()) |
| 304 return; | 304 return; |
| 305 | 305 |
| 306 // Count the number of non-deleted Phi instructions. | 306 // Count the number of non-deleted Phi instructions. |
| 307 struct { | 307 struct PhiDesc { |
| 308 InstPhi *Phi; | 308 InstPhi *Phi; |
| 309 Variable *Dest; | 309 Variable *Dest; |
| 310 Operand *Src; | 310 Operand *Src; |
| 311 bool Processed; | 311 bool Processed; |
| 312 size_t NumPred; // number of entries whose Src is this Dest | 312 size_t NumPred; // number of entries whose Src is this Dest |
| 313 int32_t Weight; // preference for topological order | 313 int32_t Weight; // preference for topological order |
| 314 } Desc[getPhis().size()]; | 314 }; |
| 315 llvm::SmallVector<PhiDesc, 32> Desc(getPhis().size()); |
| 315 | 316 |
| 316 size_t NumPhis = 0; | 317 size_t NumPhis = 0; |
| 317 for (Inst &I : Phis) { | 318 for (Inst &I : Phis) { |
| 318 auto Inst = llvm::dyn_cast<InstPhi>(&I); | 319 auto Inst = llvm::dyn_cast<InstPhi>(&I); |
| 319 if (!Inst->isDeleted()) { | 320 if (!Inst->isDeleted()) { |
| 320 Desc[NumPhis].Phi = Inst; | 321 Desc[NumPhis].Phi = Inst; |
| 321 Desc[NumPhis].Dest = Inst->getDest(); | 322 Desc[NumPhis].Dest = Inst->getDest(); |
| 322 ++NumPhis; | 323 ++NumPhis; |
| 323 } | 324 } |
| 324 } | 325 } |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 if (!First) | 983 if (!First) |
| 983 Str << ", "; | 984 Str << ", "; |
| 984 First = false; | 985 First = false; |
| 985 Str << "%" << I->getName(); | 986 Str << "%" << I->getName(); |
| 986 } | 987 } |
| 987 Str << "\n"; | 988 Str << "\n"; |
| 988 } | 989 } |
| 989 } | 990 } |
| 990 | 991 |
| 991 } // end of namespace Ice | 992 } // end of namespace Ice |
| OLD | NEW |