LLVM  10.0.0svn
MipsABIInfo.h
Go to the documentation of this file.
1 //===---- MipsABIInfo.h - Information about MIPS ABI's --------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
10 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
11 
12 #include "llvm/ADT/Triple.h"
13 #include "llvm/IR/CallingConv.h"
14 #include "llvm/MC/MCRegisterInfo.h"
15 
16 namespace llvm {
17 
18 template <typename T> class ArrayRef;
19 class MCTargetOptions;
20 class StringRef;
21 class TargetRegisterClass;
22 
23 class MipsABIInfo {
24 public:
25  enum class ABI { Unknown, O32, N32, N64 };
26 
27 protected:
29 
30 public:
31  MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}
32 
34  static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }
35  static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }
36  static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }
37  static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU,
38  const MCTargetOptions &Options);
39 
40  bool IsKnown() const { return ThisABI != ABI::Unknown; }
41  bool IsO32() const { return ThisABI == ABI::O32; }
42  bool IsN32() const { return ThisABI == ABI::N32; }
43  bool IsN64() const { return ThisABI == ABI::N64; }
44  ABI GetEnumValue() const { return ThisABI; }
45 
46  /// The registers to use for byval arguments.
48 
49  /// The registers to use for the variable argument list.
51 
52  /// Obtain the size of the area allocated by the callee for arguments.
53  /// CallingConv::FastCall affects the value for O32.
55 
56  /// Ordering of ABI's
57  /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
58  /// multiple ABI options.
59  bool operator<(const MipsABIInfo Other) const {
60  return ThisABI < Other.GetEnumValue();
61  }
62 
63  unsigned GetStackPtr() const;
64  unsigned GetFramePtr() const;
65  unsigned GetBasePtr() const;
66  unsigned GetGlobalPtr() const;
67  unsigned GetNullPtr() const;
68  unsigned GetZeroReg() const;
69  unsigned GetPtrAdduOp() const;
70  unsigned GetPtrAddiuOp() const;
71  unsigned GetPtrSubuOp() const;
72  unsigned GetPtrAndOp() const;
73  unsigned GetGPRMoveOp() const;
74  inline bool ArePtrs64bit() const { return IsN64(); }
75  inline bool AreGprs64bit() const { return IsN32() || IsN64(); }
76 
77  unsigned GetEhDataReg(unsigned I) const;
78 };
79 }
80 
81 #endif
unsigned GetPtrAdduOp() const
Definition: MipsABIInfo.cpp:97
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool ArePtrs64bit() const
Definition: MipsABIInfo.h:74
MipsABIInfo(ABI ThisABI)
Definition: MipsABIInfo.h:31
unsigned GetEhDataReg(unsigned I) const
static MipsABIInfo Unknown()
Definition: MipsABIInfo.h:33
unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const
Obtain the size of the area allocated by the callee for arguments.
Definition: MipsABIInfo.cpp:48
bool IsN32() const
Definition: MipsABIInfo.h:42
unsigned GetGlobalPtr() const
Definition: MipsABIInfo.cpp:85
bool IsN64() const
Definition: MipsABIInfo.h:43
ArrayRef< MCPhysReg > GetByValArgRegs() const
The registers to use for byval arguments.
Definition: MipsABIInfo.cpp:32
unsigned GetPtrAndOp() const
bool IsKnown() const
Definition: MipsABIInfo.h:40
unsigned GetPtrAddiuOp() const
static MipsABIInfo O32()
Definition: MipsABIInfo.h:34
bool IsO32() const
Definition: MipsABIInfo.h:41
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
bool AreGprs64bit() const
Definition: MipsABIInfo.h:75
ABI GetEnumValue() const
Definition: MipsABIInfo.h:44
unsigned GetPtrSubuOp() const
ArrayRef< MCPhysReg > GetVarArgRegs() const
The registers to use for the variable argument list.
Definition: MipsABIInfo.cpp:40
unsigned GetBasePtr() const
Definition: MipsABIInfo.cpp:81
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned GetZeroReg() const
Definition: MipsABIInfo.cpp:93
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:59
unsigned GetGPRMoveOp() const
static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
Definition: MipsABIInfo.cpp:56
static MipsABIInfo N32()
Definition: MipsABIInfo.h:35
unsigned GetStackPtr() const
Definition: MipsABIInfo.cpp:73
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
unsigned GetNullPtr() const
Definition: MipsABIInfo.cpp:89
static MipsABIInfo N64()
Definition: MipsABIInfo.h:36
unsigned GetFramePtr() const
Definition: MipsABIInfo.cpp:77