/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_OPTO_SUBNODE_HPP
#define SHARE_VM_OPTO_SUBNODE_HPP
#include "opto/opcodes.hpp"
// Portions of code courtesy of Clifford Click
//------------------------------SUBNode----------------------------------------
// Class SUBTRACTION functionality. This covers all the usual 'subtract'
// behaviors. Subtract-integer, -float, -double, binary xor, compare-integer,
// -float, and -double are all inherited from this class. The compare
// functions behave like subtract functions, except that all negative answers
// are compressed into -1, and all positive answers compressed to 1.
public:
}
// Handle algebraic identities here. If we have an identity, return the Node
// we are equivalent to. We look for "add of zero" as an identity.
// Compute a new Type for this node. Basically we just do the pre-check,
// then call the virtual add() to set the type.
// Supplied function returns the subtractend of the inputs.
// This also type-checks the inputs for sanity. Guaranteed never to
// be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
// Supplied function to return the additive identity type.
// This is returned whenever the subtracts inputs are the same.
};
// NOTE: SubINode should be taken away and replaced by add and negate
//------------------------------SubINode---------------------------------------
// Subtract 2 integers
public:
virtual int Opcode() const;
};
//------------------------------SubLNode---------------------------------------
// Subtract 2 integers
public:
virtual int Opcode() const;
};
// NOTE: SubFPNode should be taken away and replaced by add and negate
//------------------------------SubFPNode--------------------------------------
// Subtract 2 floats or doubles
protected:
public:
};
// NOTE: SubFNode should be taken away and replaced by add and negate
//------------------------------SubFNode---------------------------------------
// Subtract 2 doubles
public:
virtual int Opcode() const;
};
// NOTE: SubDNode should be taken away and replaced by add and negate
//------------------------------SubDNode---------------------------------------
// Subtract 2 doubles
public:
virtual int Opcode() const;
};
//------------------------------CmpNode---------------------------------------
// Compare 2 values, returning condition codes (-1, 0 or 1).
public:
}
};
//------------------------------CmpINode---------------------------------------
// Compare 2 signed values, returning condition codes (-1, 0 or 1).
public:
virtual int Opcode() const;
};
//------------------------------CmpUNode---------------------------------------
// Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1).
public:
virtual int Opcode() const;
bool is_index_range_check() const;
};
//------------------------------CmpPNode---------------------------------------
// Compare 2 pointer values, returning condition codes (-1, 0 or 1).
public:
virtual int Opcode() const;
};
//------------------------------CmpNNode--------------------------------------
// Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
public:
virtual int Opcode() const;
};
//------------------------------CmpLNode---------------------------------------
// Compare 2 long values, returning condition codes (-1, 0 or 1).
public:
virtual int Opcode() const;
};
//------------------------------CmpL3Node--------------------------------------
// Compare 2 long values, returning integer value (-1, 0 or 1).
public:
// Since it is not consumed by Bools, it is not really a Cmp.
}
virtual int Opcode() const;
};
//------------------------------CmpFNode---------------------------------------
// Compare 2 float values, returning condition codes (-1, 0 or 1).
// This implements the Java bytecode fcmpl, so unordered returns -1.
// Operands may not commute.
public:
virtual int Opcode() const;
};
//------------------------------CmpF3Node--------------------------------------
// Compare 2 float values, returning integer value (-1, 0 or 1).
// This implements the Java bytecode fcmpl, so unordered returns -1.
// Operands may not commute.
public:
// Since it is not consumed by Bools, it is not really a Cmp.
}
virtual int Opcode() const;
// Since it is not consumed by Bools, it is not really a Cmp.
};
//------------------------------CmpDNode---------------------------------------
// Compare 2 double values, returning condition codes (-1, 0 or 1).
// This implements the Java bytecode dcmpl, so unordered returns -1.
// Operands may not commute.
public:
virtual int Opcode() const;
};
//------------------------------CmpD3Node--------------------------------------
// Compare 2 double values, returning integer value (-1, 0 or 1).
// This implements the Java bytecode dcmpl, so unordered returns -1.
// Operands may not commute.
public:
// Since it is not consumed by Bools, it is not really a Cmp.
}
virtual int Opcode() const;
};
//------------------------------BoolTest---------------------------------------
// Convert condition codes to a boolean test value (0 or -1).
// We pick the values as 3 bits; the low order 2 bits we compare against the
// condition codes, the high bit flips the sense of the result.
// Commute the test. I use a small table lookup. The table is created as
// a simple char array where each element is the ASCII version of a 'mask'
// enum from above.
bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le); }
#ifndef PRODUCT
#endif
};
//------------------------------BoolNode---------------------------------------
// A Node to convert a Condition Codes to a Logical result.
public:
}
// Convert an arbitrary int value to a Bool or other suitable predicate.
// Convert self back to an integer value.
// Invert sense of self, returning new Bool.
virtual int Opcode() const;
bool is_counted_loop_exit_test();
#ifndef PRODUCT
#endif
};
//------------------------------AbsNode----------------------------------------
// Abstract class for absolute value. Mostly used to get a handy wrapper
// for finding this pattern in the graph.
public:
};
//------------------------------AbsINode---------------------------------------
// Absolute value an integer. Since a naive graph involves control flow, we
// "match" it in the ideal world (so the control flow can be removed).
public:
virtual int Opcode() const;
};
//------------------------------AbsFNode---------------------------------------
// Absolute value a float, a common float-point idiom with a cheap hardware
// implemention on most chips. Since a naive graph involves control flow, we
// "match" it in the ideal world (so the control flow can be removed).
public:
virtual int Opcode() const;
};
//------------------------------AbsDNode---------------------------------------
// Absolute value a double, a common float-point idiom with a cheap hardware
// implemention on most chips. Since a naive graph involves control flow, we
// "match" it in the ideal world (so the control flow can be removed).
public:
virtual int Opcode() const;
};
//------------------------------CmpLTMaskNode----------------------------------
// If p < q, return -1 else return 0. Nice for flow-free idioms.
public:
virtual int Opcode() const;
};
//------------------------------NegNode----------------------------------------
public:
};
//------------------------------NegFNode---------------------------------------
// Negate value a float. Negating 0.0 returns -0.0, but subtracting from
// zero returns +0.0 (per JVM spec on 'fneg' bytecode). As subtraction
// cannot be used to replace negation we have to implement negation as ideal
// node; note that negation and addition can replace subtraction.
public:
virtual int Opcode() const;
};
//------------------------------NegDNode---------------------------------------
// Negate value a double. Negating 0.0 returns -0.0, but subtracting from
// zero returns +0.0 (per JVM spec on 'dneg' bytecode). As subtraction
// cannot be used to replace negation we have to implement negation as ideal
// node; note that negation and addition can replace subtraction.
public:
virtual int Opcode() const;
};
//------------------------------CosDNode---------------------------------------
// Cosinus of a double
public:
C->add_expensive_node(this);
}
virtual int Opcode() const;
};
//------------------------------CosDNode---------------------------------------
// Sinus of a double
public:
C->add_expensive_node(this);
}
virtual int Opcode() const;
};
//------------------------------TanDNode---------------------------------------
// tangens of a double
public:
C->add_expensive_node(this);
}
virtual int Opcode() const;
};
//------------------------------AtanDNode--------------------------------------
// arcus tangens of a double
public:
virtual int Opcode() const;
};
//------------------------------SqrtDNode--------------------------------------
// square root a double
public:
C->add_expensive_node(this);
}
virtual int Opcode() const;
};
//------------------------------ExpDNode---------------------------------------
// Exponentiate a double
public:
C->add_expensive_node(this);
}
virtual int Opcode() const;
};
//------------------------------LogDNode---------------------------------------
// Log_e of a double
public:
C->add_expensive_node(this);
}
virtual int Opcode() const;
};
//------------------------------Log10DNode---------------------------------------
// Log_10 of a double
public:
C->add_expensive_node(this);
}
virtual int Opcode() const;
};
//------------------------------PowDNode---------------------------------------
// Raise a double to a double power
public:
C->add_expensive_node(this);
}
virtual int Opcode() const;
};
//-------------------------------ReverseBytesINode--------------------------------
// reverse bytes of an integer
public:
virtual int Opcode() const;
};
//-------------------------------ReverseBytesLNode--------------------------------
// reverse bytes of a long
public:
virtual int Opcode() const;
};
//-------------------------------ReverseBytesUSNode--------------------------------
// reverse bytes of an unsigned short / char
public:
virtual int Opcode() const;
};
//-------------------------------ReverseBytesSNode--------------------------------
// reverse bytes of a short
public:
virtual int Opcode() const;
};
#endif // SHARE_VM_OPTO_SUBNODE_HPP