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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 Str << "("; | 611 Str << "("; |
612 for (SizeT I = 0; I < getNumArgs(); ++I) { | 612 for (SizeT I = 0; I < getNumArgs(); ++I) { |
613 if (I > 0) | 613 if (I > 0) |
614 Str << ", "; | 614 Str << ", "; |
615 Str << getArg(I)->getType() << " "; | 615 Str << getArg(I)->getType() << " "; |
616 getArg(I)->dump(Func); | 616 getArg(I)->dump(Func); |
617 } | 617 } |
618 Str << ")"; | 618 Str << ")"; |
619 } | 619 } |
620 | 620 |
| 621 const char *InstCast::getCastName(InstCast::OpKind Kind) { |
| 622 size_t Index = static_cast<size_t>(Kind); |
| 623 if (Index < InstCast::OpKind::_num) |
| 624 return InstCastAttributes[Index].DisplayString; |
| 625 llvm_unreachable("Invalid InstCast::OpKind"); |
| 626 return "???"; |
| 627 } |
| 628 |
621 void InstCast::dump(const Cfg *Func) const { | 629 void InstCast::dump(const Cfg *Func) const { |
622 if (!ALLOW_DUMP) | 630 if (!ALLOW_DUMP) |
623 return; | 631 return; |
624 Ostream &Str = Func->getContext()->getStrDump(); | 632 Ostream &Str = Func->getContext()->getStrDump(); |
625 dumpDest(Func); | 633 dumpDest(Func); |
626 Str << " = " << InstCastAttributes[getCastKind()].DisplayString << " " | 634 Str << " = " << getCastName(getCastKind()) << " " << getSrc(0)->getType() |
627 << getSrc(0)->getType() << " "; | 635 << " "; |
628 dumpSources(Func); | 636 dumpSources(Func); |
629 Str << " to " << getDest()->getType(); | 637 Str << " to " << getDest()->getType(); |
630 } | 638 } |
631 | 639 |
632 void InstIcmp::dump(const Cfg *Func) const { | 640 void InstIcmp::dump(const Cfg *Func) const { |
633 if (!ALLOW_DUMP) | 641 if (!ALLOW_DUMP) |
634 return; | 642 return; |
635 Ostream &Str = Func->getContext()->getStrDump(); | 643 Ostream &Str = Func->getContext()->getStrDump(); |
636 dumpDest(Func); | 644 dumpDest(Func); |
637 Str << " = icmp " << InstIcmpAttributes[getCondition()].DisplayString << " " | 645 Str << " = icmp " << InstIcmpAttributes[getCondition()].DisplayString << " " |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 | 818 |
811 void InstTarget::dump(const Cfg *Func) const { | 819 void InstTarget::dump(const Cfg *Func) const { |
812 if (!ALLOW_DUMP) | 820 if (!ALLOW_DUMP) |
813 return; | 821 return; |
814 Ostream &Str = Func->getContext()->getStrDump(); | 822 Ostream &Str = Func->getContext()->getStrDump(); |
815 Str << "[TARGET] "; | 823 Str << "[TARGET] "; |
816 Inst::dump(Func); | 824 Inst::dump(Func); |
817 } | 825 } |
818 | 826 |
819 } // end of namespace Ice | 827 } // end of namespace Ice |
OLD | NEW |