| OLD | NEW |
| 1 //===- subzero/src/IceInst.cpp - High-level instruction implementation ----===// | 1 //===- subzero/src/IceInst.cpp - High-level instruction 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 Inst class, primarily the various | 10 // This file implements the Inst class, primarily the various |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 447 } |
| 448 | 448 |
| 449 InstFakeUse::InstFakeUse(Cfg *Func, Variable *Src) | 449 InstFakeUse::InstFakeUse(Cfg *Func, Variable *Src) |
| 450 : InstHighLevel(Func, Inst::FakeUse, 1, NULL) { | 450 : InstHighLevel(Func, Inst::FakeUse, 1, NULL) { |
| 451 assert(Src); | 451 assert(Src); |
| 452 addSource(Src); | 452 addSource(Src); |
| 453 } | 453 } |
| 454 | 454 |
| 455 InstFakeKill::InstFakeKill(Cfg *Func, const VarList &KilledRegs, | 455 InstFakeKill::InstFakeKill(Cfg *Func, const VarList &KilledRegs, |
| 456 const Inst *Linked) | 456 const Inst *Linked) |
| 457 : InstHighLevel(Func, Inst::FakeKill, KilledRegs.size(), NULL), | 457 : InstHighLevel(Func, Inst::FakeKill, 0, NULL), KilledRegs(KilledRegs), |
| 458 Linked(Linked) { | 458 Linked(Linked) {} |
| 459 for (Variable *Var : KilledRegs) | |
| 460 addSource(Var); | |
| 461 } | |
| 462 | 459 |
| 463 // ======================== Dump routines ======================== // | 460 // ======================== Dump routines ======================== // |
| 464 | 461 |
| 465 void Inst::dumpDecorated(const Cfg *Func) const { | 462 void Inst::dumpDecorated(const Cfg *Func) const { |
| 466 Ostream &Str = Func->getContext()->getStrDump(); | 463 Ostream &Str = Func->getContext()->getStrDump(); |
| 467 if (!Func->getContext()->isVerbose(IceV_Deleted) && | 464 if (!Func->getContext()->isVerbose(IceV_Deleted) && |
| 468 (isDeleted() || isRedundantAssign())) | 465 (isDeleted() || isRedundantAssign())) |
| 469 return; | 466 return; |
| 470 if (Func->getContext()->isVerbose(IceV_InstNumbers)) { | 467 if (Func->getContext()->isVerbose(IceV_InstNumbers)) { |
| 471 char buf[30]; | 468 char buf[30]; |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 Str << ", " << FalseOp->getType() << " "; | 720 Str << ", " << FalseOp->getType() << " "; |
| 724 FalseOp->dump(Func); | 721 FalseOp->dump(Func); |
| 725 } | 722 } |
| 726 | 723 |
| 727 void InstUnreachable::dump(const Cfg *Func) const { | 724 void InstUnreachable::dump(const Cfg *Func) const { |
| 728 Ostream &Str = Func->getContext()->getStrDump(); | 725 Ostream &Str = Func->getContext()->getStrDump(); |
| 729 Str << "unreachable"; | 726 Str << "unreachable"; |
| 730 } | 727 } |
| 731 | 728 |
| 732 void InstFakeDef::emit(const Cfg *Func) const { | 729 void InstFakeDef::emit(const Cfg *Func) const { |
| 730 // Go ahead and "emit" these for now, since they are relatively |
| 731 // rare. |
| 733 Ostream &Str = Func->getContext()->getStrEmit(); | 732 Ostream &Str = Func->getContext()->getStrEmit(); |
| 734 Str << "\t# "; | 733 Str << "\t# "; |
| 735 getDest()->emit(Func); | 734 getDest()->emit(Func); |
| 736 Str << " = def.pseudo "; | 735 Str << " = def.pseudo "; |
| 737 emitSources(Func); | 736 emitSources(Func); |
| 738 } | 737 } |
| 739 | 738 |
| 740 void InstFakeDef::dump(const Cfg *Func) const { | 739 void InstFakeDef::dump(const Cfg *Func) const { |
| 741 Ostream &Str = Func->getContext()->getStrDump(); | 740 Ostream &Str = Func->getContext()->getStrDump(); |
| 742 dumpDest(Func); | 741 dumpDest(Func); |
| 743 Str << " = def.pseudo "; | 742 Str << " = def.pseudo "; |
| 744 dumpSources(Func); | 743 dumpSources(Func); |
| 745 } | 744 } |
| 746 | 745 |
| 747 void InstFakeUse::emit(const Cfg *Func) const { | 746 void InstFakeUse::emit(const Cfg *Func) const { (void)Func; } |
| 748 Ostream &Str = Func->getContext()->getStrEmit(); | |
| 749 Str << "\t# "; | |
| 750 Str << "use.pseudo "; | |
| 751 emitSources(Func); | |
| 752 } | |
| 753 | 747 |
| 754 void InstFakeUse::dump(const Cfg *Func) const { | 748 void InstFakeUse::dump(const Cfg *Func) const { |
| 755 Ostream &Str = Func->getContext()->getStrDump(); | 749 Ostream &Str = Func->getContext()->getStrDump(); |
| 756 Str << "use.pseudo "; | 750 Str << "use.pseudo "; |
| 757 dumpSources(Func); | 751 dumpSources(Func); |
| 758 } | 752 } |
| 759 | 753 |
| 760 void InstFakeKill::emit(const Cfg *Func) const { | 754 void InstFakeKill::emit(const Cfg *Func) const { (void)Func; } |
| 761 Ostream &Str = Func->getContext()->getStrEmit(); | |
| 762 Str << "\t# "; | |
| 763 if (Linked->isDeleted()) | |
| 764 Str << "// "; | |
| 765 Str << "kill.pseudo "; | |
| 766 emitSources(Func); | |
| 767 } | |
| 768 | 755 |
| 769 void InstFakeKill::dump(const Cfg *Func) const { | 756 void InstFakeKill::dump(const Cfg *Func) const { |
| 770 Ostream &Str = Func->getContext()->getStrDump(); | 757 Ostream &Str = Func->getContext()->getStrDump(); |
| 771 if (Linked->isDeleted()) | 758 if (Linked->isDeleted()) |
| 772 Str << "// "; | 759 Str << "// "; |
| 773 Str << "kill.pseudo "; | 760 Str << "kill.pseudo "; |
| 774 dumpSources(Func); | 761 bool First = true; |
| 762 for (Variable *Var : KilledRegs) { |
| 763 if (!First) |
| 764 Str << ", "; |
| 765 First = false; |
| 766 Var->dump(Func); |
| 767 } |
| 775 } | 768 } |
| 776 | 769 |
| 777 void InstTarget::dump(const Cfg *Func) const { | 770 void InstTarget::dump(const Cfg *Func) const { |
| 778 Ostream &Str = Func->getContext()->getStrDump(); | 771 Ostream &Str = Func->getContext()->getStrDump(); |
| 779 Str << "[TARGET] "; | 772 Str << "[TARGET] "; |
| 780 Inst::dump(Func); | 773 Inst::dump(Func); |
| 781 } | 774 } |
| 782 | 775 |
| 783 } // end of namespace Ice | 776 } // end of namespace Ice |
| OLD | NEW |