Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===- MacroFusion.h - Macro Fusion -----------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | /// \file This file contains the definition of the DAG scheduling mutation to |
| 11 | /// pair instructions back to back. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_CODEGEN_MACROFUSION_H |
| 16 | #define LLVM_CODEGEN_MACROFUSION_H |
| 17 | |
| 18 | #include <functional> |
| 19 | #include <memory> |
| 20 | |
| 21 | namespace llvm { |
| 22 | |
| 23 | class MachineInstr; |
| 24 | class ScheduleDAGMutation; |
| 25 | class TargetInstrInfo; |
| 26 | class TargetSubtargetInfo; |
| 27 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 28 | /// Check if the instr pair, FirstMI and SecondMI, should be fused |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 29 | /// together. Given SecondMI, when FirstMI is unspecified, then check if |
| 30 | /// SecondMI may be part of a fused pair at all. |
| 31 | using ShouldSchedulePredTy = std::function<bool(const TargetInstrInfo &TII, |
| 32 | const TargetSubtargetInfo &TSI, |
| 33 | const MachineInstr *FirstMI, |
| 34 | const MachineInstr &SecondMI)>; |
| 35 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 36 | /// Create a DAG scheduling mutation to pair instructions back to back |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 37 | /// for instructions that benefit according to the target-specific |
| 38 | /// shouldScheduleAdjacent predicate function. |
| 39 | std::unique_ptr<ScheduleDAGMutation> |
| 40 | createMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent); |
| 41 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 42 | /// Create a DAG scheduling mutation to pair branch instructions with one |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 43 | /// of their predecessors back to back for instructions that benefit according |
| 44 | /// to the target-specific shouldScheduleAdjacent predicate function. |
| 45 | std::unique_ptr<ScheduleDAGMutation> |
| 46 | createBranchMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent); |
| 47 | |
| 48 | } // end namespace llvm |
| 49 | |
| 50 | #endif // LLVM_CODEGEN_MACROFUSION_H |