LLVM  10.0.0svn
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 
17 #include "llvm/CodeGen/Passes.h"
18 
19 #include "Sparc.h"
20 #include "SparcSubtarget.h"
21 
22 namespace llvm {
24  : public MachineFunctionPass {
25 protected:
27  const int LAST_OPERAND = -1;
28 
29  // this vector holds free registers that we allocate in groups for some of the
30  // LEON passes
31  std::vector<int> UsedRegisters;
32 
33 protected:
35 
36  int GetRegIndexForOperand(MachineInstr &MI, int OperandIndex);
37  void clearUsedRegisterList() { UsedRegisters.clear(); }
38 
39  void markRegisterUsed(int registerIndex) {
40  UsedRegisters.push_back(registerIndex);
41  }
42  int getUnusedFPRegister(MachineRegisterInfo &MRI);
43 };
44 
46 public:
47  static char ID;
48 
49  InsertNOPLoad();
50  bool runOnMachineFunction(MachineFunction &MF) override;
51 
52  StringRef getPassName() const override {
53  return "InsertNOPLoad: Erratum Fix LBR35: insert a NOP instruction after "
54  "every single-cycle load instruction when the next instruction is "
55  "another load/store instruction";
56  }
57 };
58 
60  : public LEONMachineFunctionPass {
61 public:
62  static char ID;
63 
65  bool runOnMachineFunction(MachineFunction &MF) override;
66 
67  StringRef getPassName() const override {
68  return "DetectRoundChange: Leon erratum detection: detect any rounding "
69  "mode change request: use only the round-to-nearest rounding mode";
70  }
71 };
72 
74 public:
75  static char ID;
76 
78  bool runOnMachineFunction(MachineFunction &MF) override;
79 
80  StringRef getPassName() const override {
81  return "FixAllFDIVSQRT: Erratum Fix LBR34: fix FDIVS/FDIVD/FSQRTS/FSQRTD "
82  "instructions with NOPs and floating-point store";
83  }
84 };
85 } // namespace llvm
86 
87 #endif // LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:80
This class represents lattice values for constants.
Definition: AllocatorList.h:23
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:52
static char ID
Definition: LeonPasses.h:75
static char ID
Definition: LeonPasses.h:47
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:67
const SparcSubtarget * Subtarget
Definition: LeonPasses.h:26
unsigned const MachineRegisterInfo * MRI
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
Definition: Compiler.h:124
void markRegisterUsed(int registerIndex)
Definition: LeonPasses.h:39
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
Definition: MachineInstr.h:63
std::vector< int > UsedRegisters
Definition: LeonPasses.h:31
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48