LLVM  8.0.1
LeonPasses.h
Go to the documentation of this file.
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 
18 #include "llvm/CodeGen/Passes.h"
19 
20 #include "Sparc.h"
21 #include "SparcSubtarget.h"
22 
23 namespace llvm {
25  : public MachineFunctionPass {
26 protected:
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:
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 
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 
61  : public LEONMachineFunctionPass {
62 public:
63  static char ID;
64 
66  bool runOnMachineFunction(MachineFunction &MF) override;
67 
68  StringRef getPassName() const override {
69  return "DetectRoundChange: Leon erratum detection: detect any rounding "
70  "mode change request: use only the round-to-nearest rounding mode";
71  }
72 };
73 
75 public:
76  static char ID;
77 
79  bool runOnMachineFunction(MachineFunction &MF) override;
80 
81  StringRef getPassName() const override {
82  return "FixAllFDIVSQRT: Erratum Fix LBR34: fix FDIVS/FDIVD/FSQRTS/FSQRTD "
83  "instructions with NOPs and floating-point store";
84  }
85 };
86 } // namespace llvm
87 
88 #endif // LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:81
This class represents lattice values for constants.
Definition: AllocatorList.h:24
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:53
static char ID
Definition: LeonPasses.h:76
static char ID
Definition: LeonPasses.h:48
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:68
const SparcSubtarget * Subtarget
Definition: LeonPasses.h:27
unsigned const MachineRegisterInfo * MRI
void markRegisterUsed(int registerIndex)
Definition: LeonPasses.h:40
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:64
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
Definition: Compiler.h:108
std::vector< int > UsedRegisters
Definition: LeonPasses.h:32
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49