| OLD | NEW |
| 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// | 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 continue; | 452 continue; |
| 453 FOREACH_VAR_IN_INST(Var, *Inst) { | 453 FOREACH_VAR_IN_INST(Var, *Inst) { |
| 454 if (Var == Dest) { | 454 if (Var == Dest) { |
| 455 Inst->setDestRedefined(); | 455 Inst->setDestRedefined(); |
| 456 break; | 456 break; |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 | 461 |
| 462 void TargetLowering::addFakeDefUses(const Inst *Instr) { |
| 463 FOREACH_VAR_IN_INST(Var, *Instr) { |
| 464 if (auto *Var64 = llvm::dyn_cast<Variable64On32>(Var)) { |
| 465 Context.insert<InstFakeUse>(Var64->getLo()); |
| 466 Context.insert<InstFakeUse>(Var64->getHi()); |
| 467 } else { |
| 468 Context.insert<InstFakeUse>(Var); |
| 469 } |
| 470 } |
| 471 Variable *Dest = Instr->getDest(); |
| 472 if (Dest == nullptr) |
| 473 return; |
| 474 if (auto *Var64 = llvm::dyn_cast<Variable64On32>(Dest)) { |
| 475 Context.insert<InstFakeDef>(Var64->getLo()); |
| 476 Context.insert<InstFakeDef>(Var64->getHi()); |
| 477 } else { |
| 478 Context.insert<InstFakeDef>(Dest); |
| 479 } |
| 480 } |
| 481 |
| 462 void TargetLowering::sortVarsByAlignment(VarList &Dest, | 482 void TargetLowering::sortVarsByAlignment(VarList &Dest, |
| 463 const VarList &Source) const { | 483 const VarList &Source) const { |
| 464 Dest = Source; | 484 Dest = Source; |
| 465 // Instead of std::sort, we could do a bucket sort with log2(alignment) as | 485 // Instead of std::sort, we could do a bucket sort with log2(alignment) as |
| 466 // the buckets, if performance is an issue. | 486 // the buckets, if performance is an issue. |
| 467 std::sort(Dest.begin(), Dest.end(), | 487 std::sort(Dest.begin(), Dest.end(), |
| 468 [this](const Variable *V1, const Variable *V2) { | 488 [this](const Variable *V1, const Variable *V2) { |
| 469 return typeWidthInBytesOnStack(V1->getType()) > | 489 return typeWidthInBytesOnStack(V1->getType()) > |
| 470 typeWidthInBytesOnStack(V2->getType()); | 490 typeWidthInBytesOnStack(V2->getType()); |
| 471 }); | 491 }); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 case Target_##X: \ | 817 case Target_##X: \ |
| 798 return ::X::createTargetHeaderLowering(Ctx); | 818 return ::X::createTargetHeaderLowering(Ctx); |
| 799 #include "llvm/Config/SZTargets.def" | 819 #include "llvm/Config/SZTargets.def" |
| 800 #undef SUBZERO_TARGET | 820 #undef SUBZERO_TARGET |
| 801 } | 821 } |
| 802 } | 822 } |
| 803 | 823 |
| 804 TargetHeaderLowering::~TargetHeaderLowering() = default; | 824 TargetHeaderLowering::~TargetHeaderLowering() = default; |
| 805 | 825 |
| 806 } // end of namespace Ice | 826 } // end of namespace Ice |
| OLD | NEW |