LLVM  3.7.0
MipsABIInfo.h
Go to the documentation of this file.
1 //===---- MipsABIInfo.h - Information about MIPS ABI's --------------------===//
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 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
11 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
12 
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/Triple.h"
15 #include "llvm/IR/CallingConv.h"
16 #include "llvm/MC/MCRegisterInfo.h"
17 
18 namespace llvm {
19 
20 class MCTargetOptions;
21 class StringRef;
22 class TargetRegisterClass;
23 
24 class MipsABIInfo {
25 public:
26  enum class ABI { Unknown, O32, N32, N64, EABI };
27 
28 protected:
30 
31 public:
32  MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}
33 
35  static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }
36  static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }
37  static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }
38  static MipsABIInfo EABI() { return MipsABIInfo(ABI::EABI); }
39  static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU,
40  const MCTargetOptions &Options);
41 
42  bool IsKnown() const { return ThisABI != ABI::Unknown; }
43  bool IsO32() const { return ThisABI == ABI::O32; }
44  bool IsN32() const { return ThisABI == ABI::N32; }
45  bool IsN64() const { return ThisABI == ABI::N64; }
46  bool IsEABI() const { return ThisABI == ABI::EABI; }
47  ABI GetEnumValue() const { return ThisABI; }
48 
49  /// The registers to use for byval arguments.
51 
52  /// The registers to use for the variable argument list.
53  const ArrayRef<MCPhysReg> GetVarArgRegs() const;
54 
55  /// Obtain the size of the area allocated by the callee for arguments.
56  /// CallingConv::FastCall affects the value for O32.
58 
59  /// Ordering of ABI's
60  /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
61  /// multiple ABI options.
62  bool operator<(const MipsABIInfo Other) const {
63  return ThisABI < Other.GetEnumValue();
64  }
65 
66  unsigned GetStackPtr() const;
67  unsigned GetFramePtr() const;
68  unsigned GetBasePtr() const;
69  unsigned GetNullPtr() const;
70  unsigned GetPtrAdduOp() const;
71  unsigned GetPtrAddiuOp() const;
72  inline bool ArePtrs64bit() const { return IsN64(); }
73 
74  unsigned GetEhDataReg(unsigned I) const;
75 };
76 }
77 
78 #endif
bool ArePtrs64bit() const
Definition: MipsABIInfo.h:72
unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const
Obtain the size of the area allocated by the callee for arguments.
Definition: MipsABIInfo.cpp:42
MipsABIInfo(ABI ThisABI)
Definition: MipsABIInfo.h:32
static MipsABIInfo EABI()
Definition: MipsABIInfo.h:38
static MipsABIInfo Unknown()
Definition: MipsABIInfo.h:34
ELFYAML::ELF_STO Other
Definition: ELFYAML.cpp:591
bool operator<(const MipsABIInfo Other) const
Ordering of ABI's MipsGenSubtargetInfo.inc will use this to resolve conflicts when given multiple ABI...
Definition: MipsABIInfo.h:62
static MipsABIInfo O32()
Definition: MipsABIInfo.h:35
bool IsN32() const
Definition: MipsABIInfo.h:44
const ArrayRef< MCPhysReg > GetByValArgRegs() const
The registers to use for byval arguments.
Definition: MipsABIInfo.cpp:26
bool IsN64() const
Definition: MipsABIInfo.h:45
unsigned GetBasePtr() const
bool IsEABI() const
Definition: MipsABIInfo.h:46
unsigned GetEhDataReg(unsigned I) const
unsigned GetStackPtr() const
Definition: MipsABIInfo.cpp:94
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
unsigned GetNullPtr() const
bool IsO32() const
Definition: MipsABIInfo.h:43
const ArrayRef< MCPhysReg > GetVarArgRegs() const
The registers to use for the variable argument list.
Definition: MipsABIInfo.cpp:34
bool IsKnown() const
Definition: MipsABIInfo.h:42
ABI GetEnumValue() const
Definition: MipsABIInfo.h:47
#define I(x, y, z)
Definition: MD5.cpp:54
unsigned GetFramePtr() const
Definition: MipsABIInfo.cpp:98
static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
Definition: MipsABIInfo.cpp:50
static MipsABIInfo N32()
Definition: MipsABIInfo.h:36
unsigned GetPtrAdduOp() const
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
unsigned GetPtrAddiuOp() const
static MipsABIInfo N64()
Definition: MipsABIInfo.h:37