001 /*
002 * This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 * This file is licensed to You under the Eclipse Public License (EPL);
005 * You may not use this file except in compliance with the License. You
006 * may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 * See the COPYRIGHT.txt file distributed with this work for information
011 * regarding copyright ownership.
012 */
013 package org.jikesrvm.compilers.opt.controlflow;
014
015 import org.jikesrvm.compilers.opt.driver.CompilerPhase;
016 import org.jikesrvm.compilers.opt.ir.IR;
017
018 /**
019 * A compiler phase to construct the loop structure tree (LST).
020 * The steps are (1) construct approximate dominators (ie blocks are
021 * not unfactored) and (2) build the LST.
022 *
023 * @see LTDominators
024 * @see LSTGraph
025 */
026 public class BuildLST extends CompilerPhase {
027 public String getName() { return "Build LST"; }
028
029 /**
030 * This phase contains no per-compilation instance fields.
031 */
032 public final CompilerPhase newExecution(IR ir) {
033 return this;
034 }
035
036 /**
037 * Build the Loop Structure Tree (LST) for the given IR.
038 * NOTE: CFG must be reducible.
039 * TODO: Detect irreducible CFG, apply node splitting and then construct LST.
040 *
041 * @param ir the IR on which to apply the phase
042 */
043 public void perform(IR ir) {
044 ir.cfg.compactNodeNumbering();
045 LTDominators.approximate(ir, true);
046 DominatorTree.perform(ir, true);
047 LSTGraph.perform(ir);
048 }
049 }