1 //===------- LeonPasses.h - Define passes specific to LEON ----------------===//
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
7 //===----------------------------------------------------------------------===//
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"
20 class LLVM_LIBRARY_VISIBILITY LEONMachineFunctionPass
21 : public MachineFunctionPass
{
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
28 std::vector
<int> UsedRegisters
;
31 LEONMachineFunctionPass(char &ID
);
33 void clearUsedRegisterList() { UsedRegisters
.clear(); }
35 void markRegisterUsed(int registerIndex
) {
36 UsedRegisters
.push_back(registerIndex
);
40 class LLVM_LIBRARY_VISIBILITY InsertNOPLoad
: public LEONMachineFunctionPass
{
45 bool runOnMachineFunction(MachineFunction
&MF
) override
;
47 StringRef
getPassName() const override
{
48 return "InsertNOPLoad: Erratum Fix LBR35: insert a NOP instruction after "
49 "every single-cycle load instruction when the next instruction is "
50 "another load/store instruction";
54 class LLVM_LIBRARY_VISIBILITY DetectRoundChange
55 : public LEONMachineFunctionPass
{
60 bool runOnMachineFunction(MachineFunction
&MF
) override
;
62 StringRef
getPassName() const override
{
63 return "DetectRoundChange: Leon erratum detection: detect any rounding "
64 "mode change request: use only the round-to-nearest rounding mode";
68 class LLVM_LIBRARY_VISIBILITY FixAllFDIVSQRT
: public LEONMachineFunctionPass
{
73 bool runOnMachineFunction(MachineFunction
&MF
) override
;
75 StringRef
getPassName() const override
{
76 return "FixAllFDIVSQRT: Erratum Fix LBR34: fix FDIVS/FDIVD/FSQRTS/FSQRTD "
77 "instructions with NOPs and floating-point store";
82 #endif // LLVM_LIB_TARGET_SPARC_LEON_PASSES_H