| 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 /// \file | 10 /// \file |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 } | 297 } |
| 298 | 298 |
| 299 namespace { | 299 namespace { |
| 300 | 300 |
| 301 // Helpers for advancedPhiLowering(). | 301 // Helpers for advancedPhiLowering(). |
| 302 | 302 |
| 303 class PhiDesc { | 303 class PhiDesc { |
| 304 PhiDesc() = delete; | 304 PhiDesc() = delete; |
| 305 PhiDesc(const PhiDesc &) = delete; | 305 PhiDesc(const PhiDesc &) = delete; |
| 306 PhiDesc &operator=(const PhiDesc &) = delete; | 306 PhiDesc &operator=(const PhiDesc &) = delete; |
| 307 |
| 307 public: | 308 public: |
| 308 PhiDesc(InstPhi *Phi, Variable *Dest) : Phi(Phi), Dest(Dest) {} | 309 PhiDesc(InstPhi *Phi, Variable *Dest) : Phi(Phi), Dest(Dest) {} |
| 309 PhiDesc(PhiDesc &&) = default; | 310 PhiDesc(PhiDesc &&) = default; |
| 310 InstPhi *Phi = nullptr; | 311 InstPhi *Phi = nullptr; |
| 311 Variable *Dest = nullptr; | 312 Variable *Dest = nullptr; |
| 312 Operand *Src = nullptr; | 313 Operand *Src = nullptr; |
| 313 bool Processed = false; | 314 bool Processed = false; |
| 314 size_t NumPred = 0; // number of entries whose Src is this Dest | 315 size_t NumPred = 0; // number of entries whose Src is this Dest |
| 315 int32_t Weight = 0; // preference for topological order | 316 int32_t Weight = 0; // preference for topological order |
| 316 }; | 317 }; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 451 } |
| 451 // Second pass computes NumPred by comparing every pair of Phi instructions. | 452 // Second pass computes NumPred by comparing every pair of Phi instructions. |
| 452 for (PhiDesc &Item : Desc) { | 453 for (PhiDesc &Item : Desc) { |
| 453 if (Item.Processed) | 454 if (Item.Processed) |
| 454 continue; | 455 continue; |
| 455 const Variable *Dest = Item.Dest; | 456 const Variable *Dest = Item.Dest; |
| 456 for (PhiDesc &Item2 : Desc) { | 457 for (PhiDesc &Item2 : Desc) { |
| 457 if (Item2.Processed) | 458 if (Item2.Processed) |
| 458 continue; | 459 continue; |
| 459 // There shouldn't be two different Phis with the same Dest variable or | 460 // There shouldn't be two different Phis with the same Dest variable or |
| 460 // register. | 461 // register. |
| 461 assert((&Item == &Item2) || !sameVarOrReg(Target, Dest, Item2.Dest)); | 462 assert((&Item == &Item2) || !sameVarOrReg(Target, Dest, Item2.Dest)); |
| 462 if (sameVarOrReg(Target, Dest, Item2.Src)) | 463 if (sameVarOrReg(Target, Dest, Item2.Src)) |
| 463 ++Item.NumPred; | 464 ++Item.NumPred; |
| 464 } | 465 } |
| 465 } | 466 } |
| 466 | 467 |
| 467 // Another pass to compute initial Weight values. | 468 // Another pass to compute initial Weight values. |
| 468 for (PhiDesc &Item : Desc) { | 469 for (PhiDesc &Item : Desc) { |
| 469 if (Item.Processed) | 470 if (Item.Processed) |
| 470 continue; | 471 continue; |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 InstIntrinsicCall *Inst = InstIntrinsicCall::create( | 1406 InstIntrinsicCall *Inst = InstIntrinsicCall::create( |
| 1406 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); | 1407 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); |
| 1407 Inst->addArg(AtomicRMWOp); | 1408 Inst->addArg(AtomicRMWOp); |
| 1408 Inst->addArg(Counter); | 1409 Inst->addArg(Counter); |
| 1409 Inst->addArg(One); | 1410 Inst->addArg(One); |
| 1410 Inst->addArg(OrderAcquireRelease); | 1411 Inst->addArg(OrderAcquireRelease); |
| 1411 Insts.push_front(Inst); | 1412 Insts.push_front(Inst); |
| 1412 } | 1413 } |
| 1413 | 1414 |
| 1414 } // end of namespace Ice | 1415 } // end of namespace Ice |
| OLD | NEW |