886
887 //=============================================================================
888 // note that these functions assume that the _adr_type field is flattened
889 uint PhiNode::hash() const {
890 const Type* at = _adr_type;
891 return TypeNode::hash() + (at ? at->hash() : 0);
892 }
893 bool PhiNode::cmp( const Node &n ) const {
894 return TypeNode::cmp(n) && _adr_type == ((PhiNode&)n)._adr_type;
895 }
896 static inline
897 const TypePtr* flatten_phi_adr_type(const TypePtr* at) {
898 if (at == NULL || at == TypePtr::BOTTOM) return at;
899 return Compile::current()->alias_type(at)->adr_type();
900 }
901
902 //----------------------------make---------------------------------------------
903 // create a new phi with edges matching r and set (initially) to x
904 PhiNode* PhiNode::make(Node* r, Node* x, const Type *t, const TypePtr* at) {
905 uint preds = r->req(); // Number of predecessor paths
906 assert(t != Type::MEMORY || at == flatten_phi_adr_type(at), "flatten at");
907 PhiNode* p = new PhiNode(r, t, at);
908 for (uint j = 1; j < preds; j++) {
909 // Fill in all inputs, except those which the region does not yet have
910 if (r->in(j) != NULL)
911 p->init_req(j, x);
912 }
913 return p;
914 }
915 PhiNode* PhiNode::make(Node* r, Node* x) {
916 const Type* t = x->bottom_type();
917 const TypePtr* at = NULL;
918 if (t == Type::MEMORY) at = flatten_phi_adr_type(x->adr_type());
919 return make(r, x, t, at);
920 }
921 PhiNode* PhiNode::make_blank(Node* r, Node* x) {
922 const Type* t = x->bottom_type();
923 const TypePtr* at = NULL;
924 if (t == Type::MEMORY) at = flatten_phi_adr_type(x->adr_type());
925 return new PhiNode(r, t, at);
926 }
|
886
887 //=============================================================================
888 // note that these functions assume that the _adr_type field is flattened
889 uint PhiNode::hash() const {
890 const Type* at = _adr_type;
891 return TypeNode::hash() + (at ? at->hash() : 0);
892 }
893 bool PhiNode::cmp( const Node &n ) const {
894 return TypeNode::cmp(n) && _adr_type == ((PhiNode&)n)._adr_type;
895 }
896 static inline
897 const TypePtr* flatten_phi_adr_type(const TypePtr* at) {
898 if (at == NULL || at == TypePtr::BOTTOM) return at;
899 return Compile::current()->alias_type(at)->adr_type();
900 }
901
902 //----------------------------make---------------------------------------------
903 // create a new phi with edges matching r and set (initially) to x
904 PhiNode* PhiNode::make(Node* r, Node* x, const Type *t, const TypePtr* at) {
905 uint preds = r->req(); // Number of predecessor paths
906 assert(t != Type::MEMORY || at == flatten_phi_adr_type(at) || (flatten_phi_adr_type(at) == TypeAryPtr::VALUES && Compile::current()->flattened_accesses_share_alias()), "flatten at");
907 PhiNode* p = new PhiNode(r, t, at);
908 for (uint j = 1; j < preds; j++) {
909 // Fill in all inputs, except those which the region does not yet have
910 if (r->in(j) != NULL)
911 p->init_req(j, x);
912 }
913 return p;
914 }
915 PhiNode* PhiNode::make(Node* r, Node* x) {
916 const Type* t = x->bottom_type();
917 const TypePtr* at = NULL;
918 if (t == Type::MEMORY) at = flatten_phi_adr_type(x->adr_type());
919 return make(r, x, t, at);
920 }
921 PhiNode* PhiNode::make_blank(Node* r, Node* x) {
922 const Type* t = x->bottom_type();
923 const TypePtr* at = NULL;
924 if (t == Type::MEMORY) at = flatten_phi_adr_type(x->adr_type());
925 return new PhiNode(r, t, at);
926 }
|