src/share/vm/c1/c1_ValueMap.hpp

Print this page




   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 class ValueMapEntry: public CompilationResourceObj {
  26  private:
  27   intx           _hash;
  28   Value          _value;
  29   int            _nesting;
  30   ValueMapEntry* _next;
  31 
  32  public:
  33   ValueMapEntry(intx hash, Value value, int nesting, ValueMapEntry* next)
  34     : _hash(hash)
  35     , _value(value)
  36     , _nesting(nesting)
  37     , _next(next)
  38   {
  39   }
  40 
  41   intx           hash()      { return _hash; }
  42   Value          value()     { return _value; }
  43   int            nesting()   { return _nesting; }
  44   ValueMapEntry* next()      { return _next; }


 209 
 210 class GlobalValueNumbering: public ValueNumberingVisitor {
 211  private:
 212   ValueMap*     _current_map;     // value map of current block
 213   ValueMapArray _value_maps;      // list of value maps for all blocks
 214 
 215  public:
 216   // accessors
 217   ValueMap*     current_map()                    { return _current_map; }
 218   ValueMap*     value_map_of(BlockBegin* block)  { return _value_maps.at(block->linear_scan_number()); }
 219   void          set_value_map_of(BlockBegin* block, ValueMap* map)   { assert(value_map_of(block) == NULL, ""); _value_maps.at_put(block->linear_scan_number(), map); }
 220 
 221   // implementation for abstract methods of ValueNumberingVisitor
 222   void          kill_memory()                    { current_map()->kill_memory(); }
 223   void          kill_field(ciField* field)       { current_map()->kill_field(field); }
 224   void          kill_array(ValueType* type)      { current_map()->kill_array(type); }
 225 
 226   // main entry point that performs global value numbering
 227   GlobalValueNumbering(IR* ir);
 228 };




   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_C1_C1_VALUEMAP_HPP
  26 #define SHARE_VM_C1_C1_VALUEMAP_HPP
  27 
  28 #include "c1/c1_Instruction.hpp"
  29 #include "c1/c1_ValueSet.hpp"
  30 #include "memory/allocation.hpp"
  31 
  32 class ValueMapEntry: public CompilationResourceObj {
  33  private:
  34   intx           _hash;
  35   Value          _value;
  36   int            _nesting;
  37   ValueMapEntry* _next;
  38 
  39  public:
  40   ValueMapEntry(intx hash, Value value, int nesting, ValueMapEntry* next)
  41     : _hash(hash)
  42     , _value(value)
  43     , _nesting(nesting)
  44     , _next(next)
  45   {
  46   }
  47 
  48   intx           hash()      { return _hash; }
  49   Value          value()     { return _value; }
  50   int            nesting()   { return _nesting; }
  51   ValueMapEntry* next()      { return _next; }


 216 
 217 class GlobalValueNumbering: public ValueNumberingVisitor {
 218  private:
 219   ValueMap*     _current_map;     // value map of current block
 220   ValueMapArray _value_maps;      // list of value maps for all blocks
 221 
 222  public:
 223   // accessors
 224   ValueMap*     current_map()                    { return _current_map; }
 225   ValueMap*     value_map_of(BlockBegin* block)  { return _value_maps.at(block->linear_scan_number()); }
 226   void          set_value_map_of(BlockBegin* block, ValueMap* map)   { assert(value_map_of(block) == NULL, ""); _value_maps.at_put(block->linear_scan_number(), map); }
 227 
 228   // implementation for abstract methods of ValueNumberingVisitor
 229   void          kill_memory()                    { current_map()->kill_memory(); }
 230   void          kill_field(ciField* field)       { current_map()->kill_field(field); }
 231   void          kill_array(ValueType* type)      { current_map()->kill_array(type); }
 232 
 233   // main entry point that performs global value numbering
 234   GlobalValueNumbering(IR* ir);
 235 };
 236 
 237 #endif // SHARE_VM_C1_C1_VALUEMAP_HPP