< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIR.java

Print this page




  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 package org.graalvm.compiler.lir;
  26 
  27 import java.util.ArrayList;
  28 import java.util.Arrays;
  29 import java.util.List;
  30 

  31 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
  32 import org.graalvm.compiler.core.common.cfg.AbstractControlFlowGraph;
  33 import org.graalvm.compiler.core.common.cfg.BlockMap;
  34 import org.graalvm.compiler.debug.DebugContext;
  35 import org.graalvm.compiler.lir.StandardOp.BlockEndOp;
  36 import org.graalvm.compiler.lir.StandardOp.LabelOp;

  37 import org.graalvm.compiler.lir.gen.LIRGenerator;
  38 import org.graalvm.compiler.options.OptionValues;
  39 
  40 /**
  41  * This class implements the overall container for the LIR graph and directs its construction,
  42  * optimization, and finalization.
  43  */
  44 public final class LIR extends LIRGenerator.VariableProvider {
  45 
  46     private final AbstractControlFlowGraph<?> cfg;
  47 
  48     /**
  49      * The linear-scan ordered list of blocks.
  50      */
  51     private final AbstractBlockBase<?>[] linearScanOrder;
  52 
  53     /**
  54      * The order in which the code is emitted.
  55      */
  56     private final AbstractBlockBase<?>[] codeEmittingOrder;


 216             for (AbstractBlockBase<?> sux : block.getSuccessors()) {
 217                 assert Arrays.asList(blocks).contains(sux) : "missing successor from: " + block + "to: " + sux;
 218             }
 219             for (AbstractBlockBase<?> pred : block.getPredecessors()) {
 220                 assert Arrays.asList(blocks).contains(pred) : "missing predecessor from: " + block + "to: " + pred;
 221             }
 222             if (!verifyBlock(lir, block)) {
 223                 return false;
 224             }
 225         }
 226         return true;
 227     }
 228 
 229     public void resetLabels() {
 230 
 231         for (AbstractBlockBase<?> block : codeEmittingOrder()) {
 232             if (block == null) {
 233                 continue;
 234             }
 235             for (LIRInstruction inst : lirInstructions.get(block)) {
 236                 if (inst instanceof LabelOp) {
 237                     ((LabelOp) inst).getLabel().reset();



 238                 }
 239             }
 240         }
 241     }
 242 
 243 }


  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 package org.graalvm.compiler.lir;
  26 
  27 import java.util.ArrayList;
  28 import java.util.Arrays;
  29 import java.util.List;
  30 
  31 import org.graalvm.compiler.asm.Label;
  32 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
  33 import org.graalvm.compiler.core.common.cfg.AbstractControlFlowGraph;
  34 import org.graalvm.compiler.core.common.cfg.BlockMap;
  35 import org.graalvm.compiler.debug.DebugContext;
  36 import org.graalvm.compiler.lir.StandardOp.BlockEndOp;
  37 import org.graalvm.compiler.lir.StandardOp.LabelOp;
  38 import org.graalvm.compiler.lir.StandardOp.LabelHoldingOp;
  39 import org.graalvm.compiler.lir.gen.LIRGenerator;
  40 import org.graalvm.compiler.options.OptionValues;
  41 
  42 /**
  43  * This class implements the overall container for the LIR graph and directs its construction,
  44  * optimization, and finalization.
  45  */
  46 public final class LIR extends LIRGenerator.VariableProvider {
  47 
  48     private final AbstractControlFlowGraph<?> cfg;
  49 
  50     /**
  51      * The linear-scan ordered list of blocks.
  52      */
  53     private final AbstractBlockBase<?>[] linearScanOrder;
  54 
  55     /**
  56      * The order in which the code is emitted.
  57      */
  58     private final AbstractBlockBase<?>[] codeEmittingOrder;


 218             for (AbstractBlockBase<?> sux : block.getSuccessors()) {
 219                 assert Arrays.asList(blocks).contains(sux) : "missing successor from: " + block + "to: " + sux;
 220             }
 221             for (AbstractBlockBase<?> pred : block.getPredecessors()) {
 222                 assert Arrays.asList(blocks).contains(pred) : "missing predecessor from: " + block + "to: " + pred;
 223             }
 224             if (!verifyBlock(lir, block)) {
 225                 return false;
 226             }
 227         }
 228         return true;
 229     }
 230 
 231     public void resetLabels() {
 232 
 233         for (AbstractBlockBase<?> block : codeEmittingOrder()) {
 234             if (block == null) {
 235                 continue;
 236             }
 237             for (LIRInstruction inst : lirInstructions.get(block)) {
 238                 if (inst instanceof LabelHoldingOp) {
 239                     Label label = ((LabelHoldingOp) inst).getLabel();
 240                     if (label != null) {
 241                         label.reset();
 242                     }
 243                 }
 244             }
 245         }
 246     }
 247 
 248 }
< prev index next >