author | iveresov |
Thu, 22 Jan 2015 11:25:23 -0800 | |
changeset 28723 | 0a36120cb225 |
parent 27708 | 8a8710cb8fc4 |
child 30183 | a6588c0a3259 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
22234
da823d78ad65
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
20289
diff
changeset
|
2 |
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5352
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5352
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5352
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_OPTO_SUBNODE_HPP |
26 |
#define SHARE_VM_OPTO_SUBNODE_HPP |
|
27 |
||
28 |
#include "opto/node.hpp" |
|
29 |
#include "opto/opcodes.hpp" |
|
30 |
#include "opto/type.hpp" |
|
31 |
||
1 | 32 |
// Portions of code courtesy of Clifford Click |
33 |
||
34 |
//------------------------------SUBNode---------------------------------------- |
|
35 |
// Class SUBTRACTION functionality. This covers all the usual 'subtract' |
|
36 |
// behaviors. Subtract-integer, -float, -double, binary xor, compare-integer, |
|
37 |
// -float, and -double are all inherited from this class. The compare |
|
38 |
// functions behave like subtract functions, except that all negative answers |
|
39 |
// are compressed into -1, and all positive answers compressed to 1. |
|
40 |
class SubNode : public Node { |
|
41 |
public: |
|
42 |
SubNode( Node *in1, Node *in2 ) : Node(0,in1,in2) { |
|
43 |
init_class_id(Class_Sub); |
|
44 |
} |
|
45 |
||
46 |
// Handle algebraic identities here. If we have an identity, return the Node |
|
47 |
// we are equivalent to. We look for "add of zero" as an identity. |
|
48 |
virtual Node *Identity( PhaseTransform *phase ); |
|
49 |
||
50 |
// Compute a new Type for this node. Basically we just do the pre-check, |
|
51 |
// then call the virtual add() to set the type. |
|
52 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
24479 | 53 |
const Type* Value_common( PhaseTransform *phase ) const; |
1 | 54 |
|
55 |
// Supplied function returns the subtractend of the inputs. |
|
56 |
// This also type-checks the inputs for sanity. Guaranteed never to |
|
57 |
// be passed a TOP or BOTTOM type, these are filtered out by a pre-check. |
|
58 |
virtual const Type *sub( const Type *, const Type * ) const = 0; |
|
59 |
||
60 |
// Supplied function to return the additive identity type. |
|
61 |
// This is returned whenever the subtracts inputs are the same. |
|
62 |
virtual const Type *add_id() const = 0; |
|
63 |
||
64 |
}; |
|
65 |
||
66 |
||
67 |
// NOTE: SubINode should be taken away and replaced by add and negate |
|
68 |
//------------------------------SubINode--------------------------------------- |
|
69 |
// Subtract 2 integers |
|
70 |
class SubINode : public SubNode { |
|
71 |
public: |
|
72 |
SubINode( Node *in1, Node *in2 ) : SubNode(in1,in2) {} |
|
73 |
virtual int Opcode() const; |
|
74 |
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
75 |
virtual const Type *sub( const Type *, const Type * ) const; |
|
76 |
const Type *add_id() const { return TypeInt::ZERO; } |
|
77 |
const Type *bottom_type() const { return TypeInt::INT; } |
|
78 |
virtual uint ideal_reg() const { return Op_RegI; } |
|
79 |
}; |
|
80 |
||
81 |
//------------------------------SubLNode--------------------------------------- |
|
82 |
// Subtract 2 integers |
|
83 |
class SubLNode : public SubNode { |
|
84 |
public: |
|
85 |
SubLNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {} |
|
86 |
virtual int Opcode() const; |
|
87 |
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
88 |
virtual const Type *sub( const Type *, const Type * ) const; |
|
89 |
const Type *add_id() const { return TypeLong::ZERO; } |
|
90 |
const Type *bottom_type() const { return TypeLong::LONG; } |
|
91 |
virtual uint ideal_reg() const { return Op_RegL; } |
|
92 |
}; |
|
93 |
||
94 |
// NOTE: SubFPNode should be taken away and replaced by add and negate |
|
95 |
//------------------------------SubFPNode-------------------------------------- |
|
96 |
// Subtract 2 floats or doubles |
|
97 |
class SubFPNode : public SubNode { |
|
98 |
protected: |
|
99 |
SubFPNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {} |
|
100 |
public: |
|
101 |
const Type *Value( PhaseTransform *phase ) const; |
|
102 |
}; |
|
103 |
||
104 |
// NOTE: SubFNode should be taken away and replaced by add and negate |
|
105 |
//------------------------------SubFNode--------------------------------------- |
|
106 |
// Subtract 2 doubles |
|
107 |
class SubFNode : public SubFPNode { |
|
108 |
public: |
|
109 |
SubFNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {} |
|
110 |
virtual int Opcode() const; |
|
111 |
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
112 |
virtual const Type *sub( const Type *, const Type * ) const; |
|
113 |
const Type *add_id() const { return TypeF::ZERO; } |
|
114 |
const Type *bottom_type() const { return Type::FLOAT; } |
|
115 |
virtual uint ideal_reg() const { return Op_RegF; } |
|
116 |
}; |
|
117 |
||
118 |
// NOTE: SubDNode should be taken away and replaced by add and negate |
|
119 |
//------------------------------SubDNode--------------------------------------- |
|
120 |
// Subtract 2 doubles |
|
121 |
class SubDNode : public SubFPNode { |
|
122 |
public: |
|
123 |
SubDNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {} |
|
124 |
virtual int Opcode() const; |
|
125 |
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
126 |
virtual const Type *sub( const Type *, const Type * ) const; |
|
127 |
const Type *add_id() const { return TypeD::ZERO; } |
|
128 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
129 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
130 |
}; |
|
131 |
||
132 |
//------------------------------CmpNode--------------------------------------- |
|
133 |
// Compare 2 values, returning condition codes (-1, 0 or 1). |
|
134 |
class CmpNode : public SubNode { |
|
135 |
public: |
|
136 |
CmpNode( Node *in1, Node *in2 ) : SubNode(in1,in2) { |
|
137 |
init_class_id(Class_Cmp); |
|
138 |
} |
|
139 |
virtual Node *Identity( PhaseTransform *phase ); |
|
140 |
const Type *add_id() const { return TypeInt::ZERO; } |
|
141 |
const Type *bottom_type() const { return TypeInt::CC; } |
|
142 |
virtual uint ideal_reg() const { return Op_RegFlags; } |
|
143 |
}; |
|
144 |
||
145 |
//------------------------------CmpINode--------------------------------------- |
|
146 |
// Compare 2 signed values, returning condition codes (-1, 0 or 1). |
|
147 |
class CmpINode : public CmpNode { |
|
148 |
public: |
|
149 |
CmpINode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {} |
|
150 |
virtual int Opcode() const; |
|
151 |
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
152 |
virtual const Type *sub( const Type *, const Type * ) const; |
|
153 |
}; |
|
154 |
||
155 |
//------------------------------CmpUNode--------------------------------------- |
|
156 |
// Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1). |
|
157 |
class CmpUNode : public CmpNode { |
|
158 |
public: |
|
159 |
CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {} |
|
160 |
virtual int Opcode() const; |
|
161 |
virtual const Type *sub( const Type *, const Type * ) const; |
|
24479 | 162 |
const Type *Value( PhaseTransform *phase ) const; |
13205
5495b63764bf
7181658: CTW: assert(t->meet(t0) == t) failed: Not monotonic
kvn
parents:
9439
diff
changeset
|
163 |
bool is_index_range_check() const; |
1 | 164 |
}; |
165 |
||
166 |
//------------------------------CmpPNode--------------------------------------- |
|
167 |
// Compare 2 pointer values, returning condition codes (-1, 0 or 1). |
|
168 |
class CmpPNode : public CmpNode { |
|
169 |
public: |
|
170 |
CmpPNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {} |
|
171 |
virtual int Opcode() const; |
|
172 |
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
173 |
virtual const Type *sub( const Type *, const Type * ) const; |
|
174 |
}; |
|
175 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
176 |
//------------------------------CmpNNode-------------------------------------- |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
177 |
// Compare 2 narrow oop values, returning condition codes (-1, 0 or 1). |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
178 |
class CmpNNode : public CmpNode { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
179 |
public: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
180 |
CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
181 |
virtual int Opcode() const; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
182 |
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
183 |
virtual const Type *sub( const Type *, const Type * ) const; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
184 |
}; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
185 |
|
1 | 186 |
//------------------------------CmpLNode--------------------------------------- |
187 |
// Compare 2 long values, returning condition codes (-1, 0 or 1). |
|
188 |
class CmpLNode : public CmpNode { |
|
189 |
public: |
|
190 |
CmpLNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {} |
|
191 |
virtual int Opcode() const; |
|
192 |
virtual const Type *sub( const Type *, const Type * ) const; |
|
193 |
}; |
|
194 |
||
195 |
//------------------------------CmpL3Node-------------------------------------- |
|
196 |
// Compare 2 long values, returning integer value (-1, 0 or 1). |
|
197 |
class CmpL3Node : public CmpLNode { |
|
198 |
public: |
|
199 |
CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) { |
|
200 |
// Since it is not consumed by Bools, it is not really a Cmp. |
|
201 |
init_class_id(Class_Sub); |
|
202 |
} |
|
203 |
virtual int Opcode() const; |
|
204 |
virtual uint ideal_reg() const { return Op_RegI; } |
|
205 |
}; |
|
206 |
||
207 |
//------------------------------CmpFNode--------------------------------------- |
|
208 |
// Compare 2 float values, returning condition codes (-1, 0 or 1). |
|
209 |
// This implements the Java bytecode fcmpl, so unordered returns -1. |
|
210 |
// Operands may not commute. |
|
211 |
class CmpFNode : public CmpNode { |
|
212 |
public: |
|
213 |
CmpFNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {} |
|
214 |
virtual int Opcode() const; |
|
215 |
virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; } |
|
216 |
const Type *Value( PhaseTransform *phase ) const; |
|
217 |
}; |
|
218 |
||
219 |
//------------------------------CmpF3Node-------------------------------------- |
|
220 |
// Compare 2 float values, returning integer value (-1, 0 or 1). |
|
221 |
// This implements the Java bytecode fcmpl, so unordered returns -1. |
|
222 |
// Operands may not commute. |
|
223 |
class CmpF3Node : public CmpFNode { |
|
224 |
public: |
|
225 |
CmpF3Node( Node *in1, Node *in2 ) : CmpFNode(in1,in2) { |
|
226 |
// Since it is not consumed by Bools, it is not really a Cmp. |
|
227 |
init_class_id(Class_Sub); |
|
228 |
} |
|
229 |
virtual int Opcode() const; |
|
230 |
// Since it is not consumed by Bools, it is not really a Cmp. |
|
231 |
virtual uint ideal_reg() const { return Op_RegI; } |
|
232 |
}; |
|
233 |
||
234 |
||
235 |
//------------------------------CmpDNode--------------------------------------- |
|
236 |
// Compare 2 double values, returning condition codes (-1, 0 or 1). |
|
237 |
// This implements the Java bytecode dcmpl, so unordered returns -1. |
|
238 |
// Operands may not commute. |
|
239 |
class CmpDNode : public CmpNode { |
|
240 |
public: |
|
241 |
CmpDNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {} |
|
242 |
virtual int Opcode() const; |
|
243 |
virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; } |
|
244 |
const Type *Value( PhaseTransform *phase ) const; |
|
245 |
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
246 |
}; |
|
247 |
||
248 |
//------------------------------CmpD3Node-------------------------------------- |
|
249 |
// Compare 2 double values, returning integer value (-1, 0 or 1). |
|
250 |
// This implements the Java bytecode dcmpl, so unordered returns -1. |
|
251 |
// Operands may not commute. |
|
252 |
class CmpD3Node : public CmpDNode { |
|
253 |
public: |
|
254 |
CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) { |
|
255 |
// Since it is not consumed by Bools, it is not really a Cmp. |
|
256 |
init_class_id(Class_Sub); |
|
257 |
} |
|
258 |
virtual int Opcode() const; |
|
259 |
virtual uint ideal_reg() const { return Op_RegI; } |
|
260 |
}; |
|
261 |
||
262 |
||
263 |
//------------------------------BoolTest--------------------------------------- |
|
264 |
// Convert condition codes to a boolean test value (0 or -1). |
|
265 |
// We pick the values as 3 bits; the low order 2 bits we compare against the |
|
266 |
// condition codes, the high bit flips the sense of the result. |
|
267 |
struct BoolTest VALUE_OBJ_CLASS_SPEC { |
|
20289 | 268 |
enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, illegal = 8 }; |
1 | 269 |
mask _test; |
270 |
BoolTest( mask btm ) : _test(btm) {} |
|
271 |
const Type *cc2logical( const Type *CC ) const; |
|
272 |
// Commute the test. I use a small table lookup. The table is created as |
|
273 |
// a simple char array where each element is the ASCII version of a 'mask' |
|
274 |
// enum from above. |
|
20289 | 275 |
mask commute( ) const { return mask("032147658"[_test]-'0'); } |
1 | 276 |
mask negate( ) const { return mask(_test^4); } |
20289 | 277 |
bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); } |
1 | 278 |
void dump_on(outputStream *st) const; |
279 |
}; |
|
280 |
||
281 |
//------------------------------BoolNode--------------------------------------- |
|
282 |
// A Node to convert a Condition Codes to a Logical result. |
|
283 |
class BoolNode : public Node { |
|
284 |
virtual uint hash() const; |
|
285 |
virtual uint cmp( const Node &n ) const; |
|
286 |
virtual uint size_of() const; |
|
26165 | 287 |
|
288 |
// Try to optimize signed integer comparison |
|
289 |
Node* fold_cmpI(PhaseGVN* phase, SubNode* cmp, Node* cmp1, int cmp_op, |
|
290 |
int cmp1_op, const TypeInt* cmp2_type); |
|
1 | 291 |
public: |
292 |
const BoolTest _test; |
|
293 |
BoolNode( Node *cc, BoolTest::mask t): _test(t), Node(0,cc) { |
|
294 |
init_class_id(Class_Bool); |
|
295 |
} |
|
296 |
// Convert an arbitrary int value to a Bool or other suitable predicate. |
|
297 |
static Node* make_predicate(Node* test_value, PhaseGVN* phase); |
|
298 |
// Convert self back to an integer value. |
|
299 |
Node* as_int_value(PhaseGVN* phase); |
|
300 |
// Invert sense of self, returning new Bool. |
|
301 |
BoolNode* negate(PhaseGVN* phase); |
|
302 |
virtual int Opcode() const; |
|
303 |
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
304 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
305 |
virtual const Type *bottom_type() const { return TypeInt::BOOL; } |
|
306 |
uint match_edge(uint idx) const { return 0; } |
|
307 |
virtual uint ideal_reg() const { return Op_RegI; } |
|
308 |
||
309 |
bool is_counted_loop_exit_test(); |
|
310 |
#ifndef PRODUCT |
|
311 |
virtual void dump_spec(outputStream *st) const; |
|
312 |
#endif |
|
313 |
}; |
|
314 |
||
315 |
//------------------------------AbsNode---------------------------------------- |
|
316 |
// Abstract class for absolute value. Mostly used to get a handy wrapper |
|
317 |
// for finding this pattern in the graph. |
|
318 |
class AbsNode : public Node { |
|
319 |
public: |
|
320 |
AbsNode( Node *value ) : Node(0,value) {} |
|
321 |
}; |
|
322 |
||
323 |
//------------------------------AbsINode--------------------------------------- |
|
324 |
// Absolute value an integer. Since a naive graph involves control flow, we |
|
325 |
// "match" it in the ideal world (so the control flow can be removed). |
|
326 |
class AbsINode : public AbsNode { |
|
327 |
public: |
|
328 |
AbsINode( Node *in1 ) : AbsNode(in1) {} |
|
329 |
virtual int Opcode() const; |
|
330 |
const Type *bottom_type() const { return TypeInt::INT; } |
|
331 |
virtual uint ideal_reg() const { return Op_RegI; } |
|
332 |
}; |
|
333 |
||
334 |
//------------------------------AbsFNode--------------------------------------- |
|
335 |
// Absolute value a float, a common float-point idiom with a cheap hardware |
|
336 |
// implemention on most chips. Since a naive graph involves control flow, we |
|
337 |
// "match" it in the ideal world (so the control flow can be removed). |
|
338 |
class AbsFNode : public AbsNode { |
|
339 |
public: |
|
340 |
AbsFNode( Node *in1 ) : AbsNode(in1) {} |
|
341 |
virtual int Opcode() const; |
|
342 |
const Type *bottom_type() const { return Type::FLOAT; } |
|
343 |
virtual uint ideal_reg() const { return Op_RegF; } |
|
344 |
}; |
|
345 |
||
346 |
//------------------------------AbsDNode--------------------------------------- |
|
347 |
// Absolute value a double, a common float-point idiom with a cheap hardware |
|
348 |
// implemention on most chips. Since a naive graph involves control flow, we |
|
349 |
// "match" it in the ideal world (so the control flow can be removed). |
|
350 |
class AbsDNode : public AbsNode { |
|
351 |
public: |
|
352 |
AbsDNode( Node *in1 ) : AbsNode(in1) {} |
|
353 |
virtual int Opcode() const; |
|
354 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
355 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
356 |
}; |
|
357 |
||
358 |
||
359 |
//------------------------------CmpLTMaskNode---------------------------------- |
|
360 |
// If p < q, return -1 else return 0. Nice for flow-free idioms. |
|
361 |
class CmpLTMaskNode : public Node { |
|
362 |
public: |
|
363 |
CmpLTMaskNode( Node *p, Node *q ) : Node(0, p, q) {} |
|
364 |
virtual int Opcode() const; |
|
365 |
const Type *bottom_type() const { return TypeInt::INT; } |
|
366 |
virtual uint ideal_reg() const { return Op_RegI; } |
|
367 |
}; |
|
368 |
||
369 |
||
370 |
//------------------------------NegNode---------------------------------------- |
|
371 |
class NegNode : public Node { |
|
372 |
public: |
|
373 |
NegNode( Node *in1 ) : Node(0,in1) {} |
|
374 |
}; |
|
375 |
||
376 |
//------------------------------NegFNode--------------------------------------- |
|
377 |
// Negate value a float. Negating 0.0 returns -0.0, but subtracting from |
|
378 |
// zero returns +0.0 (per JVM spec on 'fneg' bytecode). As subtraction |
|
379 |
// cannot be used to replace negation we have to implement negation as ideal |
|
380 |
// node; note that negation and addition can replace subtraction. |
|
381 |
class NegFNode : public NegNode { |
|
382 |
public: |
|
383 |
NegFNode( Node *in1 ) : NegNode(in1) {} |
|
384 |
virtual int Opcode() const; |
|
385 |
const Type *bottom_type() const { return Type::FLOAT; } |
|
386 |
virtual uint ideal_reg() const { return Op_RegF; } |
|
387 |
}; |
|
388 |
||
389 |
//------------------------------NegDNode--------------------------------------- |
|
390 |
// Negate value a double. Negating 0.0 returns -0.0, but subtracting from |
|
391 |
// zero returns +0.0 (per JVM spec on 'dneg' bytecode). As subtraction |
|
392 |
// cannot be used to replace negation we have to implement negation as ideal |
|
393 |
// node; note that negation and addition can replace subtraction. |
|
394 |
class NegDNode : public NegNode { |
|
395 |
public: |
|
396 |
NegDNode( Node *in1 ) : NegNode(in1) {} |
|
397 |
virtual int Opcode() const; |
|
398 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
399 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
400 |
}; |
|
401 |
||
402 |
//------------------------------CosDNode--------------------------------------- |
|
403 |
// Cosinus of a double |
|
404 |
class CosDNode : public Node { |
|
405 |
public: |
|
15752
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
406 |
CosDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
407 |
init_flags(Flag_is_expensive); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
408 |
C->add_expensive_node(this); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
409 |
} |
1 | 410 |
virtual int Opcode() const; |
411 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
412 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
413 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
414 |
}; |
|
415 |
||
416 |
//------------------------------CosDNode--------------------------------------- |
|
417 |
// Sinus of a double |
|
418 |
class SinDNode : public Node { |
|
419 |
public: |
|
15752
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
420 |
SinDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
421 |
init_flags(Flag_is_expensive); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
422 |
C->add_expensive_node(this); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
423 |
} |
1 | 424 |
virtual int Opcode() const; |
425 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
426 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
427 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
428 |
}; |
|
429 |
||
430 |
||
431 |
//------------------------------TanDNode--------------------------------------- |
|
432 |
// tangens of a double |
|
433 |
class TanDNode : public Node { |
|
434 |
public: |
|
15752
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
435 |
TanDNode(Compile* C, Node *c,Node *in1) : Node(c, in1) { |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
436 |
init_flags(Flag_is_expensive); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
437 |
C->add_expensive_node(this); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
438 |
} |
1 | 439 |
virtual int Opcode() const; |
440 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
441 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
442 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
443 |
}; |
|
444 |
||
445 |
||
446 |
//------------------------------AtanDNode-------------------------------------- |
|
447 |
// arcus tangens of a double |
|
448 |
class AtanDNode : public Node { |
|
449 |
public: |
|
450 |
AtanDNode(Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {} |
|
451 |
virtual int Opcode() const; |
|
452 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
453 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
454 |
}; |
|
455 |
||
456 |
||
457 |
//------------------------------SqrtDNode-------------------------------------- |
|
458 |
// square root a double |
|
459 |
class SqrtDNode : public Node { |
|
460 |
public: |
|
15752
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
461 |
SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
462 |
init_flags(Flag_is_expensive); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
463 |
C->add_expensive_node(this); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
464 |
} |
1 | 465 |
virtual int Opcode() const; |
466 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
467 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
468 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
469 |
}; |
|
470 |
||
471 |
//------------------------------ExpDNode--------------------------------------- |
|
472 |
// Exponentiate a double |
|
473 |
class ExpDNode : public Node { |
|
474 |
public: |
|
15618
3eb521896836
7197327: 40% regression on 8 b41 comp 8 b40 on specjvm2008.mpegaudio on oob
roland
parents:
13963
diff
changeset
|
475 |
ExpDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { |
3eb521896836
7197327: 40% regression on 8 b41 comp 8 b40 on specjvm2008.mpegaudio on oob
roland
parents:
13963
diff
changeset
|
476 |
init_flags(Flag_is_expensive); |
3eb521896836
7197327: 40% regression on 8 b41 comp 8 b40 on specjvm2008.mpegaudio on oob
roland
parents:
13963
diff
changeset
|
477 |
C->add_expensive_node(this); |
3eb521896836
7197327: 40% regression on 8 b41 comp 8 b40 on specjvm2008.mpegaudio on oob
roland
parents:
13963
diff
changeset
|
478 |
} |
1 | 479 |
virtual int Opcode() const; |
480 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
481 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
482 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
483 |
}; |
|
484 |
||
485 |
//------------------------------LogDNode--------------------------------------- |
|
486 |
// Log_e of a double |
|
487 |
class LogDNode : public Node { |
|
488 |
public: |
|
15752
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
489 |
LogDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
490 |
init_flags(Flag_is_expensive); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
491 |
C->add_expensive_node(this); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
492 |
} |
1 | 493 |
virtual int Opcode() const; |
494 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
495 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
496 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
497 |
}; |
|
498 |
||
499 |
//------------------------------Log10DNode--------------------------------------- |
|
500 |
// Log_10 of a double |
|
501 |
class Log10DNode : public Node { |
|
502 |
public: |
|
15752
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
503 |
Log10DNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
504 |
init_flags(Flag_is_expensive); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
505 |
C->add_expensive_node(this); |
9e5ee72bd9d2
8007959: Use expensive node logic for more math nodes
roland
parents:
15618
diff
changeset
|
506 |
} |
1 | 507 |
virtual int Opcode() const; |
508 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
509 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
510 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
511 |
}; |
|
512 |
||
513 |
//------------------------------PowDNode--------------------------------------- |
|
514 |
// Raise a double to a double power |
|
515 |
class PowDNode : public Node { |
|
516 |
public: |
|
15618
3eb521896836
7197327: 40% regression on 8 b41 comp 8 b40 on specjvm2008.mpegaudio on oob
roland
parents:
13963
diff
changeset
|
517 |
PowDNode(Compile* C, Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) { |
3eb521896836
7197327: 40% regression on 8 b41 comp 8 b40 on specjvm2008.mpegaudio on oob
roland
parents:
13963
diff
changeset
|
518 |
init_flags(Flag_is_expensive); |
3eb521896836
7197327: 40% regression on 8 b41 comp 8 b40 on specjvm2008.mpegaudio on oob
roland
parents:
13963
diff
changeset
|
519 |
C->add_expensive_node(this); |
3eb521896836
7197327: 40% regression on 8 b41 comp 8 b40 on specjvm2008.mpegaudio on oob
roland
parents:
13963
diff
changeset
|
520 |
} |
1 | 521 |
virtual int Opcode() const; |
522 |
const Type *bottom_type() const { return Type::DOUBLE; } |
|
523 |
virtual uint ideal_reg() const { return Op_RegD; } |
|
524 |
virtual const Type *Value( PhaseTransform *phase ) const; |
|
525 |
}; |
|
526 |
||
527 |
//-------------------------------ReverseBytesINode-------------------------------- |
|
528 |
// reverse bytes of an integer |
|
529 |
class ReverseBytesINode : public Node { |
|
530 |
public: |
|
531 |
ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {} |
|
532 |
virtual int Opcode() const; |
|
533 |
const Type *bottom_type() const { return TypeInt::INT; } |
|
534 |
virtual uint ideal_reg() const { return Op_RegI; } |
|
535 |
}; |
|
536 |
||
537 |
//-------------------------------ReverseBytesLNode-------------------------------- |
|
538 |
// reverse bytes of a long |
|
539 |
class ReverseBytesLNode : public Node { |
|
540 |
public: |
|
541 |
ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {} |
|
542 |
virtual int Opcode() const; |
|
543 |
const Type *bottom_type() const { return TypeLong::LONG; } |
|
544 |
virtual uint ideal_reg() const { return Op_RegL; } |
|
545 |
}; |
|
5352
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
546 |
|
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
547 |
//-------------------------------ReverseBytesUSNode-------------------------------- |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
548 |
// reverse bytes of an unsigned short / char |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
549 |
class ReverseBytesUSNode : public Node { |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
550 |
public: |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
551 |
ReverseBytesUSNode(Node *c, Node *in1) : Node(c, in1) {} |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
552 |
virtual int Opcode() const; |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
553 |
const Type *bottom_type() const { return TypeInt::CHAR; } |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
554 |
virtual uint ideal_reg() const { return Op_RegI; } |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
555 |
}; |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
556 |
|
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
557 |
//-------------------------------ReverseBytesSNode-------------------------------- |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
558 |
// reverse bytes of a short |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
559 |
class ReverseBytesSNode : public Node { |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
560 |
public: |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
561 |
ReverseBytesSNode(Node *c, Node *in1) : Node(c, in1) {} |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
562 |
virtual int Opcode() const; |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
563 |
const Type *bottom_type() const { return TypeInt::SHORT; } |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
564 |
virtual uint ideal_reg() const { return Op_RegI; } |
cee8f7acb7bc
6946040: add intrinsic for short and char reverseBytes
never
parents:
670
diff
changeset
|
565 |
}; |
7397 | 566 |
|
567 |
#endif // SHARE_VM_OPTO_SUBNODE_HPP |