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.mir2mc; 014 015import org.jikesrvm.VM; 016import org.jikesrvm.compilers.opt.OptOptions; 017import org.jikesrvm.compilers.opt.driver.CompilerPhase; 018import org.jikesrvm.compilers.opt.ir.IR; 019 020/** 021 * A compiler phase that drives final MIR expansion. 022 */ 023final 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.mcOffsets = new MachineCodeOffsets(); 047 if (VM.BuildForIA32) { 048 ir.MIRInfo.mcSizeEstimate = org.jikesrvm.compilers.opt.mir2mc.ia32.FinalMIRExpansion.expand(ir); 049 } else { 050 if (VM.VerifyAssertions) VM._assert(VM.BuildForPowerPC); 051 ir.MIRInfo.mcSizeEstimate = org.jikesrvm.compilers.opt.mir2mc.ppc.FinalMIRExpansion.expand(ir);; 052 } 053 } 054}