94 if (in1->eqv_uncast(in2)) return add_id();
95
96 // Either input is BOTTOM ==> the result is the local BOTTOM
97 if( t1 == Type::BOTTOM || t2 == Type::BOTTOM )
98 return bottom_type();
99
100 return NULL;
101 }
102
103 const Type* SubNode::Value(PhaseGVN* phase) const {
104 const Type* t = Value_common(phase);
105 if (t != NULL) {
106 return t;
107 }
108 const Type* t1 = phase->type(in(1));
109 const Type* t2 = phase->type(in(2));
110 return sub(t1,t2); // Local flavor of type subtraction
111
112 }
113
114 //=============================================================================
115
116 //------------------------------Helper function--------------------------------
117 static bool ok_to_convert(Node* inc, Node* iv) {
118 // Do not collapse (x+c0)-y if "+" is a loop increment, because the
119 // "-" is loop invariant and collapsing extends the live-range of "x"
120 // to overlap with the "+", forcing another register to be used in
121 // the loop.
122 // This test will be clearer with '&&' (apply DeMorgan's rule)
123 // but I like the early cutouts that happen here.
124 const PhiNode *phi;
125 if( ( !inc->in(1)->is_Phi() ||
126 !(phi=inc->in(1)->as_Phi()) ||
127 phi->is_copy() ||
128 !phi->region()->is_CountedLoop() ||
129 inc != phi->region()->as_CountedLoop()->incr() )
130 &&
131 // Do not collapse (x+c0)-iv if "iv" is a loop induction variable,
132 // because "x" maybe invariant.
133 ( !iv->is_loop_iv() )
|
94 if (in1->eqv_uncast(in2)) return add_id();
95
96 // Either input is BOTTOM ==> the result is the local BOTTOM
97 if( t1 == Type::BOTTOM || t2 == Type::BOTTOM )
98 return bottom_type();
99
100 return NULL;
101 }
102
103 const Type* SubNode::Value(PhaseGVN* phase) const {
104 const Type* t = Value_common(phase);
105 if (t != NULL) {
106 return t;
107 }
108 const Type* t1 = phase->type(in(1));
109 const Type* t2 = phase->type(in(2));
110 return sub(t1,t2); // Local flavor of type subtraction
111
112 }
113
114 SubNode* SubNode::make(BasicType bt, Node *in1, Node *in2) {
115 switch(bt) {
116 case T_INT: return new SubINode(in1, in2);
117 case T_LONG: return new SubLNode(in1, in2);
118 case T_FLOAT: return new SubFNode(in1, in2);
119 case T_DOUBLE: return new SubDNode(in1, in2);
120 }
121 fatal("Bad basic type %s", type2name(bt));
122 return NULL;
123 }
124
125 //=============================================================================
126
127 //------------------------------Helper function--------------------------------
128 static bool ok_to_convert(Node* inc, Node* iv) {
129 // Do not collapse (x+c0)-y if "+" is a loop increment, because the
130 // "-" is loop invariant and collapsing extends the live-range of "x"
131 // to overlap with the "+", forcing another register to be used in
132 // the loop.
133 // This test will be clearer with '&&' (apply DeMorgan's rule)
134 // but I like the early cutouts that happen here.
135 const PhiNode *phi;
136 if( ( !inc->in(1)->is_Phi() ||
137 !(phi=inc->in(1)->as_Phi()) ||
138 phi->is_copy() ||
139 !phi->region()->is_CountedLoop() ||
140 inc != phi->region()->as_CountedLoop()->incr() )
141 &&
142 // Do not collapse (x+c0)-iv if "iv" is a loop induction variable,
143 // because "x" maybe invariant.
144 ( !iv->is_loop_iv() )
|