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    public final class PrePassScheduler extends CompilerPhase {
022    
023      @Override
024      public boolean shouldPerform(OptOptions options) {
025        return options.L2M_SCHEDULE_PREPASS;
026      }
027    
028      @Override
029      public String getName() {
030        return "InstrSched (pre-pass)";
031      }
032    
033      @Override
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      @Override
046      public void perform(org.jikesrvm.compilers.opt.ir.IR ir) {
047        new Scheduler(Scheduler.PREPASS).perform(ir);
048      }
049    
050    }