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.instrsched;
014    
015    import org.jikesrvm.compilers.opt.OptOptions;
016    import org.jikesrvm.compilers.opt.driver.CompilerPhase;
017    
018    /**
019     * Pre-pass Instruction Scheduling Phase
020     *
021     * This class is declared as "final" which implies that all its methods
022     * are "final" too.
023     */
024    public final class PrePassScheduler extends CompilerPhase {
025    
026      public boolean shouldPerform(OptOptions options) {
027        return options.L2M_SCHEDULE_PREPASS;
028      }
029    
030      public String getName() {
031        return "InstrSched (pre-pass)";
032      }
033    
034      public boolean printingEnabled(OptOptions options, boolean before) {
035        return !before &&          // old interface only printed afterwards
036               options.PRINT_SCHEDULE_PRE;
037      }
038    
039      /**
040       * Perform instruction scheduling for a method.
041       * This is an MIR to MIR transformation.
042       *
043       * @param ir the IR in question
044       */
045      public void perform(org.jikesrvm.compilers.opt.ir.IR ir) {
046        new Scheduler(Scheduler.PREPASS).perform(ir);
047      }
048    
049    }