LLVM 20.0.0git
LeonPasses.h
Go to the documentation of this file.
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//===----------------------------------------------------------------------===//
11
12#ifndef LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
13#define LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
14
16
17namespace llvm {
18class SparcSubtarget;
19
21 : public MachineFunctionPass {
22protected:
23 const SparcSubtarget *Subtarget = nullptr;
24 const int LAST_OPERAND = -1;
25
26 // this vector holds free registers that we allocate in groups for some of the
27 // LEON passes
28 std::vector<int> UsedRegisters;
29
30protected:
32
33 void clearUsedRegisterList() { UsedRegisters.clear(); }
34
35 void markRegisterUsed(int registerIndex) {
36 UsedRegisters.push_back(registerIndex);
37 }
38};
39
41protected:
45
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);
52
54 bool isFloat(MachineBasicBlock::iterator I);
55 bool isDivSqrt(MachineBasicBlock::iterator I);
56 void insertNop(MachineBasicBlock::iterator I);
57
58public:
59 static char ID;
60
62 bool runOnMachineFunction(MachineFunction &MF) override;
63
64 StringRef getPassName() const override { return "Errata workaround pass"; };
65};
66
68public:
69 static char ID;
70
72 bool runOnMachineFunction(MachineFunction &MF) override;
73
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";
78 }
79};
80
83public:
84 static char ID;
85
87 bool runOnMachineFunction(MachineFunction &MF) override;
88
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";
92 }
93};
94
96public:
97 static char ID;
98
100 bool runOnMachineFunction(MachineFunction &MF) override;
101
102 StringRef getPassName() const override {
103 return "FixAllFDIVSQRT: Erratum Fix LBR34: fix FDIVS/FDIVD/FSQRTS/FSQRTD "
104 "instructions with NOPs and floating-point store";
105 }
106};
107} // namespace llvm
108
109#endif // LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
MachineBasicBlock & MBB
#define LLVM_LIBRARY_VISIBILITY
Definition: Compiler.h:133
#define I(x, y, z)
Definition: MD5.cpp:58
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:89
bool moveNext(MachineBasicBlock::iterator &I)
const SparcSubtarget * ST
Definition: LeonPasses.h:42
const TargetInstrInfo * TII
Definition: LeonPasses.h:43
const TargetRegisterInfo * TRI
Definition: LeonPasses.h:44
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:64
static char ID
Definition: LeonPasses.h:97
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:102
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:74
static char ID
Definition: LeonPasses.h:69
void markRegisterUsed(int registerIndex)
Definition: LeonPasses.h:35
std::vector< int > UsedRegisters
Definition: LeonPasses.h:28
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18