subnode.hpp revision 4321
2362N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// Portions of code courtesy of Clifford Click 0N/A//------------------------------SUBNode---------------------------------------- 0N/A// Class SUBTRACTION functionality. This covers all the usual 'subtract' 0N/A// behaviors. Subtract-integer, -float, -double, binary xor, compare-integer, 0N/A// -float, and -double are all inherited from this class. The compare 0N/A// functions behave like subtract functions, except that all negative answers 0N/A// are compressed into -1, and all positive answers compressed to 1. 0N/A // Handle algebraic identities here. If we have an identity, return the Node 0N/A // we are equivalent to. We look for "add of zero" as an identity. 0N/A // Compute a new Type for this node. Basically we just do the pre-check, 0N/A // then call the virtual add() to set the type. 0N/A // Supplied function returns the subtractend of the inputs. 0N/A // This also type-checks the inputs for sanity. Guaranteed never to 0N/A // be passed a TOP or BOTTOM type, these are filtered out by a pre-check. 0N/A // Supplied function to return the additive identity type. 0N/A // This is returned whenever the subtracts inputs are the same. 0N/A// NOTE: SubINode should be taken away and replaced by add and negate 0N/A//------------------------------SubINode--------------------------------------- 0N/A// Subtract 2 integers 0N/A//------------------------------SubLNode--------------------------------------- 0N/A// Subtract 2 integers // NOTE: SubFPNode should be taken away and replaced by add and negate //------------------------------SubFPNode-------------------------------------- // Subtract 2 floats or doubles // NOTE: SubFNode should be taken away and replaced by add and negate //------------------------------SubFNode--------------------------------------- // NOTE: SubDNode should be taken away and replaced by add and negate //------------------------------SubDNode--------------------------------------- //------------------------------CmpNode--------------------------------------- // Compare 2 values, returning condition codes (-1, 0 or 1). //------------------------------CmpINode--------------------------------------- // Compare 2 signed values, returning condition codes (-1, 0 or 1). //------------------------------CmpUNode--------------------------------------- // Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1). //------------------------------CmpPNode--------------------------------------- // Compare 2 pointer values, returning condition codes (-1, 0 or 1). //------------------------------CmpNNode-------------------------------------- // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1). //------------------------------CmpLNode--------------------------------------- // Compare 2 long values, returning condition codes (-1, 0 or 1). //------------------------------CmpL3Node-------------------------------------- // Compare 2 long values, returning integer value (-1, 0 or 1). // Since it is not consumed by Bools, it is not really a Cmp. //------------------------------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. //------------------------------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. // Since it is not consumed by Bools, it is not really a Cmp. // 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. //------------------------------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. // Since it is not consumed by Bools, it is not really a Cmp. //------------------------------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' //------------------------------BoolNode--------------------------------------- // A Node to convert a Condition Codes to a Logical result. // 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. //------------------------------AbsNode---------------------------------------- // Abstract class for absolute value. Mostly used to get a handy wrapper // for finding this pattern in the graph. //------------------------------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). //------------------------------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). //------------------------------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). //------------------------------CmpLTMaskNode---------------------------------- // If p < q, return -1 else return 0. Nice for flow-free idioms. //------------------------------NegNode---------------------------------------- //------------------------------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. //------------------------------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. //------------------------------CosDNode--------------------------------------- //------------------------------CosDNode--------------------------------------- //------------------------------TanDNode--------------------------------------- //------------------------------AtanDNode-------------------------------------- // arcus tangens of a double //------------------------------SqrtDNode-------------------------------------- //------------------------------ExpDNode--------------------------------------- //------------------------------LogDNode--------------------------------------- //------------------------------Log10DNode--------------------------------------- //------------------------------PowDNode--------------------------------------- // Raise a double to a double power //-------------------------------ReverseBytesINode-------------------------------- // reverse bytes of an integer //-------------------------------ReverseBytesLNode-------------------------------- // reverse bytes of a long //-------------------------------ReverseBytesUSNode-------------------------------- // reverse bytes of an unsigned short / char //-------------------------------ReverseBytesSNode-------------------------------- // reverse bytes of a short #
endif // SHARE_VM_OPTO_SUBNODE_HPP