xref: /freebsd/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCMachineScheduler.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
1 //===- PPCMachineScheduler.h - Custom PowerPC MI scheduler --*- 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 // Custom PowerPC MI scheduler.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_POWERPC_POWERPCMACHINESCHEDULER_H
14 #define LLVM_LIB_TARGET_POWERPC_POWERPCMACHINESCHEDULER_H
15 
16 #include "llvm/CodeGen/MachineScheduler.h"
17 
18 namespace llvm {
19 
20 /// A MachineSchedStrategy implementation for PowerPC pre RA scheduling.
21 class PPCPreRASchedStrategy : public GenericScheduler {
22 public:
PPCPreRASchedStrategy(const MachineSchedContext * C)23   PPCPreRASchedStrategy(const MachineSchedContext *C) :
24     GenericScheduler(C) {}
25 protected:
26   bool tryCandidate(SchedCandidate &Cand, SchedCandidate &TryCand,
27                     SchedBoundary *Zone) const override;
28 
29 private:
30   bool biasAddiLoadCandidate(SchedCandidate &Cand,
31                              SchedCandidate &TryCand,
32                              SchedBoundary &Zone) const;
33 };
34 
35 /// A MachineSchedStrategy implementation for PowerPC post RA scheduling.
36 class PPCPostRASchedStrategy : public PostGenericScheduler {
37 public:
PPCPostRASchedStrategy(const MachineSchedContext * C)38   PPCPostRASchedStrategy(const MachineSchedContext *C) :
39     PostGenericScheduler(C) {}
40 
41 protected:
42   void initialize(ScheduleDAGMI *Dag) override;
43   SUnit *pickNode(bool &IsTopNode) override;
44   void enterMBB(MachineBasicBlock *MBB) override;
45   void leaveMBB() override;
46 
47   bool tryCandidate(SchedCandidate &Cand, SchedCandidate &TryCand) override;
48   bool biasAddiCandidate(SchedCandidate &Cand, SchedCandidate &TryCand) const;
49 };
50 
51 } // end namespace llvm
52 
53 #endif // LLVM_LIB_TARGET_POWERPC_POWERPCMACHINESCHEDULER_H
54