< prev index next >

hotspot/src/share/vm/c1/c1_LIRGenerator.hpp

Print this page
rev 10453 : imported patch update dates
   1 /*
   2  * Copyright (c) 2005, 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  *
  23  */
  24 
  25 #ifndef SHARE_VM_C1_C1_LIRGENERATOR_HPP
  26 #define SHARE_VM_C1_C1_LIRGENERATOR_HPP
  27 
  28 #include "c1/c1_Instruction.hpp"
  29 #include "c1/c1_LIR.hpp"
  30 #include "ci/ciMethodData.hpp"
  31 #include "utilities/sizes.hpp"
  32 
  33 // The classes responsible for code emission and register allocation
  34 
  35 
  36 class LIRGenerator;
  37 class LIREmitter;
  38 class Invoke;
  39 class SwitchRange;
  40 class LIRItem;
  41 
  42 define_array(LIRItemArray, LIRItem*)
  43 define_stack(LIRItemList, LIRItemArray)
  44 
  45 class SwitchRange: public CompilationResourceObj {
  46  private:
  47   int _low_key;
  48   int _high_key;
  49   BlockBegin* _sux;
  50  public:
  51   SwitchRange(int start_key, BlockBegin* sux): _low_key(start_key), _high_key(start_key), _sux(sux) {}
  52   void set_high_key(int key) { _high_key = key; }
  53 
  54   int high_key() const { return _high_key; }
  55   int low_key() const { return _low_key; }
  56   BlockBegin* sux() const { return _sux; }
  57 };
  58 
  59 define_array(SwitchRangeArray, SwitchRange*)
  60 define_stack(SwitchRangeList, SwitchRangeArray)
  61 
  62 
  63 class ResolveNode;
  64 
  65 define_array(NodeArray, ResolveNode*);
  66 define_stack(NodeList, NodeArray);
  67 
  68 
  69 // Node objects form a directed graph of LIR_Opr
  70 // Edges between Nodes represent moves from one Node to its destinations
  71 class ResolveNode: public CompilationResourceObj {
  72  private:
  73   LIR_Opr    _operand;       // the source or destinaton
  74   NodeList   _destinations;  // for the operand
  75   bool       _assigned;      // Value assigned to this Node?
  76   bool       _visited;       // Node already visited?
  77   bool       _start_node;    // Start node already visited?
  78 
  79  public:
  80   ResolveNode(LIR_Opr operand)
  81     : _operand(operand)
  82     , _assigned(false)
  83     , _visited(false)
  84     , _start_node(false) {};
  85 
  86   // accessors
  87   LIR_Opr operand() const           { return _operand; }
  88   int no_of_destinations() const    { return _destinations.length(); }
  89   ResolveNode* destination_at(int i)     { return _destinations[i]; }
  90   bool assigned() const             { return _assigned; }
  91   bool visited() const              { return _visited; }
  92   bool start_node() const           { return _start_node; }
  93 
  94   // modifiers
  95   void append(ResolveNode* dest)         { _destinations.append(dest); }
  96   void set_assigned()               { _assigned = true; }
  97   void set_visited()                { _visited = true; }
  98   void set_start_node()             { _start_node = true; }
  99 };
 100 
 101 
 102 // This is shared state to be used by the PhiResolver so the operand
 103 // arrays don't have to be reallocated for reach resolution.
 104 class PhiResolverState: public CompilationResourceObj {
 105   friend class PhiResolver;
 106 
 107  private:
 108   NodeList _virtual_operands; // Nodes where the operand is a virtual register
 109   NodeList _other_operands;   // Nodes where the operand is not a virtual register


   1 /*
   2  * Copyright (c) 2005, 2016, 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_C1_C1_LIRGENERATOR_HPP
  26 #define SHARE_VM_C1_C1_LIRGENERATOR_HPP
  27 
  28 #include "c1/c1_Instruction.hpp"
  29 #include "c1/c1_LIR.hpp"
  30 #include "ci/ciMethodData.hpp"
  31 #include "utilities/sizes.hpp"
  32 
  33 // The classes responsible for code emission and register allocation
  34 
  35 
  36 class LIRGenerator;
  37 class LIREmitter;
  38 class Invoke;
  39 class SwitchRange;
  40 class LIRItem;
  41 
  42 typedef GrowableArray<LIRItem*> LIRItemList;

  43 
  44 class SwitchRange: public CompilationResourceObj {
  45  private:
  46   int _low_key;
  47   int _high_key;
  48   BlockBegin* _sux;
  49  public:
  50   SwitchRange(int start_key, BlockBegin* sux): _low_key(start_key), _high_key(start_key), _sux(sux) {}
  51   void set_high_key(int key) { _high_key = key; }
  52 
  53   int high_key() const { return _high_key; }
  54   int low_key() const { return _low_key; }
  55   BlockBegin* sux() const { return _sux; }
  56 };
  57 
  58 typedef GrowableArray<SwitchRange*> SwitchRangeArray;
  59 typedef GrowableArray<SwitchRange*> SwitchRangeList;

  60 
  61 class ResolveNode;
  62 
  63 typedef GrowableArray<ResolveNode*> NodeList;


  64 
  65 // Node objects form a directed graph of LIR_Opr
  66 // Edges between Nodes represent moves from one Node to its destinations
  67 class ResolveNode: public CompilationResourceObj {
  68  private:
  69   LIR_Opr    _operand;       // the source or destinaton
  70   NodeList   _destinations;  // for the operand
  71   bool       _assigned;      // Value assigned to this Node?
  72   bool       _visited;       // Node already visited?
  73   bool       _start_node;    // Start node already visited?
  74 
  75  public:
  76   ResolveNode(LIR_Opr operand)
  77     : _operand(operand)
  78     , _assigned(false)
  79     , _visited(false)
  80     , _start_node(false) {};
  81 
  82   // accessors
  83   LIR_Opr operand() const           { return _operand; }
  84   int no_of_destinations() const    { return _destinations.length(); }
  85   ResolveNode* destination_at(int i)     { return _destinations.at(i); }
  86   bool assigned() const             { return _assigned; }
  87   bool visited() const              { return _visited; }
  88   bool start_node() const           { return _start_node; }
  89 
  90   // modifiers
  91   void append(ResolveNode* dest)         { _destinations.append(dest); }
  92   void set_assigned()               { _assigned = true; }
  93   void set_visited()                { _visited = true; }
  94   void set_start_node()             { _start_node = true; }
  95 };
  96 
  97 
  98 // This is shared state to be used by the PhiResolver so the operand
  99 // arrays don't have to be reallocated for reach resolution.
 100 class PhiResolverState: public CompilationResourceObj {
 101   friend class PhiResolver;
 102 
 103  private:
 104   NodeList _virtual_operands; // Nodes where the operand is a virtual register
 105   NodeList _other_operands;   // Nodes where the operand is not a virtual register


< prev index next >