src/share/vm/opto/subnode.hpp

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

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 #ifndef PRODUCT
aoqi@0 279 void dump_on(outputStream *st) const;
aoqi@0 280 #endif
aoqi@0 281 };
aoqi@0 282
aoqi@0 283 //------------------------------BoolNode---------------------------------------
aoqi@0 284 // A Node to convert a Condition Codes to a Logical result.
aoqi@0 285 class BoolNode : public Node {
aoqi@0 286 virtual uint hash() const;
aoqi@0 287 virtual uint cmp( const Node &n ) const;
aoqi@0 288 virtual uint size_of() const;
aoqi@0 289 public:
aoqi@0 290 const BoolTest _test;
aoqi@0 291 BoolNode( Node *cc, BoolTest::mask t): _test(t), Node(0,cc) {
aoqi@0 292 init_class_id(Class_Bool);
aoqi@0 293 }
aoqi@0 294 // Convert an arbitrary int value to a Bool or other suitable predicate.
aoqi@0 295 static Node* make_predicate(Node* test_value, PhaseGVN* phase);
aoqi@0 296 // Convert self back to an integer value.
aoqi@0 297 Node* as_int_value(PhaseGVN* phase);
aoqi@0 298 // Invert sense of self, returning new Bool.
aoqi@0 299 BoolNode* negate(PhaseGVN* phase);
aoqi@0 300 virtual int Opcode() const;
aoqi@0 301 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 302 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 303 virtual const Type *bottom_type() const { return TypeInt::BOOL; }
aoqi@0 304 uint match_edge(uint idx) const { return 0; }
aoqi@0 305 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 306
aoqi@0 307 bool is_counted_loop_exit_test();
aoqi@0 308 #ifndef PRODUCT
aoqi@0 309 virtual void dump_spec(outputStream *st) const;
aoqi@0 310 #endif
aoqi@0 311 };
aoqi@0 312
aoqi@0 313 //------------------------------AbsNode----------------------------------------
aoqi@0 314 // Abstract class for absolute value. Mostly used to get a handy wrapper
aoqi@0 315 // for finding this pattern in the graph.
aoqi@0 316 class AbsNode : public Node {
aoqi@0 317 public:
aoqi@0 318 AbsNode( Node *value ) : Node(0,value) {}
aoqi@0 319 };
aoqi@0 320
aoqi@0 321 //------------------------------AbsINode---------------------------------------
aoqi@0 322 // Absolute value an integer. Since a naive graph involves control flow, we
aoqi@0 323 // "match" it in the ideal world (so the control flow can be removed).
aoqi@0 324 class AbsINode : public AbsNode {
aoqi@0 325 public:
aoqi@0 326 AbsINode( Node *in1 ) : AbsNode(in1) {}
aoqi@0 327 virtual int Opcode() const;
aoqi@0 328 const Type *bottom_type() const { return TypeInt::INT; }
aoqi@0 329 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 330 };
aoqi@0 331
aoqi@0 332 //------------------------------AbsFNode---------------------------------------
aoqi@0 333 // Absolute value a float, a common float-point idiom with a cheap hardware
aoqi@0 334 // implemention on most chips. Since a naive graph involves control flow, we
aoqi@0 335 // "match" it in the ideal world (so the control flow can be removed).
aoqi@0 336 class AbsFNode : public AbsNode {
aoqi@0 337 public:
aoqi@0 338 AbsFNode( Node *in1 ) : AbsNode(in1) {}
aoqi@0 339 virtual int Opcode() const;
aoqi@0 340 const Type *bottom_type() const { return Type::FLOAT; }
aoqi@0 341 virtual uint ideal_reg() const { return Op_RegF; }
aoqi@0 342 };
aoqi@0 343
aoqi@0 344 //------------------------------AbsDNode---------------------------------------
aoqi@0 345 // Absolute value a double, a common float-point idiom with a cheap hardware
aoqi@0 346 // implemention on most chips. Since a naive graph involves control flow, we
aoqi@0 347 // "match" it in the ideal world (so the control flow can be removed).
aoqi@0 348 class AbsDNode : public AbsNode {
aoqi@0 349 public:
aoqi@0 350 AbsDNode( Node *in1 ) : AbsNode(in1) {}
aoqi@0 351 virtual int Opcode() const;
aoqi@0 352 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 353 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 354 };
aoqi@0 355
aoqi@0 356
aoqi@0 357 //------------------------------CmpLTMaskNode----------------------------------
aoqi@0 358 // If p < q, return -1 else return 0. Nice for flow-free idioms.
aoqi@0 359 class CmpLTMaskNode : public Node {
aoqi@0 360 public:
aoqi@0 361 CmpLTMaskNode( Node *p, Node *q ) : Node(0, p, q) {}
aoqi@0 362 virtual int Opcode() const;
aoqi@0 363 const Type *bottom_type() const { return TypeInt::INT; }
aoqi@0 364 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 365 };
aoqi@0 366
aoqi@0 367
aoqi@0 368 //------------------------------NegNode----------------------------------------
aoqi@0 369 class NegNode : public Node {
aoqi@0 370 public:
aoqi@0 371 NegNode( Node *in1 ) : Node(0,in1) {}
aoqi@0 372 };
aoqi@0 373
aoqi@0 374 //------------------------------NegFNode---------------------------------------
aoqi@0 375 // Negate value a float. Negating 0.0 returns -0.0, but subtracting from
aoqi@0 376 // zero returns +0.0 (per JVM spec on 'fneg' bytecode). As subtraction
aoqi@0 377 // cannot be used to replace negation we have to implement negation as ideal
aoqi@0 378 // node; note that negation and addition can replace subtraction.
aoqi@0 379 class NegFNode : public NegNode {
aoqi@0 380 public:
aoqi@0 381 NegFNode( Node *in1 ) : NegNode(in1) {}
aoqi@0 382 virtual int Opcode() const;
aoqi@0 383 const Type *bottom_type() const { return Type::FLOAT; }
aoqi@0 384 virtual uint ideal_reg() const { return Op_RegF; }
aoqi@0 385 };
aoqi@0 386
aoqi@0 387 //------------------------------NegDNode---------------------------------------
aoqi@0 388 // Negate value a double. Negating 0.0 returns -0.0, but subtracting from
aoqi@0 389 // zero returns +0.0 (per JVM spec on 'dneg' bytecode). As subtraction
aoqi@0 390 // cannot be used to replace negation we have to implement negation as ideal
aoqi@0 391 // node; note that negation and addition can replace subtraction.
aoqi@0 392 class NegDNode : public NegNode {
aoqi@0 393 public:
aoqi@0 394 NegDNode( Node *in1 ) : NegNode(in1) {}
aoqi@0 395 virtual int Opcode() const;
aoqi@0 396 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 397 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 398 };
aoqi@0 399
aoqi@0 400 //------------------------------CosDNode---------------------------------------
aoqi@0 401 // Cosinus of a double
aoqi@0 402 class CosDNode : public Node {
aoqi@0 403 public:
aoqi@0 404 CosDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
aoqi@0 405 init_flags(Flag_is_expensive);
aoqi@0 406 C->add_expensive_node(this);
aoqi@0 407 }
aoqi@0 408 virtual int Opcode() const;
aoqi@0 409 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 410 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 411 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 412 };
aoqi@0 413
aoqi@0 414 //------------------------------CosDNode---------------------------------------
aoqi@0 415 // Sinus of a double
aoqi@0 416 class SinDNode : public Node {
aoqi@0 417 public:
aoqi@0 418 SinDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
aoqi@0 419 init_flags(Flag_is_expensive);
aoqi@0 420 C->add_expensive_node(this);
aoqi@0 421 }
aoqi@0 422 virtual int Opcode() const;
aoqi@0 423 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 424 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 425 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 426 };
aoqi@0 427
aoqi@0 428
aoqi@0 429 //------------------------------TanDNode---------------------------------------
aoqi@0 430 // tangens of a double
aoqi@0 431 class TanDNode : public Node {
aoqi@0 432 public:
aoqi@0 433 TanDNode(Compile* C, Node *c,Node *in1) : Node(c, in1) {
aoqi@0 434 init_flags(Flag_is_expensive);
aoqi@0 435 C->add_expensive_node(this);
aoqi@0 436 }
aoqi@0 437 virtual int Opcode() const;
aoqi@0 438 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 439 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 440 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 441 };
aoqi@0 442
aoqi@0 443
aoqi@0 444 //------------------------------AtanDNode--------------------------------------
aoqi@0 445 // arcus tangens of a double
aoqi@0 446 class AtanDNode : public Node {
aoqi@0 447 public:
aoqi@0 448 AtanDNode(Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {}
aoqi@0 449 virtual int Opcode() const;
aoqi@0 450 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 451 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 452 };
aoqi@0 453
aoqi@0 454
aoqi@0 455 //------------------------------SqrtDNode--------------------------------------
aoqi@0 456 // square root a double
aoqi@0 457 class SqrtDNode : public Node {
aoqi@0 458 public:
aoqi@0 459 SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
aoqi@0 460 init_flags(Flag_is_expensive);
aoqi@0 461 C->add_expensive_node(this);
aoqi@0 462 }
aoqi@0 463 virtual int Opcode() const;
aoqi@0 464 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 465 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 466 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 467 };
aoqi@0 468
aoqi@0 469 //------------------------------ExpDNode---------------------------------------
aoqi@0 470 // Exponentiate a double
aoqi@0 471 class ExpDNode : public Node {
aoqi@0 472 public:
aoqi@0 473 ExpDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
aoqi@0 474 init_flags(Flag_is_expensive);
aoqi@0 475 C->add_expensive_node(this);
aoqi@0 476 }
aoqi@0 477 virtual int Opcode() const;
aoqi@0 478 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 479 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 480 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 481 };
aoqi@0 482
aoqi@0 483 //------------------------------LogDNode---------------------------------------
aoqi@0 484 // Log_e of a double
aoqi@0 485 class LogDNode : public Node {
aoqi@0 486 public:
aoqi@0 487 LogDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
aoqi@0 488 init_flags(Flag_is_expensive);
aoqi@0 489 C->add_expensive_node(this);
aoqi@0 490 }
aoqi@0 491 virtual int Opcode() const;
aoqi@0 492 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 493 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 494 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 495 };
aoqi@0 496
aoqi@0 497 //------------------------------Log10DNode---------------------------------------
aoqi@0 498 // Log_10 of a double
aoqi@0 499 class Log10DNode : public Node {
aoqi@0 500 public:
aoqi@0 501 Log10DNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
aoqi@0 502 init_flags(Flag_is_expensive);
aoqi@0 503 C->add_expensive_node(this);
aoqi@0 504 }
aoqi@0 505 virtual int Opcode() const;
aoqi@0 506 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 507 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 508 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 509 };
aoqi@0 510
aoqi@0 511 //------------------------------PowDNode---------------------------------------
aoqi@0 512 // Raise a double to a double power
aoqi@0 513 class PowDNode : public Node {
aoqi@0 514 public:
aoqi@0 515 PowDNode(Compile* C, Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {
aoqi@0 516 init_flags(Flag_is_expensive);
aoqi@0 517 C->add_expensive_node(this);
aoqi@0 518 }
aoqi@0 519 virtual int Opcode() const;
aoqi@0 520 const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 521 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 522 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 523 };
aoqi@0 524
aoqi@0 525 //-------------------------------ReverseBytesINode--------------------------------
aoqi@0 526 // reverse bytes of an integer
aoqi@0 527 class ReverseBytesINode : public Node {
aoqi@0 528 public:
aoqi@0 529 ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {}
aoqi@0 530 virtual int Opcode() const;
aoqi@0 531 const Type *bottom_type() const { return TypeInt::INT; }
aoqi@0 532 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 533 };
aoqi@0 534
aoqi@0 535 //-------------------------------ReverseBytesLNode--------------------------------
aoqi@0 536 // reverse bytes of a long
aoqi@0 537 class ReverseBytesLNode : public Node {
aoqi@0 538 public:
aoqi@0 539 ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {}
aoqi@0 540 virtual int Opcode() const;
aoqi@0 541 const Type *bottom_type() const { return TypeLong::LONG; }
aoqi@0 542 virtual uint ideal_reg() const { return Op_RegL; }
aoqi@0 543 };
aoqi@0 544
aoqi@0 545 //-------------------------------ReverseBytesUSNode--------------------------------
aoqi@0 546 // reverse bytes of an unsigned short / char
aoqi@0 547 class ReverseBytesUSNode : public Node {
aoqi@0 548 public:
aoqi@0 549 ReverseBytesUSNode(Node *c, Node *in1) : Node(c, in1) {}
aoqi@0 550 virtual int Opcode() const;
aoqi@0 551 const Type *bottom_type() const { return TypeInt::CHAR; }
aoqi@0 552 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 553 };
aoqi@0 554
aoqi@0 555 //-------------------------------ReverseBytesSNode--------------------------------
aoqi@0 556 // reverse bytes of a short
aoqi@0 557 class ReverseBytesSNode : public Node {
aoqi@0 558 public:
aoqi@0 559 ReverseBytesSNode(Node *c, Node *in1) : Node(c, in1) {}
aoqi@0 560 virtual int Opcode() const;
aoqi@0 561 const Type *bottom_type() const { return TypeInt::SHORT; }
aoqi@0 562 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 563 };
aoqi@0 564
aoqi@0 565 #endif // SHARE_VM_OPTO_SUBNODE_HPP

mercurial