|
20 | 20 | *******************************************************************************/
|
21 | 21 |
|
22 | 22 | #include "il/IL.hpp"
|
| 23 | +#include "il/ILOps.hpp" |
23 | 24 | #include "il/ILOpCodes.hpp"
|
24 | 25 | #include "infra/Assert.hpp"
|
25 | 26 |
|
@@ -652,6 +653,102 @@ OMR::IL::opCodeForCorrespondingIndirectStore(TR::ILOpCodes storeOpCode)
|
652 | 653 | return TR::BadILOp;
|
653 | 654 | }
|
654 | 655 |
|
| 656 | +TR::IL* |
| 657 | +OMR::IL::self() |
| 658 | + { |
| 659 | + return static_cast<TR::IL*>(this); |
| 660 | + } |
| 661 | + |
| 662 | +TR::ILOpCodes |
| 663 | +OMR::IL::opCodeForCorrespondingLoadOrStore(TR::ILOpCodes opCodes) |
| 664 | + { |
| 665 | + TR::ILOpCode opCode(opCodes); |
| 666 | + |
| 667 | + if (opCode.isLoadIndirect()) |
| 668 | + return self()->opCodeForCorrespondingIndirectLoad(opCodes); |
| 669 | + else if (opCode.isLoadDirect()) |
| 670 | + return self()->opCodeForCorrespondingDirectLoad(opCodes); |
| 671 | + else if (opCode.isStoreIndirect()) |
| 672 | + return self()->opCodeForCorrespondingIndirectStore(opCodes); |
| 673 | + else if (opCode.isStoreDirect()) |
| 674 | + return self()->opCodeForCorrespondingDirectStore(opCodes); |
| 675 | + |
| 676 | + TR_ASSERT_FATAL(0, "opCode is not load or store"); |
| 677 | + return TR::BadILOp; |
| 678 | + } |
| 679 | + |
| 680 | +TR::ILOpCodes |
| 681 | +OMR::IL::opCodeForCorrespondingDirectLoad(TR::ILOpCodes loadOpCode) |
| 682 | + { |
| 683 | + switch (loadOpCode) |
| 684 | + { |
| 685 | + case TR::bload: return TR::bstore; |
| 686 | + case TR::sload: return TR::sstore; |
| 687 | + case TR::iload: return TR::istore; |
| 688 | + case TR::lload: return TR::lstore; |
| 689 | + case TR::fload: return TR::fstore; |
| 690 | + case TR::dload: return TR::dstore; |
| 691 | + case TR::aload: return TR::astore; |
| 692 | + case TR::vload: return TR::vstore; |
| 693 | + case TR::cload: return TR::cstore; |
| 694 | + case TR::buload: return TR::bstore; |
| 695 | + case TR::iuload: return TR::istore; |
| 696 | + case TR::luload: return TR::lstore; |
| 697 | + case TR::brdbar: |
| 698 | + case TR::srdbar: |
| 699 | + case TR::irdbar: |
| 700 | + case TR::lrdbar: |
| 701 | + case TR::frdbar: |
| 702 | + case TR::drdbar: |
| 703 | + case TR::ardbar: |
| 704 | + //There is not necessarily a guaranteed symmetry about whether an direct rdbar should be mapped to |
| 705 | + //an direct wrtbar or a normal direct store. The mapping of rdbar/ wrtbar totally depends on the |
| 706 | + //actual use in subprojects and should be undefined in OMR level. |
| 707 | + TR_ASSERT_FATAL(0, "xrdbar can't be used with global opcode mapping API at OMR level\n"); |
| 708 | + default: break; |
| 709 | + } |
| 710 | + |
| 711 | + TR_ASSERT_FATAL(0, "no corresponding store opcode for specified load opcode"); |
| 712 | + return TR::BadILOp; |
| 713 | + } |
| 714 | + |
| 715 | + |
| 716 | +TR::ILOpCodes |
| 717 | +OMR::IL::opCodeForCorrespondingDirectStore(TR::ILOpCodes storeOpCode) |
| 718 | + { |
| 719 | + switch (storeOpCode) |
| 720 | + { |
| 721 | + case TR::bstore: return TR::bload; |
| 722 | + case TR::sstore: return TR::sload; |
| 723 | + case TR::istore: return TR::iload; |
| 724 | + case TR::lstore: return TR::lload; |
| 725 | + case TR::fstore: return TR::fload; |
| 726 | + case TR::dstore: return TR::dload; |
| 727 | + case TR::astore: return TR::aload; |
| 728 | + case TR::awrtbar: return TR::aload; |
| 729 | + case TR::vstore: return TR::vload; |
| 730 | + case TR::cstore: return TR::sload; |
| 731 | + case TR::bustore: return TR::bload; |
| 732 | + case TR::iustore: return TR::iload; |
| 733 | + case TR::lustore: return TR::lload; |
| 734 | + case TR::bwrtbar: |
| 735 | + case TR::swrtbar: |
| 736 | + case TR::iwrtbar: |
| 737 | + case TR::lwrtbar: |
| 738 | + case TR::fwrtbar: |
| 739 | + case TR::dwrtbar: |
| 740 | + //There is not necessarily a guaranteed symmetry about whether an direct wrtbar should be mapped to |
| 741 | + //an direct rdbar or a normal direct load. The mapping of rdbar/wrtbar totally depends on the |
| 742 | + //actual use in subprojects and should be undefined in OMR level. |
| 743 | + TR_ASSERT_FATAL(0, "xwrtbar can't be used with global opcode mapping API at OMR level\n"); |
| 744 | + |
| 745 | + default: break; |
| 746 | + } |
| 747 | + |
| 748 | + TR_ASSERT_FATAL(0, "no corresponding load opcode for specified store opcode"); |
| 749 | + return TR::BadILOp; |
| 750 | + } |
| 751 | + |
655 | 752 | TR::ILOpCodes
|
656 | 753 | OMR::IL::opCodeForSelect(TR::DataType dt)
|
657 | 754 | {
|
|
0 commit comments