1 //===- MacroFusion.h - Macro Fusion ------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// \file This file contains the definition of the DAG scheduling mutation to
11 /// pair instructions back to back.
13 //===----------------------------------------------------------------------===//
16 #include "llvm/Target/TargetInstrInfo.h"
17 #include "llvm/CodeGen/MachineScheduler.h"
21 /// \brief Check if the instr pair, FirstMI and SecondMI, should be fused
22 /// together. Given SecondMI, when FirstMI is unspecified, then check if
23 /// SecondMI may be part of a fused pair at all.
24 typedef std::function<bool(const TargetInstrInfo &TII,
25 const TargetSubtargetInfo &TSI,
26 const MachineInstr *FirstMI,
27 const MachineInstr &SecondMI)> ShouldSchedulePredTy;
29 /// \brief Create a DAG scheduling mutation to pair instructions back to back
30 /// for instructions that benefit according to the target-specific
31 /// shouldScheduleAdjacent predicate function.
32 std::unique_ptr<ScheduleDAGMutation>
33 createMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent);
35 /// \brief Create a DAG scheduling mutation to pair branch instructions with one
36 /// of their predecessors back to back for instructions that benefit according
37 /// to the target-specific shouldScheduleAdjacent predicate function.
38 std::unique_ptr<ScheduleDAGMutation>
39 createBranchMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent);
41 } // end namespace llvm