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      public String getName() {
025        return "Final MIR Expansion";
026      }
027    
028      public boolean printingEnabled(OptOptions options, boolean before) {
029        return !before && options.PRINT_FINAL_MIR;
030      }
031    
032      // this class has no instance fields.
033      public CompilerPhase newExecution(IR ir) {
034        return this;
035      }
036    
037      public void perform(IR ir) {
038        if (IR.SANITY_CHECK) {
039          ir.verify("right before Final MIR Expansion", true);
040        }
041    
042        ir.MIRInfo.mcSizeEstimate = FinalMIRExpansion.expand(ir);
043      }
044    }