LLVM  8.0.0svn
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/Triple.h"
14 #include "llvm/IR/CallingConv.h"
15 #include "llvm/MC/MCRegisterInfo.h"
16 
17 namespace llvm {
18 
19 template <typename T> class ArrayRef;
20 class MCTargetOptions;
21 class StringRef;
22 class TargetRegisterClass;
23 
24 class MipsABIInfo {
25 public:
26  enum class ABI { Unknown, O32, N32, N64 };
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 computeTargetABI(const Triple &TT, StringRef CPU,
39  const MCTargetOptions &Options);
40 
41  bool IsKnown() const { return ThisABI != ABI::Unknown; }
42  bool IsO32() const { return ThisABI == ABI::O32; }
43  bool IsN32() const { return ThisABI == ABI::N32; }
44  bool IsN64() const { return ThisABI == ABI::N64; }
45  ABI GetEnumValue() const { return ThisABI; }
46 
47  /// The registers to use for byval arguments.
49 
50  /// The registers to use for the variable argument list.
52 
53  /// Obtain the size of the area allocated by the callee for arguments.
54  /// CallingConv::FastCall affects the value for O32.
56 
57  /// Ordering of ABI's
58  /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
59  /// multiple ABI options.
60  bool operator<(const MipsABIInfo Other) const {
61  return ThisABI < Other.GetEnumValue();
62  }
63 
64  unsigned GetStackPtr() const;
65  unsigned GetFramePtr() const;
66  unsigned GetBasePtr() const;
67  unsigned GetGlobalPtr() const;
68  unsigned GetNullPtr() const;
69  unsigned GetZeroReg() const;
70  unsigned GetPtrAdduOp() const;
71  unsigned GetPtrAddiuOp() const;
72  unsigned GetPtrSubuOp() const;
73  unsigned GetPtrAndOp() const;
74  unsigned GetGPRMoveOp() const;
75  inline bool ArePtrs64bit() const { return IsN64(); }
76  inline bool AreGprs64bit() const { return IsN32() || IsN64(); }
77 
78  unsigned GetEhDataReg(unsigned I) const;
79 };
80 }
81 
82 #endif
unsigned GetPtrAdduOp() const
Definition: MipsABIInfo.cpp:91
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
bool ArePtrs64bit() const
Definition: MipsABIInfo.h:75
MipsABIInfo(ABI ThisABI)
Definition: MipsABIInfo.h:32
unsigned GetEhDataReg(unsigned I) const
static MipsABIInfo Unknown()
Definition: MipsABIInfo.h:34
unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const
Obtain the size of the area allocated by the callee for arguments.
Definition: MipsABIInfo.cpp:42
bool IsN32() const
Definition: MipsABIInfo.h:43
unsigned GetGlobalPtr() const
Definition: MipsABIInfo.cpp:79
bool IsN64() const
Definition: MipsABIInfo.h:44
ArrayRef< MCPhysReg > GetByValArgRegs() const
The registers to use for byval arguments.
Definition: MipsABIInfo.cpp:26
unsigned GetPtrAndOp() const
bool IsKnown() const
Definition: MipsABIInfo.h:41
unsigned GetPtrAddiuOp() const
Definition: MipsABIInfo.cpp:95
static MipsABIInfo O32()
Definition: MipsABIInfo.h:35
bool IsO32() const
Definition: MipsABIInfo.h:42
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool AreGprs64bit() const
Definition: MipsABIInfo.h:76
ABI GetEnumValue() const
Definition: MipsABIInfo.h:45
unsigned GetPtrSubuOp() const
Definition: MipsABIInfo.cpp:99
ArrayRef< MCPhysReg > GetVarArgRegs() const
The registers to use for the variable argument list.
Definition: MipsABIInfo.cpp:34
unsigned GetBasePtr() const
Definition: MipsABIInfo.cpp:75
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned GetZeroReg() const
Definition: MipsABIInfo.cpp:87
bool operator<(const MipsABIInfo Other) const
Ordering of ABI&#39;s MipsGenSubtargetInfo.inc will use this to resolve conflicts when given multiple ABI...
Definition: MipsABIInfo.h:60
unsigned GetGPRMoveOp() const
static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
Definition: MipsABIInfo.cpp:50
static MipsABIInfo N32()
Definition: MipsABIInfo.h:36
unsigned GetStackPtr() const
Definition: MipsABIInfo.cpp:67
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
unsigned GetNullPtr() const
Definition: MipsABIInfo.cpp:83
static MipsABIInfo N64()
Definition: MipsABIInfo.h:37
unsigned GetFramePtr() const
Definition: MipsABIInfo.cpp:71