572 DEFINE_CLASS_ID(MachNullCheck, Mach, 2) |
576 DEFINE_CLASS_ID(MachNullCheck, Mach, 2) |
573 DEFINE_CLASS_ID(MachIf, Mach, 3) |
577 DEFINE_CLASS_ID(MachIf, Mach, 3) |
574 DEFINE_CLASS_ID(MachTemp, Mach, 4) |
578 DEFINE_CLASS_ID(MachTemp, Mach, 4) |
575 DEFINE_CLASS_ID(MachConstantBase, Mach, 5) |
579 DEFINE_CLASS_ID(MachConstantBase, Mach, 5) |
576 DEFINE_CLASS_ID(MachConstant, Mach, 6) |
580 DEFINE_CLASS_ID(MachConstant, Mach, 6) |
577 |
581 DEFINE_CLASS_ID(MachGoto, Mach, 7) |
578 DEFINE_CLASS_ID(Proj, Node, 2) |
582 |
579 DEFINE_CLASS_ID(CatchProj, Proj, 0) |
583 DEFINE_CLASS_ID(Type, Node, 2) |
580 DEFINE_CLASS_ID(JumpProj, Proj, 1) |
|
581 DEFINE_CLASS_ID(IfTrue, Proj, 2) |
|
582 DEFINE_CLASS_ID(IfFalse, Proj, 3) |
|
583 DEFINE_CLASS_ID(Parm, Proj, 4) |
|
584 |
|
585 DEFINE_CLASS_ID(Region, Node, 3) |
|
586 DEFINE_CLASS_ID(Loop, Region, 0) |
|
587 DEFINE_CLASS_ID(Root, Loop, 0) |
|
588 DEFINE_CLASS_ID(CountedLoop, Loop, 1) |
|
589 |
|
590 DEFINE_CLASS_ID(Sub, Node, 4) |
|
591 DEFINE_CLASS_ID(Cmp, Sub, 0) |
|
592 DEFINE_CLASS_ID(FastLock, Cmp, 0) |
|
593 DEFINE_CLASS_ID(FastUnlock, Cmp, 1) |
|
594 |
|
595 DEFINE_CLASS_ID(Type, Node, 5) |
|
596 DEFINE_CLASS_ID(Phi, Type, 0) |
584 DEFINE_CLASS_ID(Phi, Type, 0) |
597 DEFINE_CLASS_ID(ConstraintCast, Type, 1) |
585 DEFINE_CLASS_ID(ConstraintCast, Type, 1) |
598 DEFINE_CLASS_ID(CheckCastPP, Type, 2) |
586 DEFINE_CLASS_ID(CheckCastPP, Type, 2) |
599 DEFINE_CLASS_ID(CMove, Type, 3) |
587 DEFINE_CLASS_ID(CMove, Type, 3) |
600 DEFINE_CLASS_ID(SafePointScalarObject, Type, 4) |
588 DEFINE_CLASS_ID(SafePointScalarObject, Type, 4) |
601 DEFINE_CLASS_ID(DecodeN, Type, 5) |
589 DEFINE_CLASS_ID(DecodeN, Type, 5) |
602 DEFINE_CLASS_ID(EncodeP, Type, 6) |
590 DEFINE_CLASS_ID(EncodeP, Type, 6) |
603 |
591 |
604 DEFINE_CLASS_ID(Mem, Node, 6) |
592 DEFINE_CLASS_ID(Proj, Node, 3) |
|
593 DEFINE_CLASS_ID(CatchProj, Proj, 0) |
|
594 DEFINE_CLASS_ID(JumpProj, Proj, 1) |
|
595 DEFINE_CLASS_ID(IfTrue, Proj, 2) |
|
596 DEFINE_CLASS_ID(IfFalse, Proj, 3) |
|
597 DEFINE_CLASS_ID(Parm, Proj, 4) |
|
598 DEFINE_CLASS_ID(MachProj, Proj, 5) |
|
599 |
|
600 DEFINE_CLASS_ID(Mem, Node, 4) |
605 DEFINE_CLASS_ID(Load, Mem, 0) |
601 DEFINE_CLASS_ID(Load, Mem, 0) |
|
602 DEFINE_CLASS_ID(VectorLoad, Load, 0) |
606 DEFINE_CLASS_ID(Store, Mem, 1) |
603 DEFINE_CLASS_ID(Store, Mem, 1) |
|
604 DEFINE_CLASS_ID(VectorStore, Store, 0) |
607 DEFINE_CLASS_ID(LoadStore, Mem, 2) |
605 DEFINE_CLASS_ID(LoadStore, Mem, 2) |
|
606 |
|
607 DEFINE_CLASS_ID(Region, Node, 5) |
|
608 DEFINE_CLASS_ID(Loop, Region, 0) |
|
609 DEFINE_CLASS_ID(Root, Loop, 0) |
|
610 DEFINE_CLASS_ID(CountedLoop, Loop, 1) |
|
611 |
|
612 DEFINE_CLASS_ID(Sub, Node, 6) |
|
613 DEFINE_CLASS_ID(Cmp, Sub, 0) |
|
614 DEFINE_CLASS_ID(FastLock, Cmp, 0) |
|
615 DEFINE_CLASS_ID(FastUnlock, Cmp, 1) |
608 |
616 |
609 DEFINE_CLASS_ID(MergeMem, Node, 7) |
617 DEFINE_CLASS_ID(MergeMem, Node, 7) |
610 DEFINE_CLASS_ID(Bool, Node, 8) |
618 DEFINE_CLASS_ID(Bool, Node, 8) |
611 DEFINE_CLASS_ID(AddP, Node, 9) |
619 DEFINE_CLASS_ID(AddP, Node, 9) |
612 DEFINE_CLASS_ID(BoxLock, Node, 10) |
620 DEFINE_CLASS_ID(BoxLock, Node, 10) |
613 DEFINE_CLASS_ID(Add, Node, 11) |
621 DEFINE_CLASS_ID(Add, Node, 11) |
614 DEFINE_CLASS_ID(Mul, Node, 12) |
622 DEFINE_CLASS_ID(Vector, Node, 12) |
615 DEFINE_CLASS_ID(ClearArray, Node, 13) |
623 DEFINE_CLASS_ID(ClearArray, Node, 13) |
616 |
624 |
617 _max_classes = ClassMask_ClearArray |
625 _max_classes = ClassMask_ClearArray |
618 }; |
626 }; |
619 #undef DEFINE_CLASS_ID |
627 #undef DEFINE_CLASS_ID |
620 |
628 |
621 // Flags are sorted by usage frequency. |
629 // Flags are sorted by usage frequency. |
622 enum NodeFlags { |
630 enum NodeFlags { |
623 Flag_is_Copy = 0x01, // should be first bit to avoid shift |
631 Flag_is_Copy = 0x01, // should be first bit to avoid shift |
624 Flag_is_Call = Flag_is_Copy << 1, |
632 Flag_rematerialize = Flag_is_Copy << 1, |
625 Flag_rematerialize = Flag_is_Call << 1, |
|
626 Flag_needs_anti_dependence_check = Flag_rematerialize << 1, |
633 Flag_needs_anti_dependence_check = Flag_rematerialize << 1, |
627 Flag_is_macro = Flag_needs_anti_dependence_check << 1, |
634 Flag_is_macro = Flag_needs_anti_dependence_check << 1, |
628 Flag_is_Con = Flag_is_macro << 1, |
635 Flag_is_Con = Flag_is_macro << 1, |
629 Flag_is_cisc_alternate = Flag_is_Con << 1, |
636 Flag_is_cisc_alternate = Flag_is_Con << 1, |
630 Flag_is_Branch = Flag_is_cisc_alternate << 1, |
637 Flag_is_Branch = Flag_is_cisc_alternate << 1, |
631 Flag_is_block_start = Flag_is_Branch << 1, |
638 Flag_is_dead_loop_safe = Flag_is_Branch << 1, |
632 Flag_is_Goto = Flag_is_block_start << 1, |
|
633 Flag_is_dead_loop_safe = Flag_is_Goto << 1, |
|
634 Flag_may_be_short_branch = Flag_is_dead_loop_safe << 1, |
639 Flag_may_be_short_branch = Flag_is_dead_loop_safe << 1, |
635 Flag_is_safepoint_node = Flag_may_be_short_branch << 1, |
640 _max_flags = (Flag_may_be_short_branch << 1) - 1 // allow flags combination |
636 Flag_is_pc_relative = Flag_is_safepoint_node << 1, |
|
637 Flag_is_Vector = Flag_is_pc_relative << 1, |
|
638 _max_flags = (Flag_is_Vector << 1) - 1 // allow flags combination |
|
639 }; |
641 }; |
640 |
642 |
641 private: |
643 private: |
642 jushort _class_id; |
644 jushort _class_id; |
643 jushort _flags; |
645 jushort _flags; |
738 DEFINE_CLASS_QUERY(MachCallLeaf) |
726 DEFINE_CLASS_QUERY(MachCallLeaf) |
739 DEFINE_CLASS_QUERY(MachCallRuntime) |
727 DEFINE_CLASS_QUERY(MachCallRuntime) |
740 DEFINE_CLASS_QUERY(MachCallStaticJava) |
728 DEFINE_CLASS_QUERY(MachCallStaticJava) |
741 DEFINE_CLASS_QUERY(MachConstantBase) |
729 DEFINE_CLASS_QUERY(MachConstantBase) |
742 DEFINE_CLASS_QUERY(MachConstant) |
730 DEFINE_CLASS_QUERY(MachConstant) |
|
731 DEFINE_CLASS_QUERY(MachGoto) |
743 DEFINE_CLASS_QUERY(MachIf) |
732 DEFINE_CLASS_QUERY(MachIf) |
744 DEFINE_CLASS_QUERY(MachNullCheck) |
733 DEFINE_CLASS_QUERY(MachNullCheck) |
|
734 DEFINE_CLASS_QUERY(MachProj) |
745 DEFINE_CLASS_QUERY(MachReturn) |
735 DEFINE_CLASS_QUERY(MachReturn) |
746 DEFINE_CLASS_QUERY(MachSafePoint) |
736 DEFINE_CLASS_QUERY(MachSafePoint) |
747 DEFINE_CLASS_QUERY(MachSpillCopy) |
737 DEFINE_CLASS_QUERY(MachSpillCopy) |
748 DEFINE_CLASS_QUERY(MachTemp) |
738 DEFINE_CLASS_QUERY(MachTemp) |
749 DEFINE_CLASS_QUERY(Mem) |
739 DEFINE_CLASS_QUERY(Mem) |
750 DEFINE_CLASS_QUERY(MemBar) |
740 DEFINE_CLASS_QUERY(MemBar) |
751 DEFINE_CLASS_QUERY(MergeMem) |
741 DEFINE_CLASS_QUERY(MergeMem) |
752 DEFINE_CLASS_QUERY(Mul) |
|
753 DEFINE_CLASS_QUERY(Multi) |
742 DEFINE_CLASS_QUERY(Multi) |
754 DEFINE_CLASS_QUERY(MultiBranch) |
743 DEFINE_CLASS_QUERY(MultiBranch) |
755 DEFINE_CLASS_QUERY(Parm) |
744 DEFINE_CLASS_QUERY(Parm) |
756 DEFINE_CLASS_QUERY(PCTable) |
745 DEFINE_CLASS_QUERY(PCTable) |
757 DEFINE_CLASS_QUERY(Phi) |
746 DEFINE_CLASS_QUERY(Phi) |
793 // depend for their correct sequencing on more than one test. |
784 // depend for their correct sequencing on more than one test. |
794 // (In that case, hoisting to a dominating test may silently |
785 // (In that case, hoisting to a dominating test may silently |
795 // skip some other important test.) |
786 // skip some other important test.) |
796 virtual bool depends_only_on_test() const { assert(!is_CFG(), ""); return true; }; |
787 virtual bool depends_only_on_test() const { assert(!is_CFG(), ""); return true; }; |
797 |
788 |
798 // defined for MachNodes that match 'If' | 'Goto' | 'CountedLoopEnd' |
789 // defined for MachNodes that match 'If' | 'Goto' | 'CountedLoopEnd' | 'Jump' |
799 bool is_Branch() const { return (_flags & Flag_is_Branch) != 0; } |
790 bool is_Branch() const { return (_flags & Flag_is_Branch) != 0; } |
800 |
791 |
801 // When building basic blocks, I need to have a notion of block beginning |
792 // When building basic blocks, I need to have a notion of block beginning |
802 // Nodes, next block selector Nodes (block enders), and next block |
793 // Nodes, next block selector Nodes (block enders), and next block |
803 // projections. These calls need to work on their machine equivalents. The |
794 // projections. These calls need to work on their machine equivalents. The |
804 // Ideal beginning Nodes are RootNode, RegionNode and StartNode. |
795 // Ideal beginning Nodes are RootNode, RegionNode and StartNode. |
805 bool is_block_start() const { |
796 bool is_block_start() const { |
806 if ( is_Region() ) |
797 if ( is_Region() ) |
807 return this == (const Node*)in(0); |
798 return this == (const Node*)in(0); |
808 else |
799 else |
809 return (_flags & Flag_is_block_start) != 0; |
800 return is_Start(); |
810 } |
801 } |
811 |
802 |
812 // The Ideal control projection Nodes are IfTrue/IfFalse, JumpProjNode, Root, |
803 // The Ideal control projection Nodes are IfTrue/IfFalse, JumpProjNode, Root, |
813 // Goto and Return. This call also returns the block ending Node. |
804 // Goto and Return. This call also returns the block ending Node. |
814 virtual const Node *is_block_proj() const; |
805 virtual const Node *is_block_proj() const; |
815 |
806 |
816 // The node is a "macro" node which needs to be expanded before matching |
807 // The node is a "macro" node which needs to be expanded before matching |
817 bool is_macro() const { return (_flags & Flag_is_macro) != 0; } |
808 bool is_macro() const { return (_flags & Flag_is_macro) != 0; } |
818 |
|
819 // Value is a vector of primitive values |
|
820 bool is_Vector() const { return (_flags & Flag_is_Vector) != 0; } |
|
821 |
809 |
822 //----------------- Optimization |
810 //----------------- Optimization |
823 |
811 |
824 // Get the worst-case Type output for this Node. |
812 // Get the worst-case Type output for this Node. |
825 virtual const class Type *bottom_type() const; |
813 virtual const class Type *bottom_type() const; |