1 /*
   2  * Copyright (c) 1997, 2014, 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  *
  23  */
  24 
  25 #ifndef SHARE_VM_OPTO_CONNODE_HPP
  26 #define SHARE_VM_OPTO_CONNODE_HPP
  27 
  28 #include "opto/node.hpp"
  29 #include "opto/opcodes.hpp"
  30 #include "opto/type.hpp"
  31 
  32 class PhaseTransform;
  33 class MachNode;
  34 
  35 //------------------------------ConNode----------------------------------------
  36 // Simple constants
  37 class ConNode : public TypeNode {
  38 public:
  39   ConNode( const Type *t ) : TypeNode(t->remove_speculative(),1) {
  40     init_req(0, (Node*)Compile::current()->root());
  41     init_flags(Flag_is_Con);
  42   }
  43   virtual uint Opcode() const;
  44   virtual uint hash() const;
  45   virtual const RegMask &out_RegMask() const { return RegMask::Empty; }
  46   virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
  47 
  48   // Polymorphic factory method:
  49   static ConNode* make(const Type *t);
  50 };
  51 
  52 //------------------------------ConINode---------------------------------------
  53 // Simple integer constants
  54 class ConINode : public ConNode {
  55 public:
  56   ConINode( const TypeInt *t ) : ConNode(t) {}
  57   virtual uint Opcode() const;
  58 
  59   // Factory method:
  60   static ConINode* make(int con) {
  61     return new ConINode( TypeInt::make(con) );
  62   }
  63 
  64 };
  65 
  66 //------------------------------ConPNode---------------------------------------
  67 // Simple pointer constants
  68 class ConPNode : public ConNode {
  69 public:
  70   ConPNode( const TypePtr *t ) : ConNode(t) {}
  71   virtual uint Opcode() const;
  72 
  73   // Factory methods:
  74   static ConPNode* make(address con) {
  75     if (con == NULL)
  76       return new ConPNode( TypePtr::NULL_PTR ) ;
  77     else
  78       return new ConPNode( TypeRawPtr::make(con) );
  79   }
  80 };
  81 
  82 
  83 //------------------------------ConNNode--------------------------------------
  84 // Simple narrow oop constants
  85 class ConNNode : public ConNode {
  86 public:
  87   ConNNode( const TypeNarrowOop *t ) : ConNode(t) {}
  88   virtual uint Opcode() const;
  89 };
  90 
  91 //------------------------------ConNKlassNode---------------------------------
  92 // Simple narrow klass constants
  93 class ConNKlassNode : public ConNode {
  94 public:
  95   ConNKlassNode( const TypeNarrowKlass *t ) : ConNode(t) {}
  96   virtual uint Opcode() const;
  97 };
  98 
  99 
 100 //------------------------------ConLNode---------------------------------------
 101 // Simple long constants
 102 class ConLNode : public ConNode {
 103 public:
 104   ConLNode( const TypeLong *t ) : ConNode(t) {}
 105   virtual uint Opcode() const;
 106 
 107   // Factory method:
 108   static ConLNode* make(jlong con) {
 109     return new ConLNode( TypeLong::make(con) );
 110   }
 111 
 112 };
 113 
 114 //------------------------------ConFNode---------------------------------------
 115 // Simple float constants
 116 class ConFNode : public ConNode {
 117 public:
 118   ConFNode( const TypeF *t ) : ConNode(t) {}
 119   virtual uint Opcode() const;
 120 
 121   // Factory method:
 122   static ConFNode* make(float con) {
 123     return new ConFNode( TypeF::make(con) );
 124   }
 125 
 126 };
 127 
 128 //------------------------------ConDNode---------------------------------------
 129 // Simple double constants
 130 class ConDNode : public ConNode {
 131 public:
 132   ConDNode( const TypeD *t ) : ConNode(t) {}
 133   virtual uint Opcode() const;
 134 
 135   // Factory method:
 136   static ConDNode* make(double con) {
 137     return new ConDNode( TypeD::make(con) );
 138   }
 139 
 140 };
 141 
 142 //------------------------------ThreadLocalNode--------------------------------
 143 // Ideal Node which returns the base of ThreadLocalStorage.
 144 class ThreadLocalNode : public Node {
 145 public:
 146     ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {}
 147     virtual uint Opcode() const;
 148     virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;}
 149     virtual uint ideal_reg() const { return Op_RegP; }
 150 };
 151 
 152 
 153 
 154 #endif // SHARE_VM_OPTO_CONNODE_HPP
--- EOF ---