150 bool OverflowMulINode::can_overflow(const Type* t1, const Type* t2) const {
151 return MulHelper<OverflowMulINode>::can_overflow(t1, t2);
152 }
153
154 bool OverflowAddLNode::can_overflow(const Type* t1, const Type* t2) const {
155 return AddHelper<OverflowAddLNode>::can_overflow(t1, t2);
156 }
157
158 bool OverflowSubLNode::can_overflow(const Type* t1, const Type* t2) const {
159 if (in(1) == in(2)) {
160 return false;
161 }
162 return SubHelper<OverflowSubLNode>::can_overflow(t1, t2);
163 }
164
165 bool OverflowMulLNode::can_overflow(const Type* t1, const Type* t2) const {
166 return MulHelper<OverflowMulLNode>::can_overflow(t1, t2);
167 }
168
169 const Type* OverflowNode::sub(const Type* t1, const Type* t2) const {
170 fatal(err_msg_res("sub() should not be called for '%s'", NodeClassNames[this->Opcode()]));
171 return TypeInt::CC;
172 }
173
174 template <typename OverflowOp>
175 struct IdealHelper {
176 typedef typename OverflowOp::TypeClass TypeClass; // TypeInt, TypeLong
177 typedef typename TypeClass::NativeType NativeType;
178
179 static Node* Ideal(const OverflowOp* node, PhaseGVN* phase, bool can_reshape) {
180 Node* arg1 = node->in(1);
181 Node* arg2 = node->in(2);
182 const Type* type1 = phase->type(arg1);
183 const Type* type2 = phase->type(arg2);
184
185 if (type1 == NULL || type2 == NULL) {
186 return NULL;
187 }
188
189 if (type1 != Type::TOP && type1->singleton() &&
190 type2 != Type::TOP && type2->singleton()) {
|
150 bool OverflowMulINode::can_overflow(const Type* t1, const Type* t2) const {
151 return MulHelper<OverflowMulINode>::can_overflow(t1, t2);
152 }
153
154 bool OverflowAddLNode::can_overflow(const Type* t1, const Type* t2) const {
155 return AddHelper<OverflowAddLNode>::can_overflow(t1, t2);
156 }
157
158 bool OverflowSubLNode::can_overflow(const Type* t1, const Type* t2) const {
159 if (in(1) == in(2)) {
160 return false;
161 }
162 return SubHelper<OverflowSubLNode>::can_overflow(t1, t2);
163 }
164
165 bool OverflowMulLNode::can_overflow(const Type* t1, const Type* t2) const {
166 return MulHelper<OverflowMulLNode>::can_overflow(t1, t2);
167 }
168
169 const Type* OverflowNode::sub(const Type* t1, const Type* t2) const {
170 fatal("sub() should not be called for '%s'", NodeClassNames[this->Opcode()]);
171 return TypeInt::CC;
172 }
173
174 template <typename OverflowOp>
175 struct IdealHelper {
176 typedef typename OverflowOp::TypeClass TypeClass; // TypeInt, TypeLong
177 typedef typename TypeClass::NativeType NativeType;
178
179 static Node* Ideal(const OverflowOp* node, PhaseGVN* phase, bool can_reshape) {
180 Node* arg1 = node->in(1);
181 Node* arg2 = node->in(2);
182 const Type* type1 = phase->type(arg1);
183 const Type* type2 = phase->type(arg2);
184
185 if (type1 == NULL || type2 == NULL) {
186 return NULL;
187 }
188
189 if (type1 != Type::TOP && type1->singleton() &&
190 type2 != Type::TOP && type2->singleton()) {
|