2017-06-27 00:44:03 +02:00
|
|
|
//===- MacroFusion.h - Macro Fusion -----------------------------*- C++ -*-===//
|
2017-06-19 14:53:31 +02:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file This file contains the definition of the DAG scheduling mutation to
|
|
|
|
/// pair instructions back to back.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-06-27 00:44:03 +02:00
|
|
|
#ifndef LLVM_CODEGEN_MACROFUSION_H
|
|
|
|
#define LLVM_CODEGEN_MACROFUSION_H
|
|
|
|
|
2017-06-19 14:53:31 +02:00
|
|
|
#include <functional>
|
2017-06-27 00:44:03 +02:00
|
|
|
#include <memory>
|
2017-06-19 14:53:31 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2017-06-27 00:44:03 +02:00
|
|
|
class MachineInstr;
|
|
|
|
class ScheduleDAGMutation;
|
|
|
|
class TargetInstrInfo;
|
|
|
|
class TargetSubtargetInfo;
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Check if the instr pair, FirstMI and SecondMI, should be fused
|
2017-06-19 14:53:31 +02:00
|
|
|
/// together. Given SecondMI, when FirstMI is unspecified, then check if
|
|
|
|
/// SecondMI may be part of a fused pair at all.
|
2017-06-27 00:44:03 +02:00
|
|
|
using ShouldSchedulePredTy = std::function<bool(const TargetInstrInfo &TII,
|
|
|
|
const TargetSubtargetInfo &TSI,
|
|
|
|
const MachineInstr *FirstMI,
|
|
|
|
const MachineInstr &SecondMI)>;
|
2017-06-19 14:53:31 +02:00
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Create a DAG scheduling mutation to pair instructions back to back
|
2017-06-19 14:53:31 +02:00
|
|
|
/// for instructions that benefit according to the target-specific
|
|
|
|
/// shouldScheduleAdjacent predicate function.
|
|
|
|
std::unique_ptr<ScheduleDAGMutation>
|
|
|
|
createMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent);
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Create a DAG scheduling mutation to pair branch instructions with one
|
2017-06-19 14:53:31 +02:00
|
|
|
/// of their predecessors back to back for instructions that benefit according
|
|
|
|
/// to the target-specific shouldScheduleAdjacent predicate function.
|
|
|
|
std::unique_ptr<ScheduleDAGMutation>
|
|
|
|
createBranchMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent);
|
|
|
|
|
|
|
|
} // end namespace llvm
|
2017-06-27 00:44:03 +02:00
|
|
|
|
|
|
|
#endif // LLVM_CODEGEN_MACROFUSION_H
|