LLVM  4.0.0
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:
37 
38  int GetRegIndexForOperand(MachineInstr &MI, int OperandIndex);
39  void clearUsedRegisterList() { UsedRegisters.clear(); }
40 
41  void markRegisterUsed(int registerIndex) {
42  UsedRegisters.push_back(registerIndex);
43  }
44  int getUnusedFPRegister(MachineRegisterInfo &MRI);
45 };
46 
48 public:
49  static char ID;
50 
52  bool runOnMachineFunction(MachineFunction &MF) override;
53 
54  StringRef getPassName() const override {
55  return "InsertNOPLoad: Erratum Fix LBR35: insert a NOP instruction after "
56  "every single-cycle load instruction when the next instruction is "
57  "another load/store instruction";
58  }
59 };
60 
62 public:
63  static char ID;
64 
66  bool runOnMachineFunction(MachineFunction &MF) override;
67 
68  StringRef getPassName() const override {
69  return "FixFSMULD: Erratum Fix LBR31: do not select FSMULD";
70  }
71 };
72 
74 public:
75  static char ID;
76 
78  bool runOnMachineFunction(MachineFunction &MF) override;
79 
80  StringRef getPassName() const override {
81  return "ReplaceFMULS: Erratum Fix LBR32: replace FMULS instruction with a "
82  "routine using conversions/double precision operations to replace "
83  "FMULS";
84  }
85 };
86 
88  : public LEONMachineFunctionPass {
89 public:
90  static char ID;
91 
93  bool runOnMachineFunction(MachineFunction &MF) override;
94 
95  StringRef getPassName() const override {
96  return "DetectRoundChange: Leon erratum detection: detect any rounding "
97  "mode change request: use only the round-to-nearest rounding mode";
98  }
99 };
100 
102 public:
103  static char ID;
104 
106  bool runOnMachineFunction(MachineFunction &MF) override;
107 
108  StringRef getPassName() const override {
109  return "FixAllFDIVSQRT: Erratum Fix LBR34: fix FDIVS/FDIVD/FSQRTS/FSQRTD "
110  "instructions with NOPs and floating-point store";
111  }
112 };
113 } // namespace llvm
114 
115 #endif // LLVM_LIB_TARGET_SPARC_LEON_PASSES_H
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:108
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:54
static char ID
Definition: LeonPasses.h:49
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:80
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:95
const SparcSubtarget * Subtarget
Definition: LeonPasses.h:27
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:105
void markRegisterUsed(int registerIndex)
Definition: LeonPasses.h:41
static char ID
Definition: LeonPasses.h:63
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:52
std::vector< int > UsedRegisters
Definition: LeonPasses.h:32
Primary interface to the complete machine description for the target machine.
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
static char ID
Definition: LeonPasses.h:75
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LeonPasses.h:68