addnode.hpp revision 1472
553N/A * Copyright (c) 1997, 2006, 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. 553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// Portions of code courtesy of Clifford Click 0N/A//------------------------------AddNode---------------------------------------- 288N/A// Classic Add functionality. This covers all the usual 'add' behaviors for 0N/A// an algebraic ring. Add-integer, add-float, add-double, and binary-or are 0N/A// all inherited from this class. The various identity values are supplied 0N/A// by virtual functions. // 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--------------------------------------- //------------------------------AddLNode--------------------------------------- //------------------------------AddFNode--------------------------------------- //------------------------------AddDNode--------------------------------------- //------------------------------AddPNode--------------------------------------- // Add pointer plus integer to get pointer. NOT commutative, really. // So not really an AddNode. Lives here, because people associate it with 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 // Collect the AddP offset values into the elements array, giving up // if there are more than length. // 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. //------------------------------OrLNode---------------------------------------- // Logically OR 2 longs. Included with the ADD nodes because it inherits // all the behavior of addition on a ring. //------------------------------XorINode--------------------------------------- //------------------------------XorINode--------------------------------------- //------------------------------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. 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. //------------------------------MinINode--------------------------------------- // MINimum of 2 integers. Included with the ADD nodes because it inherits // all the behavior of addition on a ring.