diff options
Diffstat (limited to 'lib/CodeGen/MacroFusion.cpp')
| -rw-r--r-- | lib/CodeGen/MacroFusion.cpp | 27 | 
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/CodeGen/MacroFusion.cpp b/lib/CodeGen/MacroFusion.cpp index 45ea0e4c39ab..5e279b065bbd 100644 --- a/lib/CodeGen/MacroFusion.cpp +++ b/lib/CodeGen/MacroFusion.cpp @@ -1,4 +1,4 @@ -//===- MacroFusion.cpp - Macro Fusion ----------------------===// +//===- MacroFusion.cpp - Macro Fusion -------------------------------------===//  //  //                     The LLVM Compiler Infrastructure  // @@ -13,8 +13,15 @@  //===----------------------------------------------------------------------===//  #include "llvm/CodeGen/MacroFusion.h" +#include "llvm/ADT/STLExtras.h"  #include "llvm/ADT/Statistic.h" +#include "llvm/CodeGen/MachineInstr.h" +#include "llvm/CodeGen/MachineScheduler.h" +#include "llvm/CodeGen/ScheduleDAG.h" +#include "llvm/CodeGen/ScheduleDAGMutation.h"  #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h"  #include "llvm/Target/TargetInstrInfo.h"  #define DEBUG_TYPE "misched" @@ -26,8 +33,6 @@ using namespace llvm;  static cl::opt<bool> EnableMacroFusion("misched-fusion", cl::Hidden,    cl::desc("Enable scheduling for macro fusion."), cl::init(true)); -namespace { -  static void fuseInstructionPair(ScheduleDAGMI &DAG, SUnit &FirstSU,                                  SUnit &SecondSU) {    // Create a single weak edge between the adjacent instrs. The only effect is @@ -66,6 +71,7 @@ static void fuseInstructionPair(ScheduleDAGMI &DAG, SUnit &FirstSU,    ++NumFused;  } +namespace {  /// \brief Post-process the DAG to create cluster edges between instrs that may  /// be fused by the processor into a single operation. @@ -81,6 +87,8 @@ public:    void apply(ScheduleDAGInstrs *DAGInstrs) override;  }; +} // end anonymous namespace +  void MacroFusion::apply(ScheduleDAGInstrs *DAGInstrs) {    ScheduleDAGMI *DAG = static_cast<ScheduleDAGMI*>(DAGInstrs); @@ -128,23 +136,18 @@ bool MacroFusion::scheduleAdjacentImpl(ScheduleDAGMI &DAG, SUnit &AnchorSU) {    return false;  } -} // end anonymous namespace - - -namespace llvm { -  std::unique_ptr<ScheduleDAGMutation> -createMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent) { +llvm::createMacroFusionDAGMutation( +     ShouldSchedulePredTy shouldScheduleAdjacent) {    if(EnableMacroFusion)      return llvm::make_unique<MacroFusion>(shouldScheduleAdjacent, true);    return nullptr;  }  std::unique_ptr<ScheduleDAGMutation> -createBranchMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent) { +llvm::createBranchMacroFusionDAGMutation( +     ShouldSchedulePredTy shouldScheduleAdjacent) {    if(EnableMacroFusion)      return llvm::make_unique<MacroFusion>(shouldScheduleAdjacent, false);    return nullptr;  } - -} // end namespace llvm  | 
