LLVM  9.0.0svn
MacroFusion.h
Go to the documentation of this file.
1 //===- MacroFusion.h - Macro Fusion -----------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file This file contains the definition of the DAG scheduling mutation to
10 /// pair instructions back to back.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CODEGEN_MACROFUSION_H
15 #define LLVM_CODEGEN_MACROFUSION_H
16 
17 #include <functional>
18 #include <memory>
19 
20 namespace llvm {
21 
22 class MachineInstr;
23 class ScheduleDAGMutation;
24 class TargetInstrInfo;
25 class TargetSubtargetInfo;
26 
27 /// Check if the instr pair, FirstMI and SecondMI, should be fused
28 /// together. Given SecondMI, when FirstMI is unspecified, then check if
29 /// SecondMI may be part of a fused pair at all.
30 using ShouldSchedulePredTy = std::function<bool(const TargetInstrInfo &TII,
31  const TargetSubtargetInfo &TSI,
32  const MachineInstr *FirstMI,
33  const MachineInstr &SecondMI)>;
34 
35 /// Create a DAG scheduling mutation to pair instructions back to back
36 /// for instructions that benefit according to the target-specific
37 /// shouldScheduleAdjacent predicate function.
38 std::unique_ptr<ScheduleDAGMutation>
40 
41 /// Create a DAG scheduling mutation to pair branch instructions with one
42 /// of their predecessors back to back for instructions that benefit according
43 /// to the target-specific shouldScheduleAdjacent predicate function.
44 std::unique_ptr<ScheduleDAGMutation>
46 
47 } // end namespace llvm
48 
49 #endif // LLVM_CODEGEN_MACROFUSION_H
This class represents lattice values for constants.
Definition: AllocatorList.h:23
const HexagonInstrInfo * TII
std::unique_ptr< ScheduleDAGMutation > createMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent)
Create a DAG scheduling mutation to pair instructions back to back for instructions that benefit acco...
std::function< bool(const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI)> ShouldSchedulePredTy
Check if the instr pair, FirstMI and SecondMI, should be fused together.
Definition: MacroFusion.h:33
static bool shouldScheduleAdjacent(const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Check if the instr pair, FirstMI and SecondMI, should be fused together.
std::unique_ptr< ScheduleDAGMutation > createBranchMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent)
Create a DAG scheduling mutation to pair branch instructions with one of their predecessors back to b...
Representation of each machine instruction.
Definition: MachineInstr.h:63
print Print MemDeps of function