//===- PPCMacroFusion.cpp - PowerPC Macro Fusion --------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // /// \file This file contains the PowerPC implementation of the DAG scheduling /// mutation to pair instructions back to back. // //===----------------------------------------------------------------------===// #include "PPC.h" #include "PPCSubtarget.h" #include "llvm/ADT/DenseSet.h" #include "llvm/CodeGen/MacroFusion.h" #include "llvm/CodeGen/ScheduleDAGMutation.h" #include <optional> usingnamespacellvm; namespace { class FusionFeature { … }; static bool matchingRegOps(const MachineInstr &FirstMI, int FirstMIOpIndex, const MachineInstr &SecondMI, int SecondMIOpIndex) { … } static bool matchingImmOps(const MachineInstr &MI, int MIOpIndex, int64_t Expect, unsigned ExtendFrom = 64) { … } // Return true if the FirstMI meets the constraints of SecondMI according to // fusion specification. static bool checkOpConstraints(FusionFeature::FusionKind Kd, const MachineInstr &FirstMI, const MachineInstr &SecondMI) { … } /// Check if the instr pair, FirstMI and SecondMI, should be fused together. /// Given SecondMI, when FirstMI is unspecified, then check if SecondMI may be /// part of a fused pair at all. static bool shouldScheduleAdjacent(const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI) { … } } // end anonymous namespace namespace llvm { std::unique_ptr<ScheduleDAGMutation> createPowerPCMacroFusionDAGMutation() { … } } // end namespace llvm