Add gfx950 mfma instructions to ROCDL dialect (#123361)
[llvm-project.git] / llvm / lib / Target / Sparc / LeonPasses.h
blob261b283fadaeb3152540b73a1965dd472e64be0f
1 //===------- LeonPasses.h - Define passes specific to LEON ----------------===//
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 //
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
13 #define LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
15 #include "llvm/CodeGen/MachineFunctionPass.h"
17 namespace llvm {
18 class SparcSubtarget;
20 class LLVM_LIBRARY_VISIBILITY LEONMachineFunctionPass
21 : public MachineFunctionPass {
22 protected:
23 const SparcSubtarget *Subtarget = nullptr;
24 const int LAST_OPERAND = -1;
26 // this vector holds free registers that we allocate in groups for some of the
27 // LEON passes
28 std::vector<int> UsedRegisters;
30 protected:
31 LEONMachineFunctionPass(char &ID);
33 void clearUsedRegisterList() { UsedRegisters.clear(); }
35 void markRegisterUsed(int registerIndex) {
36 UsedRegisters.push_back(registerIndex);
40 class LLVM_LIBRARY_VISIBILITY ErrataWorkaround : public MachineFunctionPass {
41 protected:
42 const SparcSubtarget *ST;
43 const TargetInstrInfo *TII;
44 const TargetRegisterInfo *TRI;
46 bool checkSeqTN0009A(MachineBasicBlock::iterator I);
47 bool checkSeqTN0009B(MachineBasicBlock::iterator I);
48 bool checkSeqTN0010First(MachineBasicBlock &MBB);
49 bool checkSeqTN0010(MachineBasicBlock::iterator I);
50 bool checkSeqTN0012(MachineBasicBlock::iterator I);
51 bool checkSeqTN0013(MachineBasicBlock::iterator I);
53 bool moveNext(MachineBasicBlock::iterator &I);
54 bool isFloat(MachineBasicBlock::iterator I);
55 bool isDivSqrt(MachineBasicBlock::iterator I);
56 void insertNop(MachineBasicBlock::iterator I);
58 public:
59 static char ID;
61 ErrataWorkaround();
62 bool runOnMachineFunction(MachineFunction &MF) override;
64 StringRef getPassName() const override { return "Errata workaround pass"; };
67 class LLVM_LIBRARY_VISIBILITY InsertNOPLoad : public LEONMachineFunctionPass {
68 public:
69 static char ID;
71 InsertNOPLoad();
72 bool runOnMachineFunction(MachineFunction &MF) override;
74 StringRef getPassName() const override {
75 return "InsertNOPLoad: Erratum Fix LBR35: insert a NOP instruction after "
76 "every single-cycle load instruction when the next instruction is "
77 "another load/store instruction";
81 class LLVM_LIBRARY_VISIBILITY DetectRoundChange
82 : public LEONMachineFunctionPass {
83 public:
84 static char ID;
86 DetectRoundChange();
87 bool runOnMachineFunction(MachineFunction &MF) override;
89 StringRef getPassName() const override {
90 return "DetectRoundChange: Leon erratum detection: detect any rounding "
91 "mode change request: use only the round-to-nearest rounding mode";
95 class LLVM_LIBRARY_VISIBILITY FixAllFDIVSQRT : public LEONMachineFunctionPass {
96 public:
97 static char ID;
99 FixAllFDIVSQRT();
100 bool runOnMachineFunction(MachineFunction &MF) override;
102 StringRef getPassName() const override {
103 return "FixAllFDIVSQRT: Erratum Fix LBR34: fix FDIVS/FDIVD/FSQRTS/FSQRTD "
104 "instructions with NOPs and floating-point store";
107 } // namespace llvm
109 #endif // LLVM_LIB_TARGET_SPARC_LEON_PASSES_H