LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MipsMachineFunction.h
Go to the documentation of this file.
1 //===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=//
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 // This file declares the Mips specific subclass of MachineFunctionInfo.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MIPS_MACHINE_FUNCTION_INFO_H
15 #define MIPS_MACHINE_FUNCTION_INFO_H
16 
17 #include "MipsSubtarget.h"
18 #include "llvm/ADT/StringMap.h"
19 #include "llvm/ADT/ValueMap.h"
24 #include "llvm/IR/GlobalValue.h"
27 #include <utility>
28 
29 namespace llvm {
30 
31 /// \brief A class derived from PseudoSourceValue that represents a GOT entry
32 /// resolved by lazy-binding.
34 public:
35  explicit MipsCallEntry(const StringRef &N);
36  explicit MipsCallEntry(const GlobalValue *V);
37  virtual bool isConstant(const MachineFrameInfo *) const;
38  virtual bool isAliased(const MachineFrameInfo *) const;
39  virtual bool mayAlias(const MachineFrameInfo *) const;
40 
41 private:
42  virtual void printCustom(raw_ostream &O) const;
43 #ifndef NDEBUG
44  std::string Name;
45  const GlobalValue *Val;
46 #endif
47 };
48 
49 /// MipsFunctionInfo - This class is derived from MachineFunction private
50 /// Mips target-specific information for each MachineFunction.
52 public:
54  : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0),
55  VarArgsFrameIndex(0), CallsEhReturn(false)
56  {}
57 
59 
60  unsigned getSRetReturnReg() const { return SRetReturnReg; }
61  void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
62 
63  bool globalBaseRegSet() const;
64  unsigned getGlobalBaseReg();
65 
66  bool mips16SPAliasRegSet() const;
67  unsigned getMips16SPAliasReg();
68 
69  int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
70  void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
71 
72  bool hasByvalArg() const { return HasByvalArg; }
73  void setFormalArgInfo(unsigned Size, bool HasByval) {
74  IncomingArgSize = Size;
75  HasByvalArg = HasByval;
76  }
77 
78  unsigned getIncomingArgSize() const { return IncomingArgSize; }
79 
80  bool callsEhReturn() const { return CallsEhReturn; }
81  void setCallsEhReturn() { CallsEhReturn = true; }
82 
83  void createEhDataRegsFI();
84  int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
85  bool isEhDataRegFI(int FI) const;
86 
87  /// \brief Create a MachinePointerInfo that has a MipsCallEntr object
88  /// representing a GOT entry for an external function.
90 
91  /// \brief Create a MachinePointerInfo that has a MipsCallEntr object
92  /// representing a GOT entry for a global function.
94 
95 private:
96  virtual void anchor();
97 
98  MachineFunction& MF;
99  /// SRetReturnReg - Some subtargets require that sret lowering includes
100  /// returning the value of the returned struct in a register. This field
101  /// holds the virtual register into which the sret argument is passed.
102  unsigned SRetReturnReg;
103 
104  /// GlobalBaseReg - keeps track of the virtual register initialized for
105  /// use as the global base register. This is used for PIC in some PIC
106  /// relocation models.
107  unsigned GlobalBaseReg;
108 
109  /// Mips16SPAliasReg - keeps track of the virtual register initialized for
110  /// use as an alias for SP for use in load/store of halfword/byte from/to
111  /// the stack
112  unsigned Mips16SPAliasReg;
113 
114  /// VarArgsFrameIndex - FrameIndex for start of varargs area.
115  int VarArgsFrameIndex;
116 
117  /// True if function has a byval argument.
118  bool HasByvalArg;
119 
120  /// Size of incoming argument area.
121  unsigned IncomingArgSize;
122 
123  /// CallsEhReturn - Whether the function calls llvm.eh.return.
124  bool CallsEhReturn;
125 
126  /// Frame objects for spilling eh data registers.
127  int EhDataRegFI[4];
128 
129  /// MipsCallEntry maps.
130  StringMap<const MipsCallEntry *> ExternalCallEntries;
132 };
133 
134 } // end of namespace llvm
135 
136 #endif // MIPS_MACHINE_FUNCTION_INFO_H
unsigned getIncomingArgSize() const
virtual bool mayAlias(const MachineFrameInfo *) const
void setVarArgsFrameIndex(int Index)
unsigned getSRetReturnReg() const
virtual bool isConstant(const MachineFrameInfo *) const
Abstract Stack Frame Information.
#define false
Definition: ConvertUTF.c:64
A class derived from PseudoSourceValue that represents a GOT entry resolved by lazy-binding.
virtual bool isAliased(const MachineFrameInfo *) const
int getEhDataRegFI(unsigned Reg) const
bool isEhDataRegFI(int FI) const
See the file comment.
Definition: ValueMap.h:75
MipsCallEntry(const StringRef &N)
void setFormalArgInfo(unsigned Size, bool HasByval)
MipsFunctionInfo(MachineFunction &MF)
#define N
MachinePointerInfo callPtrInfo(const StringRef &Name)
Create a MachinePointerInfo that has a MipsCallEntr object representing a GOT entry for an external f...
void setSRetReturnReg(unsigned Reg)