Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/node.hpp @ 3842:c7b60b601eb4
7069452: Cleanup NodeFlags
Summary: Remove flags which duplicate information in Node::NodeClasses.
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 27 Jul 2011 17:28:36 -0700 |
parents | e3cbc9ddd434 |
children | 95134e034042 |
comparison
equal
deleted
inserted
replaced
3841:0f34fdee809e | 3842:c7b60b601eb4 |
---|---|
65 class DecodeNNode; | 65 class DecodeNNode; |
66 class EncodePNode; | 66 class EncodePNode; |
67 class FastLockNode; | 67 class FastLockNode; |
68 class FastUnlockNode; | 68 class FastUnlockNode; |
69 class IfNode; | 69 class IfNode; |
70 class IfFalseNode; | |
71 class IfTrueNode; | |
70 class InitializeNode; | 72 class InitializeNode; |
71 class JVMState; | 73 class JVMState; |
72 class JumpNode; | 74 class JumpNode; |
73 class JumpProjNode; | 75 class JumpProjNode; |
74 class LoadNode; | 76 class LoadNode; |
81 class MachCallNode; | 83 class MachCallNode; |
82 class MachCallRuntimeNode; | 84 class MachCallRuntimeNode; |
83 class MachCallStaticJavaNode; | 85 class MachCallStaticJavaNode; |
84 class MachConstantBaseNode; | 86 class MachConstantBaseNode; |
85 class MachConstantNode; | 87 class MachConstantNode; |
88 class MachGotoNode; | |
86 class MachIfNode; | 89 class MachIfNode; |
87 class MachNode; | 90 class MachNode; |
88 class MachNullCheckNode; | 91 class MachNullCheckNode; |
92 class MachProjNode; | |
89 class MachReturnNode; | 93 class MachReturnNode; |
90 class MachSafePointNode; | 94 class MachSafePointNode; |
91 class MachSpillCopyNode; | 95 class MachSpillCopyNode; |
92 class MachTempNode; | 96 class MachTempNode; |
93 class Matcher; | 97 class Matcher; |
94 class MemBarNode; | 98 class MemBarNode; |
95 class MemNode; | 99 class MemNode; |
96 class MergeMemNode; | 100 class MergeMemNode; |
97 class MulNode; | |
98 class MultiNode; | 101 class MultiNode; |
99 class MultiBranchNode; | 102 class MultiBranchNode; |
100 class NeverBranchNode; | 103 class NeverBranchNode; |
101 class Node; | 104 class Node; |
102 class Node_Array; | 105 class Node_Array; |
125 class StoreNode; | 128 class StoreNode; |
126 class SubNode; | 129 class SubNode; |
127 class Type; | 130 class Type; |
128 class TypeNode; | 131 class TypeNode; |
129 class UnlockNode; | 132 class UnlockNode; |
133 class VectorNode; | |
134 class VectorLoadNode; | |
135 class VectorStoreNode; | |
130 class VectorSet; | 136 class VectorSet; |
131 class IfTrueNode; | |
132 class IfFalseNode; | |
133 typedef void (*NFunc)(Node&,void*); | 137 typedef void (*NFunc)(Node&,void*); |
134 extern "C" { | 138 extern "C" { |
135 typedef int (*C_sort_func_t)(const void *, const void *); | 139 typedef int (*C_sort_func_t)(const void *, const void *); |
136 } | 140 } |
137 | 141 |
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; |
667 | 669 |
668 // Virtual inherited Node size | 670 // Virtual inherited Node size |
669 virtual uint size_of() const; | 671 virtual uint size_of() const; |
670 | 672 |
671 // Other interesting Node properties | 673 // Other interesting Node properties |
672 | |
673 // Special case: is_Call() returns true for both CallNode and MachCallNode. | |
674 bool is_Call() const { | |
675 return (_flags & Flag_is_Call) != 0; | |
676 } | |
677 | |
678 CallNode* isa_Call() const { | |
679 return is_Call() ? as_Call() : NULL; | |
680 } | |
681 | |
682 CallNode *as_Call() const { // Only for CallNode (not for MachCallNode) | |
683 assert((_class_id & ClassMask_Call) == Class_Call, "invalid node class"); | |
684 return (CallNode*)this; | |
685 } | |
686 | |
687 #define DEFINE_CLASS_QUERY(type) \ | 674 #define DEFINE_CLASS_QUERY(type) \ |
688 bool is_##type() const { \ | 675 bool is_##type() const { \ |
689 return ((_class_id & ClassMask_##type) == Class_##type); \ | 676 return ((_class_id & ClassMask_##type) == Class_##type); \ |
690 } \ | 677 } \ |
691 type##Node *as_##type() const { \ | 678 type##Node *as_##type() const { \ |
701 DEFINE_CLASS_QUERY(AddP) | 688 DEFINE_CLASS_QUERY(AddP) |
702 DEFINE_CLASS_QUERY(Allocate) | 689 DEFINE_CLASS_QUERY(Allocate) |
703 DEFINE_CLASS_QUERY(AllocateArray) | 690 DEFINE_CLASS_QUERY(AllocateArray) |
704 DEFINE_CLASS_QUERY(Bool) | 691 DEFINE_CLASS_QUERY(Bool) |
705 DEFINE_CLASS_QUERY(BoxLock) | 692 DEFINE_CLASS_QUERY(BoxLock) |
693 DEFINE_CLASS_QUERY(Call) | |
706 DEFINE_CLASS_QUERY(CallDynamicJava) | 694 DEFINE_CLASS_QUERY(CallDynamicJava) |
707 DEFINE_CLASS_QUERY(CallJava) | 695 DEFINE_CLASS_QUERY(CallJava) |
708 DEFINE_CLASS_QUERY(CallLeaf) | 696 DEFINE_CLASS_QUERY(CallLeaf) |
709 DEFINE_CLASS_QUERY(CallRuntime) | 697 DEFINE_CLASS_QUERY(CallRuntime) |
710 DEFINE_CLASS_QUERY(CallStaticJava) | 698 DEFINE_CLASS_QUERY(CallStaticJava) |
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) |
762 DEFINE_CLASS_QUERY(SafePointScalarObject) | 751 DEFINE_CLASS_QUERY(SafePointScalarObject) |
763 DEFINE_CLASS_QUERY(Start) | 752 DEFINE_CLASS_QUERY(Start) |
764 DEFINE_CLASS_QUERY(Store) | 753 DEFINE_CLASS_QUERY(Store) |
765 DEFINE_CLASS_QUERY(Sub) | 754 DEFINE_CLASS_QUERY(Sub) |
766 DEFINE_CLASS_QUERY(Type) | 755 DEFINE_CLASS_QUERY(Type) |
756 DEFINE_CLASS_QUERY(Vector) | |
757 DEFINE_CLASS_QUERY(VectorLoad) | |
758 DEFINE_CLASS_QUERY(VectorStore) | |
767 DEFINE_CLASS_QUERY(Unlock) | 759 DEFINE_CLASS_QUERY(Unlock) |
768 | 760 |
769 #undef DEFINE_CLASS_QUERY | 761 #undef DEFINE_CLASS_QUERY |
770 | 762 |
771 // duplicate of is_MachSpillCopy() | 763 // duplicate of is_MachSpillCopy() |
772 bool is_SpillCopy () const { | 764 bool is_SpillCopy () const { |
773 return ((_class_id & ClassMask_MachSpillCopy) == Class_MachSpillCopy); | 765 return ((_class_id & ClassMask_MachSpillCopy) == Class_MachSpillCopy); |
774 } | 766 } |
775 | 767 |
776 bool is_Con () const { return (_flags & Flag_is_Con) != 0; } | 768 bool is_Con () const { return (_flags & Flag_is_Con) != 0; } |
777 bool is_Goto() const { return (_flags & Flag_is_Goto) != 0; } | |
778 // The data node which is safe to leave in dead loop during IGVN optimization. | 769 // The data node which is safe to leave in dead loop during IGVN optimization. |
779 bool is_dead_loop_safe() const { | 770 bool is_dead_loop_safe() const { |
780 return is_Phi() || (is_Proj() && in(0) == NULL) || | 771 return is_Phi() || (is_Proj() && in(0) == NULL) || |
781 ((_flags & (Flag_is_dead_loop_safe | Flag_is_Con)) != 0 && | 772 ((_flags & (Flag_is_dead_loop_safe | Flag_is_Con)) != 0 && |
782 (!is_Proj() || !in(0)->is_Allocate())); | 773 (!is_Proj() || !in(0)->is_Allocate())); |
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; |