]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Sparc/LeonPasses.h
Import tzdata 2017c
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / Sparc / LeonPasses.h
1 //===------- LeonPasses.h - Define passes specific to LEON ----------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
14 #define LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
15
16 #include "llvm/CodeGen/MachineBasicBlock.h"
17 #include "llvm/CodeGen/MachineFunctionPass.h"
18 #include "llvm/CodeGen/Passes.h"
19
20 #include "Sparc.h"
21 #include "SparcSubtarget.h"
22
23 namespace llvm {
24 class LLVM_LIBRARY_VISIBILITY LEONMachineFunctionPass
25     : public MachineFunctionPass {
26 protected:
27   const SparcSubtarget *Subtarget;
28   const int LAST_OPERAND = -1;
29
30   // this vector holds free registers that we allocate in groups for some of the
31   // LEON passes
32   std::vector<int> UsedRegisters;
33
34 protected:
35   LEONMachineFunctionPass(char &ID);
36
37   int GetRegIndexForOperand(MachineInstr &MI, int OperandIndex);
38   void clearUsedRegisterList() { UsedRegisters.clear(); }
39
40   void markRegisterUsed(int registerIndex) {
41     UsedRegisters.push_back(registerIndex);
42   }
43   int getUnusedFPRegister(MachineRegisterInfo &MRI);
44 };
45
46 class LLVM_LIBRARY_VISIBILITY InsertNOPLoad : public LEONMachineFunctionPass {
47 public:
48   static char ID;
49
50   InsertNOPLoad();
51   bool runOnMachineFunction(MachineFunction &MF) override;
52
53   StringRef getPassName() const override {
54     return "InsertNOPLoad: Erratum Fix LBR35: insert a NOP instruction after "
55            "every single-cycle load instruction when the next instruction is "
56            "another load/store instruction";
57   }
58 };
59
60 class LLVM_LIBRARY_VISIBILITY FixFSMULD : public LEONMachineFunctionPass {
61 public:
62   static char ID;
63
64   FixFSMULD();
65   bool runOnMachineFunction(MachineFunction &MF) override;
66
67   StringRef getPassName() const override {
68     return "FixFSMULD: Erratum Fix LBR31: do not select FSMULD";
69   }
70 };
71
72 class LLVM_LIBRARY_VISIBILITY ReplaceFMULS : public LEONMachineFunctionPass {
73 public:
74   static char ID;
75
76   ReplaceFMULS();
77   bool runOnMachineFunction(MachineFunction &MF) override;
78
79   StringRef getPassName() const override {
80     return "ReplaceFMULS: Erratum Fix LBR32: replace FMULS instruction with a "
81            "routine using conversions/double precision operations to replace "
82            "FMULS";
83   }
84 };
85
86 class LLVM_LIBRARY_VISIBILITY DetectRoundChange
87     : public LEONMachineFunctionPass {
88 public:
89   static char ID;
90
91   DetectRoundChange();
92   bool runOnMachineFunction(MachineFunction &MF) override;
93
94   StringRef getPassName() const override {
95     return "DetectRoundChange: Leon erratum detection: detect any rounding "
96            "mode change request: use only the round-to-nearest rounding mode";
97   }
98 };
99
100 class LLVM_LIBRARY_VISIBILITY FixAllFDIVSQRT : public LEONMachineFunctionPass {
101 public:
102   static char ID;
103
104   FixAllFDIVSQRT();
105   bool runOnMachineFunction(MachineFunction &MF) override;
106
107   StringRef getPassName() const override {
108     return "FixAllFDIVSQRT: Erratum Fix LBR34: fix FDIVS/FDIVD/FSQRTS/FSQRTD "
109            "instructions with NOPs and floating-point store";
110   }
111 };
112 } // namespace llvm
113
114 #endif // LLVM_LIB_TARGET_SPARC_LEON_PASSES_H