Path: blob/main/contrib/llvm-project/llvm/lib/Target/Sparc/LeonPasses.h
35269 views
//===------- LeonPasses.h - Define passes specific to LEON ----------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8//9//===----------------------------------------------------------------------===//1011#ifndef LLVM_LIB_TARGET_SPARC_LEON_PASSES_H12#define LLVM_LIB_TARGET_SPARC_LEON_PASSES_H1314#include "llvm/CodeGen/MachineFunctionPass.h"1516namespace llvm {17class SparcSubtarget;1819class LLVM_LIBRARY_VISIBILITY LEONMachineFunctionPass20: public MachineFunctionPass {21protected:22const SparcSubtarget *Subtarget = nullptr;23const int LAST_OPERAND = -1;2425// this vector holds free registers that we allocate in groups for some of the26// LEON passes27std::vector<int> UsedRegisters;2829protected:30LEONMachineFunctionPass(char &ID);3132void clearUsedRegisterList() { UsedRegisters.clear(); }3334void markRegisterUsed(int registerIndex) {35UsedRegisters.push_back(registerIndex);36}37};3839class LLVM_LIBRARY_VISIBILITY InsertNOPLoad : public LEONMachineFunctionPass {40public:41static char ID;4243InsertNOPLoad();44bool runOnMachineFunction(MachineFunction &MF) override;4546StringRef getPassName() const override {47return "InsertNOPLoad: Erratum Fix LBR35: insert a NOP instruction after "48"every single-cycle load instruction when the next instruction is "49"another load/store instruction";50}51};5253class LLVM_LIBRARY_VISIBILITY DetectRoundChange54: public LEONMachineFunctionPass {55public:56static char ID;5758DetectRoundChange();59bool runOnMachineFunction(MachineFunction &MF) override;6061StringRef getPassName() const override {62return "DetectRoundChange: Leon erratum detection: detect any rounding "63"mode change request: use only the round-to-nearest rounding mode";64}65};6667class LLVM_LIBRARY_VISIBILITY FixAllFDIVSQRT : public LEONMachineFunctionPass {68public:69static char ID;7071FixAllFDIVSQRT();72bool runOnMachineFunction(MachineFunction &MF) override;7374StringRef getPassName() const override {75return "FixAllFDIVSQRT: Erratum Fix LBR34: fix FDIVS/FDIVD/FSQRTS/FSQRTD "76"instructions with NOPs and floating-point store";77}78};79} // namespace llvm8081#endif // LLVM_LIB_TARGET_SPARC_LEON_PASSES_H828384