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.bc2ir; 014 015 import org.jikesrvm.compilers.opt.driver.CompilerPhase; 016 import org.jikesrvm.compilers.opt.ir.HIRInfo; 017 import org.jikesrvm.compilers.opt.ir.IR; 018 019 /** 020 * Translate from bytecodes to HIR 021 */ 022 public final class ConvertBCtoHIR extends CompilerPhase { 023 024 @Override 025 public String getName() { 026 return "Generate HIR"; 027 } 028 029 /** 030 * Generate HIR for ir.method into IR 031 * 032 * @param ir The IR to generate HIR into 033 */ 034 @Override 035 public void perform(IR ir) { 036 // Generate the cfg into gc 037 GenerationContext gc = new GenerationContext(ir.method, ir.params, ir.compiledMethod, ir.options, ir.inlinePlan); 038 BC2IR.generateHIR(gc); 039 // Transfer HIR and misc state from gc to the ir object 040 ir.gc = gc; 041 ir.cfg = gc.cfg; 042 ir.regpool = gc.temps; 043 if (gc.allocFrame) { 044 ir.stackManager.forceFrameAllocation(); 045 } 046 047 ir.IRStage = IR.HIR; 048 ir.HIRInfo = new HIRInfo(ir); 049 } 050 051 // This phase contains no instance fields. 052 @Override 053 public CompilerPhase newExecution(IR ir) { 054 return this; 055 } 056 }