< prev index next >

src/share/vm/opto/addnode.hpp

Print this page
rev 8739 : 8004073: Implement C2 Ideal node specific dump() method
Summary: add Node::dump_rel() to dump a node and its related nodes (the notion of "related" depends on the node at hand); add Node::dump_comp() to dump a node in compact representation; add Node::dump_rel_comp() to dump a node and its related nodes in compact representation; add the required machinery; extend some C2 IR nodes with compact and related dumping
Reviewed-by:
   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  51 
  52   // We also canonicalize the Node, moving constants to the right input,
  53   // and flatten expressions (so that 1+x+2 becomes x+3).
  54   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  55 
  56   // Compute a new Type for this node.  Basically we just do the pre-check,
  57   // then call the virtual add() to set the type.
  58   virtual const Type *Value( PhaseTransform *phase ) const;
  59 
  60   // Check if this addition involves the additive identity
  61   virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
  62 
  63   // Supplied function returns the sum of the inputs.
  64   // This also type-checks the inputs for sanity.  Guaranteed never to
  65   // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
  66   virtual const Type *add_ring( const Type *, const Type * ) const = 0;
  67 
  68   // Supplied function to return the additive identity type
  69   virtual const Type *add_id() const = 0;
  70 




  71 };
  72 
  73 //------------------------------AddINode---------------------------------------
  74 // Add 2 integers
  75 class AddINode : public AddNode {
  76 public:
  77   AddINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
  78   virtual int Opcode() const;
  79   virtual const Type *add_ring( const Type *, const Type * ) const;
  80   virtual const Type *add_id() const { return TypeInt::ZERO; }
  81   virtual const Type *bottom_type() const { return TypeInt::INT; }
  82   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  83   virtual Node *Identity( PhaseTransform *phase );
  84   virtual uint ideal_reg() const { return Op_RegI; }
  85 };
  86 
  87 //------------------------------AddLNode---------------------------------------
  88 // Add 2 longs
  89 class AddLNode : public AddNode {
  90 public:


 141   AddPNode( Node *base, Node *ptr, Node *off ) : Node(0,base,ptr,off) {
 142     init_class_id(Class_AddP);
 143   }
 144   virtual int Opcode() const;
 145   virtual Node *Identity( PhaseTransform *phase );
 146   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 147   virtual const Type *Value( PhaseTransform *phase ) const;
 148   virtual const Type *bottom_type() const;
 149   virtual uint  ideal_reg() const { return Op_RegP; }
 150   Node         *base_node() { assert( req() > Base, "Missing base"); return in(Base); }
 151   static Node* Ideal_base_and_offset(Node* ptr, PhaseTransform* phase,
 152                                      // second return value:
 153                                      intptr_t& offset);
 154 
 155   // Collect the AddP offset values into the elements array, giving up
 156   // if there are more than length.
 157   int unpack_offsets(Node* elements[], int length);
 158 
 159   // Do not match base-ptr edge
 160   virtual uint match_edge(uint idx) const;




 161 };
 162 
 163 //------------------------------OrINode----------------------------------------
 164 // Logically OR 2 integers.  Included with the ADD nodes because it inherits
 165 // all the behavior of addition on a ring.
 166 class OrINode : public AddNode {
 167 public:
 168   OrINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 169   virtual int Opcode() const;
 170   virtual const Type *add_ring( const Type *, const Type * ) const;
 171   virtual const Type *add_id() const { return TypeInt::ZERO; }
 172   virtual const Type *bottom_type() const { return TypeInt::INT; }
 173   virtual Node *Identity( PhaseTransform *phase );
 174   virtual uint ideal_reg() const { return Op_RegI; }
 175 };
 176 
 177 //------------------------------OrLNode----------------------------------------
 178 // Logically OR 2 longs.  Included with the ADD nodes because it inherits
 179 // all the behavior of addition on a ring.
 180 class OrLNode : public AddNode {


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  51 
  52   // We also canonicalize the Node, moving constants to the right input,
  53   // and flatten expressions (so that 1+x+2 becomes x+3).
  54   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  55 
  56   // Compute a new Type for this node.  Basically we just do the pre-check,
  57   // then call the virtual add() to set the type.
  58   virtual const Type *Value( PhaseTransform *phase ) const;
  59 
  60   // Check if this addition involves the additive identity
  61   virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
  62 
  63   // Supplied function returns the sum of the inputs.
  64   // This also type-checks the inputs for sanity.  Guaranteed never to
  65   // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
  66   virtual const Type *add_ring( const Type *, const Type * ) const = 0;
  67 
  68   // Supplied function to return the additive identity type
  69   virtual const Type *add_id() const = 0;
  70 
  71 #ifndef PRODUCT
  72   REL_IN_DATA_OUT_1;
  73 #endif
  74 
  75 };
  76 
  77 //------------------------------AddINode---------------------------------------
  78 // Add 2 integers
  79 class AddINode : public AddNode {
  80 public:
  81   AddINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
  82   virtual int Opcode() const;
  83   virtual const Type *add_ring( const Type *, const Type * ) const;
  84   virtual const Type *add_id() const { return TypeInt::ZERO; }
  85   virtual const Type *bottom_type() const { return TypeInt::INT; }
  86   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  87   virtual Node *Identity( PhaseTransform *phase );
  88   virtual uint ideal_reg() const { return Op_RegI; }
  89 };
  90 
  91 //------------------------------AddLNode---------------------------------------
  92 // Add 2 longs
  93 class AddLNode : public AddNode {
  94 public:


 145   AddPNode( Node *base, Node *ptr, Node *off ) : Node(0,base,ptr,off) {
 146     init_class_id(Class_AddP);
 147   }
 148   virtual int Opcode() const;
 149   virtual Node *Identity( PhaseTransform *phase );
 150   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 151   virtual const Type *Value( PhaseTransform *phase ) const;
 152   virtual const Type *bottom_type() const;
 153   virtual uint  ideal_reg() const { return Op_RegP; }
 154   Node         *base_node() { assert( req() > Base, "Missing base"); return in(Base); }
 155   static Node* Ideal_base_and_offset(Node* ptr, PhaseTransform* phase,
 156                                      // second return value:
 157                                      intptr_t& offset);
 158 
 159   // Collect the AddP offset values into the elements array, giving up
 160   // if there are more than length.
 161   int unpack_offsets(Node* elements[], int length);
 162 
 163   // Do not match base-ptr edge
 164   virtual uint match_edge(uint idx) const;
 165 
 166 #ifndef PRODUCT
 167   REL_IN_DATA_OUT_1;
 168 #endif
 169 };
 170 
 171 //------------------------------OrINode----------------------------------------
 172 // Logically OR 2 integers.  Included with the ADD nodes because it inherits
 173 // all the behavior of addition on a ring.
 174 class OrINode : public AddNode {
 175 public:
 176   OrINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 177   virtual int Opcode() const;
 178   virtual const Type *add_ring( const Type *, const Type * ) const;
 179   virtual const Type *add_id() const { return TypeInt::ZERO; }
 180   virtual const Type *bottom_type() const { return TypeInt::INT; }
 181   virtual Node *Identity( PhaseTransform *phase );
 182   virtual uint ideal_reg() const { return Op_RegI; }
 183 };
 184 
 185 //------------------------------OrLNode----------------------------------------
 186 // Logically OR 2 longs.  Included with the ADD nodes because it inherits
 187 // all the behavior of addition on a ring.
 188 class OrLNode : public AddNode {


< prev index next >