1 /*
2 * Copyright (c) 1997, 2005, 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 // Optimization - Graph Style
28
29
30 //------------------------------DivINode---------------------------------------
31 // Integer division
32 // Note: this is division as defined by JVMS, i.e., MinInt/-1 == MinInt.
33 // On processors which don't naturally support this special case (e.g., x86),
34 // the matcher or runtime system must take care of this.
35 class DivINode : public Node {
36 public:
37 DivINode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {}
38 virtual int Opcode() const;
39 virtual Node *Identity( PhaseTransform *phase );
40 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
41 virtual const Type *Value( PhaseTransform *phase ) const;
42 virtual const Type *bottom_type() const { return TypeInt::INT; }
43 virtual uint ideal_reg() const { return Op_RegI; }
44 };
158 virtual int Opcode() const;
159 virtual const Type *bottom_type() const { return TypeTuple::INT_PAIR; }
160 virtual Node *match( const ProjNode *proj, const Matcher *m );
161
162 // Make a divmod and associated projections from a div or mod.
163 static DivModINode* make(Compile* C, Node* div_or_mod);
164 };
165
166 //------------------------------DivModLNode---------------------------------------
167 // Long division with remainder result.
168 class DivModLNode : public DivModNode {
169 public:
170 DivModLNode( Node *c, Node *dividend, Node *divisor ) : DivModNode(c, dividend, divisor) {}
171 virtual int Opcode() const;
172 virtual const Type *bottom_type() const { return TypeTuple::LONG_PAIR; }
173 virtual Node *match( const ProjNode *proj, const Matcher *m );
174
175 // Make a divmod and associated projections from a div or mod.
176 static DivModLNode* make(Compile* C, Node* div_or_mod);
177 };
|
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_DIVNODE_HPP
26 #define SHARE_VM_OPTO_DIVNODE_HPP
27
28 #include "opto/multnode.hpp"
29 #include "opto/node.hpp"
30 #include "opto/opcodes.hpp"
31 #include "opto/type.hpp"
32
33 // Portions of code courtesy of Clifford Click
34
35 // Optimization - Graph Style
36
37
38 //------------------------------DivINode---------------------------------------
39 // Integer division
40 // Note: this is division as defined by JVMS, i.e., MinInt/-1 == MinInt.
41 // On processors which don't naturally support this special case (e.g., x86),
42 // the matcher or runtime system must take care of this.
43 class DivINode : public Node {
44 public:
45 DivINode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {}
46 virtual int Opcode() const;
47 virtual Node *Identity( PhaseTransform *phase );
48 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
49 virtual const Type *Value( PhaseTransform *phase ) const;
50 virtual const Type *bottom_type() const { return TypeInt::INT; }
51 virtual uint ideal_reg() const { return Op_RegI; }
52 };
166 virtual int Opcode() const;
167 virtual const Type *bottom_type() const { return TypeTuple::INT_PAIR; }
168 virtual Node *match( const ProjNode *proj, const Matcher *m );
169
170 // Make a divmod and associated projections from a div or mod.
171 static DivModINode* make(Compile* C, Node* div_or_mod);
172 };
173
174 //------------------------------DivModLNode---------------------------------------
175 // Long division with remainder result.
176 class DivModLNode : public DivModNode {
177 public:
178 DivModLNode( Node *c, Node *dividend, Node *divisor ) : DivModNode(c, dividend, divisor) {}
179 virtual int Opcode() const;
180 virtual const Type *bottom_type() const { return TypeTuple::LONG_PAIR; }
181 virtual Node *match( const ProjNode *proj, const Matcher *m );
182
183 // Make a divmod and associated projections from a div or mod.
184 static DivModLNode* make(Compile* C, Node* div_or_mod);
185 };
186
187 #endif // SHARE_VM_OPTO_DIVNODE_HPP
|