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