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.regalloc;
014
015import org.jikesrvm.compilers.opt.OptOptions;
016import org.jikesrvm.compilers.opt.driver.CompilerPhase;
017import org.jikesrvm.compilers.opt.ir.IR;
018
019/**
020 * A phase to compute register restrictions.
021 */
022final class RegisterRestrictionsPhase extends CompilerPhase {
023
024  /**
025   * Return this instance of this phase. This phase contains no
026   * per-compilation instance fields.
027   * @param ir not used
028   * @return this
029   */
030  @Override
031  public CompilerPhase newExecution(IR ir) {
032    return this;
033  }
034
035  @Override
036  public boolean shouldPerform(OptOptions options) {
037    return true;
038  }
039
040  @Override
041  public String getName() {
042    return "Register Restrictions";
043  }
044
045  @Override
046  public boolean printingEnabled(OptOptions options, boolean before) {
047    return false;
048  }
049
050  /**
051   *  @param ir the IR
052   */
053  @Override
054  public void perform(IR ir) {
055
056    //  The registerManager has already been initialized
057    GenericStackManager sm = ir.stackManager;
058
059    // Set up register restrictions
060    sm.computeRestrictions(ir);
061  }
062}