| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, 0, NULL), KilledRegs(KilledRegs), | 457 : InstHighLevel(Func, Inst::FakeKill, 0, NULL), KilledRegs(KilledRegs), |
| 458 Linked(Linked) {} | 458 Linked(Linked) {} |
| 459 | 459 |
| 460 Type InstCall::getReturnType() const { |
| 461 if (Dest == NULL) |
| 462 return IceType_void; |
| 463 return Dest->getType(); |
| 464 } |
| 465 |
| 460 // ======================== Dump routines ======================== // | 466 // ======================== Dump routines ======================== // |
| 461 | 467 |
| 462 void Inst::dumpDecorated(const Cfg *Func) const { | 468 void Inst::dumpDecorated(const Cfg *Func) const { |
| 469 if (!ALLOW_DUMP) |
| 470 return; |
| 463 Ostream &Str = Func->getContext()->getStrDump(); | 471 Ostream &Str = Func->getContext()->getStrDump(); |
| 464 if (!Func->getContext()->isVerbose(IceV_Deleted) && | 472 if (!Func->getContext()->isVerbose(IceV_Deleted) && |
| 465 (isDeleted() || isRedundantAssign())) | 473 (isDeleted() || isRedundantAssign())) |
| 466 return; | 474 return; |
| 467 if (Func->getContext()->isVerbose(IceV_InstNumbers)) { | 475 if (Func->getContext()->isVerbose(IceV_InstNumbers)) { |
| 468 char buf[30]; | 476 char buf[30]; |
| 469 InstNumberT Number = getNumber(); | 477 InstNumberT Number = getNumber(); |
| 470 if (Number == NumberDeleted) | 478 if (Number == NumberDeleted) |
| 471 snprintf(buf, llvm::array_lengthof(buf), "[XXX]"); | 479 snprintf(buf, llvm::array_lengthof(buf), "[XXX]"); |
| 472 else | 480 else |
| 473 snprintf(buf, llvm::array_lengthof(buf), "[%3d]", Number); | 481 snprintf(buf, llvm::array_lengthof(buf), "[%3d]", Number); |
| 474 Str << buf; | 482 Str << buf; |
| 475 } | 483 } |
| 476 Str << " "; | 484 Str << " "; |
| 477 if (isDeleted()) | 485 if (isDeleted()) |
| 478 Str << " //"; | 486 Str << " //"; |
| 479 dump(Func); | 487 dump(Func); |
| 480 dumpExtras(Func); | 488 dumpExtras(Func); |
| 481 Str << "\n"; | 489 Str << "\n"; |
| 482 } | 490 } |
| 483 | 491 |
| 484 void Inst::dump(const Cfg *Func) const { | 492 void Inst::dump(const Cfg *Func) const { |
| 493 if (!ALLOW_DUMP) |
| 494 return; |
| 485 Ostream &Str = Func->getContext()->getStrDump(); | 495 Ostream &Str = Func->getContext()->getStrDump(); |
| 486 dumpDest(Func); | 496 dumpDest(Func); |
| 487 Str << " =~ "; | 497 Str << " =~ "; |
| 488 dumpSources(Func); | 498 dumpSources(Func); |
| 489 } | 499 } |
| 490 | 500 |
| 491 void Inst::dumpExtras(const Cfg *Func) const { | 501 void Inst::dumpExtras(const Cfg *Func) const { |
| 502 if (!ALLOW_DUMP) |
| 503 return; |
| 492 Ostream &Str = Func->getContext()->getStrDump(); | 504 Ostream &Str = Func->getContext()->getStrDump(); |
| 493 bool First = true; | 505 bool First = true; |
| 494 // Print "LIVEEND={a,b,c}" for all source operands whose live ranges | 506 // Print "LIVEEND={a,b,c}" for all source operands whose live ranges |
| 495 // are known to end at this instruction. | 507 // are known to end at this instruction. |
| 496 if (Func->getContext()->isVerbose(IceV_Liveness)) { | 508 if (Func->getContext()->isVerbose(IceV_Liveness)) { |
| 497 for (SizeT I = 0; I < getSrcSize(); ++I) { | 509 for (SizeT I = 0; I < getSrcSize(); ++I) { |
| 498 Operand *Src = getSrc(I); | 510 Operand *Src = getSrc(I); |
| 499 SizeT NumVars = Src->getNumVars(); | 511 SizeT NumVars = Src->getNumVars(); |
| 500 for (SizeT J = 0; J < NumVars; ++J) { | 512 for (SizeT J = 0; J < NumVars; ++J) { |
| 501 const Variable *Var = Src->getVar(J); | 513 const Variable *Var = Src->getVar(J); |
| 502 if (isLastUse(Var)) { | 514 if (isLastUse(Var)) { |
| 503 if (First) | 515 if (First) |
| 504 Str << " // LIVEEND={"; | 516 Str << " // LIVEEND={"; |
| 505 else | 517 else |
| 506 Str << ","; | 518 Str << ","; |
| 507 Var->dump(Func); | 519 Var->dump(Func); |
| 508 First = false; | 520 First = false; |
| 509 } | 521 } |
| 510 } | 522 } |
| 511 } | 523 } |
| 512 if (!First) | 524 if (!First) |
| 513 Str << "}"; | 525 Str << "}"; |
| 514 } | 526 } |
| 515 } | 527 } |
| 516 | 528 |
| 517 void Inst::dumpSources(const Cfg *Func) const { | 529 void Inst::dumpSources(const Cfg *Func) const { |
| 530 if (!ALLOW_DUMP) |
| 531 return; |
| 518 Ostream &Str = Func->getContext()->getStrDump(); | 532 Ostream &Str = Func->getContext()->getStrDump(); |
| 519 for (SizeT I = 0; I < getSrcSize(); ++I) { | 533 for (SizeT I = 0; I < getSrcSize(); ++I) { |
| 520 if (I > 0) | 534 if (I > 0) |
| 521 Str << ", "; | 535 Str << ", "; |
| 522 getSrc(I)->dump(Func); | 536 getSrc(I)->dump(Func); |
| 523 } | 537 } |
| 524 } | 538 } |
| 525 | 539 |
| 526 void Inst::emitSources(const Cfg *Func) const { | 540 void Inst::emitSources(const Cfg *Func) const { |
| 541 if (!ALLOW_DUMP) |
| 542 return; |
| 527 Ostream &Str = Func->getContext()->getStrEmit(); | 543 Ostream &Str = Func->getContext()->getStrEmit(); |
| 528 for (SizeT I = 0; I < getSrcSize(); ++I) { | 544 for (SizeT I = 0; I < getSrcSize(); ++I) { |
| 529 if (I > 0) | 545 if (I > 0) |
| 530 Str << ", "; | 546 Str << ", "; |
| 531 getSrc(I)->emit(Func); | 547 getSrc(I)->emit(Func); |
| 532 } | 548 } |
| 533 } | 549 } |
| 534 | 550 |
| 535 void Inst::dumpDest(const Cfg *Func) const { | 551 void Inst::dumpDest(const Cfg *Func) const { |
| 552 if (!ALLOW_DUMP) |
| 553 return; |
| 536 if (getDest()) | 554 if (getDest()) |
| 537 getDest()->dump(Func); | 555 getDest()->dump(Func); |
| 538 } | 556 } |
| 539 | 557 |
| 540 void InstAlloca::dump(const Cfg *Func) const { | 558 void InstAlloca::dump(const Cfg *Func) const { |
| 559 if (!ALLOW_DUMP) |
| 560 return; |
| 541 Ostream &Str = Func->getContext()->getStrDump(); | 561 Ostream &Str = Func->getContext()->getStrDump(); |
| 542 dumpDest(Func); | 562 dumpDest(Func); |
| 543 Str << " = alloca i8, i32 "; | 563 Str << " = alloca i8, i32 "; |
| 544 getSizeInBytes()->dump(Func); | 564 getSizeInBytes()->dump(Func); |
| 545 if (getAlignInBytes()) | 565 if (getAlignInBytes()) |
| 546 Str << ", align " << getAlignInBytes(); | 566 Str << ", align " << getAlignInBytes(); |
| 547 } | 567 } |
| 548 | 568 |
| 549 void InstArithmetic::dump(const Cfg *Func) const { | 569 void InstArithmetic::dump(const Cfg *Func) const { |
| 570 if (!ALLOW_DUMP) |
| 571 return; |
| 550 Ostream &Str = Func->getContext()->getStrDump(); | 572 Ostream &Str = Func->getContext()->getStrDump(); |
| 551 dumpDest(Func); | 573 dumpDest(Func); |
| 552 Str << " = " << InstArithmeticAttributes[getOp()].DisplayString << " " | 574 Str << " = " << InstArithmeticAttributes[getOp()].DisplayString << " " |
| 553 << getDest()->getType() << " "; | 575 << getDest()->getType() << " "; |
| 554 dumpSources(Func); | 576 dumpSources(Func); |
| 555 } | 577 } |
| 556 | 578 |
| 557 void InstAssign::dump(const Cfg *Func) const { | 579 void InstAssign::dump(const Cfg *Func) const { |
| 580 if (!ALLOW_DUMP) |
| 581 return; |
| 558 Ostream &Str = Func->getContext()->getStrDump(); | 582 Ostream &Str = Func->getContext()->getStrDump(); |
| 559 dumpDest(Func); | 583 dumpDest(Func); |
| 560 Str << " = " << getDest()->getType() << " "; | 584 Str << " = " << getDest()->getType() << " "; |
| 561 dumpSources(Func); | 585 dumpSources(Func); |
| 562 } | 586 } |
| 563 | 587 |
| 564 void InstBr::dump(const Cfg *Func) const { | 588 void InstBr::dump(const Cfg *Func) const { |
| 589 if (!ALLOW_DUMP) |
| 590 return; |
| 565 Ostream &Str = Func->getContext()->getStrDump(); | 591 Ostream &Str = Func->getContext()->getStrDump(); |
| 566 dumpDest(Func); | 592 dumpDest(Func); |
| 567 Str << "br "; | 593 Str << "br "; |
| 568 if (!isUnconditional()) { | 594 if (!isUnconditional()) { |
| 569 Str << "i1 "; | 595 Str << "i1 "; |
| 570 getCondition()->dump(Func); | 596 getCondition()->dump(Func); |
| 571 Str << ", label %" << getTargetTrue()->getName() << ", "; | 597 Str << ", label %" << getTargetTrue()->getName() << ", "; |
| 572 } | 598 } |
| 573 Str << "label %" << getTargetFalse()->getName(); | 599 Str << "label %" << getTargetFalse()->getName(); |
| 574 } | 600 } |
| 575 | 601 |
| 576 Type InstCall::getReturnType() const { | |
| 577 if (Dest == NULL) | |
| 578 return IceType_void; | |
| 579 return Dest->getType(); | |
| 580 } | |
| 581 | |
| 582 void InstCall::dump(const Cfg *Func) const { | 602 void InstCall::dump(const Cfg *Func) const { |
| 603 if (!ALLOW_DUMP) |
| 604 return; |
| 583 Ostream &Str = Func->getContext()->getStrDump(); | 605 Ostream &Str = Func->getContext()->getStrDump(); |
| 584 if (getDest()) { | 606 if (getDest()) { |
| 585 dumpDest(Func); | 607 dumpDest(Func); |
| 586 Str << " = "; | 608 Str << " = "; |
| 587 } | 609 } |
| 588 Str << "call "; | 610 Str << "call "; |
| 589 if (getDest()) | 611 if (getDest()) |
| 590 Str << getDest()->getType(); | 612 Str << getDest()->getType(); |
| 591 else | 613 else |
| 592 Str << "void"; | 614 Str << "void"; |
| 593 Str << " "; | 615 Str << " "; |
| 594 getCallTarget()->dump(Func); | 616 getCallTarget()->dump(Func); |
| 595 Str << "("; | 617 Str << "("; |
| 596 for (SizeT I = 0; I < getNumArgs(); ++I) { | 618 for (SizeT I = 0; I < getNumArgs(); ++I) { |
| 597 if (I > 0) | 619 if (I > 0) |
| 598 Str << ", "; | 620 Str << ", "; |
| 599 Str << getArg(I)->getType() << " "; | 621 Str << getArg(I)->getType() << " "; |
| 600 getArg(I)->dump(Func); | 622 getArg(I)->dump(Func); |
| 601 } | 623 } |
| 602 Str << ")"; | 624 Str << ")"; |
| 603 } | 625 } |
| 604 | 626 |
| 605 void InstCast::dump(const Cfg *Func) const { | 627 void InstCast::dump(const Cfg *Func) const { |
| 628 if (!ALLOW_DUMP) |
| 629 return; |
| 606 Ostream &Str = Func->getContext()->getStrDump(); | 630 Ostream &Str = Func->getContext()->getStrDump(); |
| 607 dumpDest(Func); | 631 dumpDest(Func); |
| 608 Str << " = " << InstCastAttributes[getCastKind()].DisplayString << " " | 632 Str << " = " << InstCastAttributes[getCastKind()].DisplayString << " " |
| 609 << getSrc(0)->getType() << " "; | 633 << getSrc(0)->getType() << " "; |
| 610 dumpSources(Func); | 634 dumpSources(Func); |
| 611 Str << " to " << getDest()->getType(); | 635 Str << " to " << getDest()->getType(); |
| 612 } | 636 } |
| 613 | 637 |
| 614 void InstIcmp::dump(const Cfg *Func) const { | 638 void InstIcmp::dump(const Cfg *Func) const { |
| 639 if (!ALLOW_DUMP) |
| 640 return; |
| 615 Ostream &Str = Func->getContext()->getStrDump(); | 641 Ostream &Str = Func->getContext()->getStrDump(); |
| 616 dumpDest(Func); | 642 dumpDest(Func); |
| 617 Str << " = icmp " << InstIcmpAttributes[getCondition()].DisplayString << " " | 643 Str << " = icmp " << InstIcmpAttributes[getCondition()].DisplayString << " " |
| 618 << getSrc(0)->getType() << " "; | 644 << getSrc(0)->getType() << " "; |
| 619 dumpSources(Func); | 645 dumpSources(Func); |
| 620 } | 646 } |
| 621 | 647 |
| 622 void InstExtractElement::dump(const Cfg *Func) const { | 648 void InstExtractElement::dump(const Cfg *Func) const { |
| 649 if (!ALLOW_DUMP) |
| 650 return; |
| 623 Ostream &Str = Func->getContext()->getStrDump(); | 651 Ostream &Str = Func->getContext()->getStrDump(); |
| 624 dumpDest(Func); | 652 dumpDest(Func); |
| 625 Str << " = extractelement "; | 653 Str << " = extractelement "; |
| 626 Str << getSrc(0)->getType() << " "; | 654 Str << getSrc(0)->getType() << " "; |
| 627 getSrc(0)->dump(Func); | 655 getSrc(0)->dump(Func); |
| 628 Str << ", "; | 656 Str << ", "; |
| 629 Str << getSrc(1)->getType() << " "; | 657 Str << getSrc(1)->getType() << " "; |
| 630 getSrc(1)->dump(Func); | 658 getSrc(1)->dump(Func); |
| 631 } | 659 } |
| 632 | 660 |
| 633 void InstInsertElement::dump(const Cfg *Func) const { | 661 void InstInsertElement::dump(const Cfg *Func) const { |
| 662 if (!ALLOW_DUMP) |
| 663 return; |
| 634 Ostream &Str = Func->getContext()->getStrDump(); | 664 Ostream &Str = Func->getContext()->getStrDump(); |
| 635 dumpDest(Func); | 665 dumpDest(Func); |
| 636 Str << " = insertelement "; | 666 Str << " = insertelement "; |
| 637 Str << getSrc(0)->getType() << " "; | 667 Str << getSrc(0)->getType() << " "; |
| 638 getSrc(0)->dump(Func); | 668 getSrc(0)->dump(Func); |
| 639 Str << ", "; | 669 Str << ", "; |
| 640 Str << getSrc(1)->getType() << " "; | 670 Str << getSrc(1)->getType() << " "; |
| 641 getSrc(1)->dump(Func); | 671 getSrc(1)->dump(Func); |
| 642 Str << ", "; | 672 Str << ", "; |
| 643 Str << getSrc(2)->getType() << " "; | 673 Str << getSrc(2)->getType() << " "; |
| 644 getSrc(2)->dump(Func); | 674 getSrc(2)->dump(Func); |
| 645 } | 675 } |
| 646 | 676 |
| 647 void InstFcmp::dump(const Cfg *Func) const { | 677 void InstFcmp::dump(const Cfg *Func) const { |
| 678 if (!ALLOW_DUMP) |
| 679 return; |
| 648 Ostream &Str = Func->getContext()->getStrDump(); | 680 Ostream &Str = Func->getContext()->getStrDump(); |
| 649 dumpDest(Func); | 681 dumpDest(Func); |
| 650 Str << " = fcmp " << InstFcmpAttributes[getCondition()].DisplayString << " " | 682 Str << " = fcmp " << InstFcmpAttributes[getCondition()].DisplayString << " " |
| 651 << getSrc(0)->getType() << " "; | 683 << getSrc(0)->getType() << " "; |
| 652 dumpSources(Func); | 684 dumpSources(Func); |
| 653 } | 685 } |
| 654 | 686 |
| 655 void InstLoad::dump(const Cfg *Func) const { | 687 void InstLoad::dump(const Cfg *Func) const { |
| 688 if (!ALLOW_DUMP) |
| 689 return; |
| 656 Ostream &Str = Func->getContext()->getStrDump(); | 690 Ostream &Str = Func->getContext()->getStrDump(); |
| 657 dumpDest(Func); | 691 dumpDest(Func); |
| 658 Type Ty = getDest()->getType(); | 692 Type Ty = getDest()->getType(); |
| 659 Str << " = load " << Ty << "* "; | 693 Str << " = load " << Ty << "* "; |
| 660 dumpSources(Func); | 694 dumpSources(Func); |
| 661 Str << ", align " << typeAlignInBytes(Ty); | 695 Str << ", align " << typeAlignInBytes(Ty); |
| 662 } | 696 } |
| 663 | 697 |
| 664 void InstStore::dump(const Cfg *Func) const { | 698 void InstStore::dump(const Cfg *Func) const { |
| 699 if (!ALLOW_DUMP) |
| 700 return; |
| 665 Ostream &Str = Func->getContext()->getStrDump(); | 701 Ostream &Str = Func->getContext()->getStrDump(); |
| 666 Type Ty = getData()->getType(); | 702 Type Ty = getData()->getType(); |
| 667 Str << "store " << Ty << " "; | 703 Str << "store " << Ty << " "; |
| 668 getData()->dump(Func); | 704 getData()->dump(Func); |
| 669 Str << ", " << Ty << "* "; | 705 Str << ", " << Ty << "* "; |
| 670 getAddr()->dump(Func); | 706 getAddr()->dump(Func); |
| 671 Str << ", align " << typeAlignInBytes(Ty); | 707 Str << ", align " << typeAlignInBytes(Ty); |
| 672 } | 708 } |
| 673 | 709 |
| 674 void InstSwitch::dump(const Cfg *Func) const { | 710 void InstSwitch::dump(const Cfg *Func) const { |
| 711 if (!ALLOW_DUMP) |
| 712 return; |
| 675 Ostream &Str = Func->getContext()->getStrDump(); | 713 Ostream &Str = Func->getContext()->getStrDump(); |
| 676 Type Ty = getComparison()->getType(); | 714 Type Ty = getComparison()->getType(); |
| 677 Str << "switch " << Ty << " "; | 715 Str << "switch " << Ty << " "; |
| 678 getSrc(0)->dump(Func); | 716 getSrc(0)->dump(Func); |
| 679 Str << ", label %" << getLabelDefault()->getName() << " [\n"; | 717 Str << ", label %" << getLabelDefault()->getName() << " [\n"; |
| 680 for (SizeT I = 0; I < getNumCases(); ++I) { | 718 for (SizeT I = 0; I < getNumCases(); ++I) { |
| 681 Str << " " << Ty << " " << static_cast<int64_t>(getValue(I)) | 719 Str << " " << Ty << " " << static_cast<int64_t>(getValue(I)) |
| 682 << ", label %" << getLabel(I)->getName() << "\n"; | 720 << ", label %" << getLabel(I)->getName() << "\n"; |
| 683 } | 721 } |
| 684 Str << " ]"; | 722 Str << " ]"; |
| 685 } | 723 } |
| 686 | 724 |
| 687 void InstPhi::dump(const Cfg *Func) const { | 725 void InstPhi::dump(const Cfg *Func) const { |
| 726 if (!ALLOW_DUMP) |
| 727 return; |
| 688 Ostream &Str = Func->getContext()->getStrDump(); | 728 Ostream &Str = Func->getContext()->getStrDump(); |
| 689 dumpDest(Func); | 729 dumpDest(Func); |
| 690 Str << " = phi " << getDest()->getType() << " "; | 730 Str << " = phi " << getDest()->getType() << " "; |
| 691 for (SizeT I = 0; I < getSrcSize(); ++I) { | 731 for (SizeT I = 0; I < getSrcSize(); ++I) { |
| 692 if (I > 0) | 732 if (I > 0) |
| 693 Str << ", "; | 733 Str << ", "; |
| 694 Str << "[ "; | 734 Str << "[ "; |
| 695 getSrc(I)->dump(Func); | 735 getSrc(I)->dump(Func); |
| 696 Str << ", %" << Labels[I]->getName() << " ]"; | 736 Str << ", %" << Labels[I]->getName() << " ]"; |
| 697 } | 737 } |
| 698 } | 738 } |
| 699 | 739 |
| 700 void InstRet::dump(const Cfg *Func) const { | 740 void InstRet::dump(const Cfg *Func) const { |
| 741 if (!ALLOW_DUMP) |
| 742 return; |
| 701 Ostream &Str = Func->getContext()->getStrDump(); | 743 Ostream &Str = Func->getContext()->getStrDump(); |
| 702 Type Ty = hasRetValue() ? getRetValue()->getType() : IceType_void; | 744 Type Ty = hasRetValue() ? getRetValue()->getType() : IceType_void; |
| 703 Str << "ret " << Ty; | 745 Str << "ret " << Ty; |
| 704 if (hasRetValue()) { | 746 if (hasRetValue()) { |
| 705 Str << " "; | 747 Str << " "; |
| 706 dumpSources(Func); | 748 dumpSources(Func); |
| 707 } | 749 } |
| 708 } | 750 } |
| 709 | 751 |
| 710 void InstSelect::dump(const Cfg *Func) const { | 752 void InstSelect::dump(const Cfg *Func) const { |
| 753 if (!ALLOW_DUMP) |
| 754 return; |
| 711 Ostream &Str = Func->getContext()->getStrDump(); | 755 Ostream &Str = Func->getContext()->getStrDump(); |
| 712 dumpDest(Func); | 756 dumpDest(Func); |
| 713 Operand *Condition = getCondition(); | 757 Operand *Condition = getCondition(); |
| 714 Operand *TrueOp = getTrueOperand(); | 758 Operand *TrueOp = getTrueOperand(); |
| 715 Operand *FalseOp = getFalseOperand(); | 759 Operand *FalseOp = getFalseOperand(); |
| 716 Str << " = select " << Condition->getType() << " "; | 760 Str << " = select " << Condition->getType() << " "; |
| 717 Condition->dump(Func); | 761 Condition->dump(Func); |
| 718 Str << ", " << TrueOp->getType() << " "; | 762 Str << ", " << TrueOp->getType() << " "; |
| 719 TrueOp->dump(Func); | 763 TrueOp->dump(Func); |
| 720 Str << ", " << FalseOp->getType() << " "; | 764 Str << ", " << FalseOp->getType() << " "; |
| 721 FalseOp->dump(Func); | 765 FalseOp->dump(Func); |
| 722 } | 766 } |
| 723 | 767 |
| 724 void InstUnreachable::dump(const Cfg *Func) const { | 768 void InstUnreachable::dump(const Cfg *Func) const { |
| 769 if (!ALLOW_DUMP) |
| 770 return; |
| 725 Ostream &Str = Func->getContext()->getStrDump(); | 771 Ostream &Str = Func->getContext()->getStrDump(); |
| 726 Str << "unreachable"; | 772 Str << "unreachable"; |
| 727 } | 773 } |
| 728 | 774 |
| 729 void InstFakeDef::emit(const Cfg *Func) const { | 775 void InstFakeDef::emit(const Cfg *Func) const { |
| 776 if (!ALLOW_DUMP) |
| 777 return; |
| 730 // Go ahead and "emit" these for now, since they are relatively | 778 // Go ahead and "emit" these for now, since they are relatively |
| 731 // rare. | 779 // rare. |
| 732 Ostream &Str = Func->getContext()->getStrEmit(); | 780 Ostream &Str = Func->getContext()->getStrEmit(); |
| 733 Str << "\t# "; | 781 Str << "\t# "; |
| 734 getDest()->emit(Func); | 782 getDest()->emit(Func); |
| 735 Str << " = def.pseudo "; | 783 Str << " = def.pseudo "; |
| 736 emitSources(Func); | 784 emitSources(Func); |
| 737 } | 785 } |
| 738 | 786 |
| 739 void InstFakeDef::dump(const Cfg *Func) const { | 787 void InstFakeDef::dump(const Cfg *Func) const { |
| 788 if (!ALLOW_DUMP) |
| 789 return; |
| 740 Ostream &Str = Func->getContext()->getStrDump(); | 790 Ostream &Str = Func->getContext()->getStrDump(); |
| 741 dumpDest(Func); | 791 dumpDest(Func); |
| 742 Str << " = def.pseudo "; | 792 Str << " = def.pseudo "; |
| 743 dumpSources(Func); | 793 dumpSources(Func); |
| 744 } | 794 } |
| 745 | 795 |
| 746 void InstFakeUse::emit(const Cfg *Func) const { (void)Func; } | 796 void InstFakeUse::emit(const Cfg *Func) const { (void)Func; } |
| 747 | 797 |
| 748 void InstFakeUse::dump(const Cfg *Func) const { | 798 void InstFakeUse::dump(const Cfg *Func) const { |
| 799 if (!ALLOW_DUMP) |
| 800 return; |
| 749 Ostream &Str = Func->getContext()->getStrDump(); | 801 Ostream &Str = Func->getContext()->getStrDump(); |
| 750 Str << "use.pseudo "; | 802 Str << "use.pseudo "; |
| 751 dumpSources(Func); | 803 dumpSources(Func); |
| 752 } | 804 } |
| 753 | 805 |
| 754 void InstFakeKill::emit(const Cfg *Func) const { (void)Func; } | 806 void InstFakeKill::emit(const Cfg *Func) const { (void)Func; } |
| 755 | 807 |
| 756 void InstFakeKill::dump(const Cfg *Func) const { | 808 void InstFakeKill::dump(const Cfg *Func) const { |
| 809 if (!ALLOW_DUMP) |
| 810 return; |
| 757 Ostream &Str = Func->getContext()->getStrDump(); | 811 Ostream &Str = Func->getContext()->getStrDump(); |
| 758 if (Linked->isDeleted()) | 812 if (Linked->isDeleted()) |
| 759 Str << "// "; | 813 Str << "// "; |
| 760 Str << "kill.pseudo "; | 814 Str << "kill.pseudo "; |
| 761 bool First = true; | 815 bool First = true; |
| 762 for (Variable *Var : KilledRegs) { | 816 for (Variable *Var : KilledRegs) { |
| 763 if (!First) | 817 if (!First) |
| 764 Str << ", "; | 818 Str << ", "; |
| 765 First = false; | 819 First = false; |
| 766 Var->dump(Func); | 820 Var->dump(Func); |
| 767 } | 821 } |
| 768 } | 822 } |
| 769 | 823 |
| 770 void InstTarget::dump(const Cfg *Func) const { | 824 void InstTarget::dump(const Cfg *Func) const { |
| 825 if (!ALLOW_DUMP) |
| 826 return; |
| 771 Ostream &Str = Func->getContext()->getStrDump(); | 827 Ostream &Str = Func->getContext()->getStrDump(); |
| 772 Str << "[TARGET] "; | 828 Str << "[TARGET] "; |
| 773 Inst::dump(Func); | 829 Inst::dump(Func); |
| 774 } | 830 } |
| 775 | 831 |
| 776 } // end of namespace Ice | 832 } // end of namespace Ice |
| OLD | NEW |