src/share/vm/opto/subnode.hpp

Tue, 17 Oct 2017 12:58:25 +0800

author
aoqi
date
Tue, 17 Oct 2017 12:58:25 +0800
changeset 7994
04ff2f6cd0eb
parent 7535
7ae4e26cb1e0
child 8856
ac27a9c85bea
permissions
-rw-r--r--

merge

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

mercurial