addnode.hpp revision 0
/*
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// Portions of code courtesy of Clifford Click
class PhaseTransform;
//------------------------------AddNode----------------------------------------
// Classic Add functionality. This covers all the usual 'add' behaviors for
// an algebraic ring. Add-integer, add-float, add-double, and binary-or are
// all inherited from this class. The various identity values are supplied
// by virtual functions.
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.
// We also canonicalize the Node, moving constants to the right input,
// and flatten expressions (so that 1+x+2 becomes x+3).
// Compute a new Type for this node. Basically we just do the pre-check,
// then call the virtual add() to set the type.
// Check if this addition involves the additive identity
// Supplied function returns the sum 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
};
//------------------------------AddINode---------------------------------------
// Add 2 integers
public:
virtual int Opcode() const;
};
//------------------------------AddLNode---------------------------------------
// Add 2 longs
public:
virtual int Opcode() const;
};
//------------------------------AddFNode---------------------------------------
// Add 2 floats
public:
virtual int Opcode() const;
};
//------------------------------AddDNode---------------------------------------
// Add 2 doubles
public:
virtual int Opcode() const;
};
//------------------------------AddPNode---------------------------------------
// Add pointer plus integer to get pointer. NOT commutative, really.
// So not really an AddNode. Lives here, because people associate it with
// an add.
public:
enum { Control, // When is it safe to do this add?
Base, // Base oop, for GC purposes
Address, // Actually address, derived from base
Offset } ; // Offset added to address
}
virtual int Opcode() const;
virtual const Type *bottom_type() const;
// second return value:
// Do not match base-ptr edge
};
//------------------------------OrINode----------------------------------------
// Logically OR 2 integers. Included with the ADD nodes because it inherits
// all the behavior of addition on a ring.
public:
virtual int Opcode() const;
};
//------------------------------OrLNode----------------------------------------
// Logically OR 2 longs. Included with the ADD nodes because it inherits
// all the behavior of addition on a ring.
public:
virtual int Opcode() const;
};
//------------------------------XorINode---------------------------------------
// XOR'ing 2 integers
public:
virtual int Opcode() const;
};
//------------------------------XorINode---------------------------------------
// XOR'ing 2 longs
public:
virtual int Opcode() const;
};
//------------------------------MaxNode----------------------------------------
// Max (or min) of 2 values. Included with the ADD nodes because it inherits
// all the behavior of addition on a ring. Only new thing is that we allow
// 2 equal inputs to be equal.
public:
virtual int Opcode() const = 0;
};
//------------------------------MaxINode---------------------------------------
// Maximum of 2 integers. Included with the ADD nodes because it inherits
// all the behavior of addition on a ring.
public:
virtual int Opcode() const;
};
//------------------------------MinINode---------------------------------------
// MINimum of 2 integers. Included with the ADD nodes because it inherits
// all the behavior of addition on a ring.
public:
virtual int Opcode() const;
};