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.mir2mc;
014    
015    import org.jikesrvm.ArchitectureSpecificOpt.FinalMIRExpansion;
016    import org.jikesrvm.compilers.opt.OptOptions;
017    import org.jikesrvm.compilers.opt.driver.CompilerPhase;
018    import org.jikesrvm.compilers.opt.ir.IR;
019    
020    /**
021     * A compiler phase that drives final MIR expansion.
022     */
023    final class FinalMIRExpansionDriver extends CompilerPhase {
024      @Override
025      public String getName() {
026        return "Final MIR Expansion";
027      }
028    
029      @Override
030      public boolean printingEnabled(OptOptions options, boolean before) {
031        return !before && options.PRINT_FINAL_MIR;
032      }
033    
034      // this class has no instance fields.
035      @Override
036      public CompilerPhase newExecution(IR ir) {
037        return this;
038      }
039    
040      @Override
041      public void perform(IR ir) {
042        if (IR.SANITY_CHECK) {
043          ir.verify("right before Final MIR Expansion", true);
044        }
045    
046        ir.MIRInfo.mcSizeEstimate = FinalMIRExpansion.expand(ir);
047      }
048    }