1 /*
2 * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // Portions of code courtesy of Clifford Click
26
27 class PhaseTransform;
28
29 //------------------------------MulNode----------------------------------------
30 // Classic MULTIPLY functionality. This covers all the usual 'multiply'
31 // behaviors for an algebraic ring. Multiply-integer, multiply-float,
32 // multiply-double, and binary-and are all inherited from this class. The
33 // various identity values are supplied by virtual functions.
34 class MulNode : public Node {
35 virtual uint hash() const;
36 public:
37 MulNode( Node *in1, Node *in2 ): Node(0,in1,in2) {
38 init_class_id(Class_Mul);
39 }
40
41 // Handle algebraic identities here. If we have an identity, return the Node
42 // we are equivalent to. We look for "add of zero" as an identity.
43 virtual Node *Identity( PhaseTransform *phase );
44
238 virtual int Opcode() const;
239 virtual Node *Identity( PhaseTransform *phase );
240 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
241 virtual const Type *Value( PhaseTransform *phase ) const;
242 const Type *bottom_type() const { return TypeInt::INT; }
243 virtual uint ideal_reg() const { return Op_RegI; }
244 };
245
246 //------------------------------URShiftLNode-----------------------------------
247 // Logical shift right
248 class URShiftLNode : public Node {
249 public:
250 URShiftLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
251 virtual int Opcode() const;
252 virtual Node *Identity( PhaseTransform *phase );
253 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
254 virtual const Type *Value( PhaseTransform *phase ) const;
255 const Type *bottom_type() const { return TypeLong::LONG; }
256 virtual uint ideal_reg() const { return Op_RegL; }
257 };
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OPTO_MULNODE_HPP
26 #define SHARE_VM_OPTO_MULNODE_HPP
27
28 #include "opto/node.hpp"
29 #include "opto/opcodes.hpp"
30 #include "opto/type.hpp"
31
32 // Portions of code courtesy of Clifford Click
33
34 class PhaseTransform;
35
36 //------------------------------MulNode----------------------------------------
37 // Classic MULTIPLY functionality. This covers all the usual 'multiply'
38 // behaviors for an algebraic ring. Multiply-integer, multiply-float,
39 // multiply-double, and binary-and are all inherited from this class. The
40 // various identity values are supplied by virtual functions.
41 class MulNode : public Node {
42 virtual uint hash() const;
43 public:
44 MulNode( Node *in1, Node *in2 ): Node(0,in1,in2) {
45 init_class_id(Class_Mul);
46 }
47
48 // Handle algebraic identities here. If we have an identity, return the Node
49 // we are equivalent to. We look for "add of zero" as an identity.
50 virtual Node *Identity( PhaseTransform *phase );
51
245 virtual int Opcode() const;
246 virtual Node *Identity( PhaseTransform *phase );
247 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
248 virtual const Type *Value( PhaseTransform *phase ) const;
249 const Type *bottom_type() const { return TypeInt::INT; }
250 virtual uint ideal_reg() const { return Op_RegI; }
251 };
252
253 //------------------------------URShiftLNode-----------------------------------
254 // Logical shift right
255 class URShiftLNode : public Node {
256 public:
257 URShiftLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
258 virtual int Opcode() const;
259 virtual Node *Identity( PhaseTransform *phase );
260 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
261 virtual const Type *Value( PhaseTransform *phase ) const;
262 const Type *bottom_type() const { return TypeLong::LONG; }
263 virtual uint ideal_reg() const { return Op_RegL; }
264 };
265
266 #endif // SHARE_VM_OPTO_MULNODE_HPP
|