/* * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * 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. *
*/
//------------------------------MulNode---------------------------------------- // Classic MULTIPLY functionality. This covers all the usual 'multiply' // behaviors for an algebraic ring. Multiply-integer, multiply-float, // multiply-double, and binary-and are all inherited from this class. The // various identity values are supplied by virtual functions. class MulNode : public Node { virtual uint hash() const; public:
MulNode(Node *in1, Node *in2): Node(NULL,in1,in2) {
init_class_id(Class_Mul);
}
// 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. virtual Node* Identity(PhaseGVN* phase);
// We also canonicalize the Node, moving constants to the right input, // and flatten expressions (so that 1+x+2 becomes x+3). virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
// Compute a new Type for this node. Basically we just do the pre-check, // then call the virtual add() to set the type. virtualconst Type* Value(PhaseGVN* phase) const;
// Supplied function returns the product 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. // This call recognizes the multiplicative zero type. virtualconst Type *mul_ring( const Type *, const Type * ) const = 0;
// Supplied function to return the multiplicative identity type virtualconst Type *mul_id() const = 0;
// Supplied function to return the additive identity type virtualconst Type *add_id() const = 0;
// Supplied function to return the additive opcode virtualint add_opcode() const = 0;
// Supplied function to return the multiplicative opcode virtualint mul_opcode() const = 0;
// Supplied function to return the additive opcode virtualint max_opcode() const = 0;
// Supplied function to return the multiplicative opcode virtualint min_opcode() const = 0;
//------------------------------MulINode--------------------------------------- // Multiply 2 integers class MulINode : public MulNode { public:
MulINode( Node *in1, Node *in2 ) : MulNode(in1,in2) {} virtualint Opcode() const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtualconst Type *mul_ring( const Type *, const Type * ) const; const Type *mul_id() const { return TypeInt::ONE; } const Type *add_id() const { return TypeInt::ZERO; } int add_opcode() const { return Op_AddI; } int mul_opcode() const { return Op_MulI; } int max_opcode() const { return Op_MaxI; } int min_opcode() const { return Op_MinI; } const Type *bottom_type() const { return TypeInt::INT; } virtual uint ideal_reg() const { return Op_RegI; }
};
//------------------------------MulLNode--------------------------------------- // Multiply 2 longs class MulLNode : public MulNode { public:
MulLNode( Node *in1, Node *in2 ) : MulNode(in1,in2) {} virtualint Opcode() const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtualconst Type *mul_ring( const Type *, const Type * ) const; const Type *mul_id() const { return TypeLong::ONE; } const Type *add_id() const { return TypeLong::ZERO; } int add_opcode() const { return Op_AddL; } int mul_opcode() const { return Op_MulL; } int max_opcode() const { return Op_MaxL; } int min_opcode() const { return Op_MinL; } const Type *bottom_type() const { return TypeLong::LONG; } virtual uint ideal_reg() const { return Op_RegL; }
};
//------------------------------MulFNode--------------------------------------- // Multiply 2 floats class MulFNode : public MulNode { public:
MulFNode( Node *in1, Node *in2 ) : MulNode(in1,in2) {} virtualint Opcode() const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtualconst Type *mul_ring( const Type *, const Type * ) const; const Type *mul_id() const { return TypeF::ONE; } const Type *add_id() const { return TypeF::ZERO; } int add_opcode() const { return Op_AddF; } int mul_opcode() const { return Op_MulF; } int max_opcode() const { return Op_MaxF; } int min_opcode() const { return Op_MinF; } const Type *bottom_type() const { return Type::FLOAT; } virtual uint ideal_reg() const { return Op_RegF; }
};
//------------------------------MulDNode--------------------------------------- // Multiply 2 doubles class MulDNode : public MulNode { public:
MulDNode( Node *in1, Node *in2 ) : MulNode(in1,in2) {} virtualint Opcode() const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtualconst Type *mul_ring( const Type *, const Type * ) const; const Type *mul_id() const { return TypeD::ONE; } const Type *add_id() const { return TypeD::ZERO; } int add_opcode() const { return Op_AddD; } int mul_opcode() const { return Op_MulD; } int max_opcode() const { return Op_MaxD; } int min_opcode() const { return Op_MinD; } const Type *bottom_type() const { return Type::DOUBLE; } virtual uint ideal_reg() const { return Op_RegD; }
};
//-------------------------------MulHiLNode------------------------------------ const Type* MulHiValue(const Type *t1, const Type *t2, const Type *bot);
// Upper 64 bits of a 64 bit by 64 bit multiply class MulHiLNode : public Node { public:
MulHiLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {} virtualint Opcode() const; virtualconst Type* Value(PhaseGVN* phase) const; const Type *bottom_type() const { return TypeLong::LONG; } virtual uint ideal_reg() const { return Op_RegL; } friendconst Type* MulHiValue(const Type *t1, const Type *t2, const Type *bot);
};
// Upper 64 bits of a 64 bit by 64 bit unsigned multiply class UMulHiLNode : public Node { public:
UMulHiLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {} virtualint Opcode() const; virtualconst Type* Value(PhaseGVN* phase) const; const Type *bottom_type() const { return TypeLong::LONG; } virtual uint ideal_reg() const { return Op_RegL; } friendconst Type* MulHiValue(const Type *t1, const Type *t2, const Type *bot);
};
//------------------------------AndINode--------------------------------------- // Logically AND 2 integers. Included with the MUL nodes because it inherits // all the behavior of multiplication on a ring. class AndINode : public MulINode { public:
AndINode( Node *in1, Node *in2 ) : MulINode(in1,in2) {} virtualint Opcode() const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual Node* Identity(PhaseGVN* phase); virtualconst Type* Value(PhaseGVN* phase) const; virtualconst Type *mul_ring( const Type *, const Type * ) const; const Type *mul_id() const { return TypeInt::MINUS_1; } const Type *add_id() const { return TypeInt::ZERO; } int add_opcode() const { return Op_OrI; } int mul_opcode() const { return Op_AndI; } int max_opcode() const { return Op_MaxI; } int min_opcode() const { return Op_MinI; } virtual uint ideal_reg() const { return Op_RegI; }
};
//------------------------------AndINode--------------------------------------- // Logically AND 2 longs. Included with the MUL nodes because it inherits // all the behavior of multiplication on a ring. class AndLNode : public MulLNode { public:
AndLNode( Node *in1, Node *in2 ) : MulLNode(in1,in2) {} virtualint Opcode() const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual Node* Identity(PhaseGVN* phase); virtualconst Type* Value(PhaseGVN* phase) const; virtualconst Type *mul_ring( const Type *, const Type * ) const; const Type *mul_id() const { return TypeLong::MINUS_1; } const Type *add_id() const { return TypeLong::ZERO; } int add_opcode() const { return Op_OrL; } int mul_opcode() const { return Op_AndL; } int max_opcode() const { return Op_MaxL; } int min_opcode() const { return Op_MinL; } virtual uint ideal_reg() const { return Op_RegL; }
};
class LShiftNode : public Node { public:
LShiftNode(Node *in1, Node *in2) : Node(NULL,in1,in2) {
init_class_id(Class_LShift);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.