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 */
013package org.jikesrvm.compilers.opt.hir2lir;
014
015import org.jikesrvm.compilers.opt.depgraph.DepGraphStats;
016import org.jikesrvm.compilers.opt.driver.CompilerPhase;
017import org.jikesrvm.compilers.opt.ir.IR;
018import org.jikesrvm.compilers.opt.ir.LIRInfo;
019
020/**
021 * Convert an IR object from HIR to LIR
022 */
023public final class ConvertHIRtoLIR extends CompilerPhase {
024
025  @Override
026  public String getName() {
027    return "HIR Operator Expansion";
028  }
029
030  @Override
031  public CompilerPhase newExecution(IR ir) {
032    return this;
033  }
034
035  @Override
036  public void perform(IR ir) {
037    if (IR.SANITY_CHECK) {
038      ir.verify("before conversion to LIR", true);
039    }
040    if (ir.options.PRINT_STATIC_STATS) {
041      // Print summary statistics (critpath, etc.) for all basic blocks
042      DepGraphStats.printBasicBlockStatistics(ir);
043    }
044    // Do the conversion from HIR to LIR.
045    ir.IRStage = IR.LIR;
046    ir.LIRInfo = new LIRInfo(ir);
047    ConvertToLowLevelIR.convert(ir, ir.options);
048  }
049}