LLVM  14.0.0git
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 
22 class MipsABIInfo {
23 public:
24  enum class ABI { Unknown, O32, N32, N64 };
25 
26 protected:
28 
29 public:
31 
33  static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }
34  static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }
35  static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }
36  static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU,
37  const MCTargetOptions &Options);
38 
39  bool IsKnown() const { return ThisABI != ABI::Unknown; }
40  bool IsO32() const { return ThisABI == ABI::O32; }
41  bool IsN32() const { return ThisABI == ABI::N32; }
42  bool IsN64() const { return ThisABI == ABI::N64; }
43  ABI GetEnumValue() const { return ThisABI; }
44 
45  /// The registers to use for byval arguments.
47 
48  /// The registers to use for the variable argument list.
50 
51  /// Obtain the size of the area allocated by the callee for arguments.
52  /// CallingConv::FastCall affects the value for O32.
54 
55  /// Ordering of ABI's
56  /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
57  /// multiple ABI options.
58  bool operator<(const MipsABIInfo Other) const {
59  return ThisABI < Other.GetEnumValue();
60  }
61 
62  unsigned GetStackPtr() const;
63  unsigned GetFramePtr() const;
64  unsigned GetBasePtr() const;
65  unsigned GetGlobalPtr() const;
66  unsigned GetNullPtr() const;
67  unsigned GetZeroReg() const;
68  unsigned GetPtrAdduOp() const;
69  unsigned GetPtrAddiuOp() const;
70  unsigned GetPtrSubuOp() const;
71  unsigned GetPtrAndOp() const;
72  unsigned GetGPRMoveOp() const;
73  inline bool ArePtrs64bit() const { return IsN64(); }
74  inline bool AreGprs64bit() const { return IsN32() || IsN64(); }
75 
76  unsigned GetEhDataReg(unsigned I) const;
77 };
78 }
79 
80 #endif
llvm::MipsABIInfo::GetCalleeAllocdArgSizeInBytes
unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const
Obtain the size of the area allocated by the callee for arguments.
Definition: MipsABIInfo.cpp:48
llvm::MipsABIInfo::IsN64
bool IsN64() const
Definition: MipsABIInfo.h:42
llvm::MipsABIInfo::ABI
ABI
Definition: MipsABIInfo.h:24
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MipsABIInfo::ArePtrs64bit
bool ArePtrs64bit() const
Definition: MipsABIInfo.h:73
llvm::MipsABIInfo
Definition: MipsABIInfo.h:22
llvm::MipsABIInfo::GetFramePtr
unsigned GetFramePtr() const
Definition: MipsABIInfo.cpp:77
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::MipsABIInfo::GetEnumValue
ABI GetEnumValue() const
Definition: MipsABIInfo.h:43
llvm::MipsABIInfo::AreGprs64bit
bool AreGprs64bit() const
Definition: MipsABIInfo.h:74
llvm::MipsABIInfo::GetByValArgRegs
ArrayRef< MCPhysReg > GetByValArgRegs() const
The registers to use for byval arguments.
Definition: MipsABIInfo.cpp:32
llvm::MipsABIInfo::GetStackPtr
unsigned GetStackPtr() const
Definition: MipsABIInfo.cpp:73
llvm::MipsABIInfo::GetPtrSubuOp
unsigned GetPtrSubuOp() const
Definition: MipsABIInfo.cpp:105
llvm::MipsABIInfo::GetVarArgRegs
ArrayRef< MCPhysReg > GetVarArgRegs() const
The registers to use for the variable argument list.
Definition: MipsABIInfo.cpp:40
llvm::MipsABIInfo::computeTargetABI
static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
Definition: MipsABIInfo.cpp:56
llvm::MipsABIInfo::GetPtrAddiuOp
unsigned GetPtrAddiuOp() const
Definition: MipsABIInfo.cpp:101
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::MipsABIInfo::ABI::O32
@ O32
llvm::MipsABIInfo::N32
static MipsABIInfo N32()
Definition: MipsABIInfo.h:34
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::MipsABIInfo::ABI::N64
@ N64
llvm::MipsABIInfo::N64
static MipsABIInfo N64()
Definition: MipsABIInfo.h:35
llvm::MipsABIInfo::GetPtrAndOp
unsigned GetPtrAndOp() const
Definition: MipsABIInfo.cpp:109
I
#define I(x, y, z)
Definition: MD5.cpp:59
MCRegisterInfo.h
llvm::MipsABIInfo::MipsABIInfo
MipsABIInfo(ABI ThisABI)
Definition: MipsABIInfo.h:30
llvm::MipsABIInfo::GetZeroReg
unsigned GetZeroReg() const
Definition: MipsABIInfo.cpp:93
llvm::MipsABIInfo::GetGlobalPtr
unsigned GetGlobalPtr() const
Definition: MipsABIInfo.cpp:85
llvm::MipsABIInfo::GetPtrAdduOp
unsigned GetPtrAdduOp() const
Definition: MipsABIInfo.cpp:97
llvm::MipsABIInfo::O32
static MipsABIInfo O32()
Definition: MipsABIInfo.h:33
llvm::MipsABIInfo::operator<
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:58
llvm::MipsABIInfo::ABI::N32
@ N32
llvm::MCTargetOptions
Definition: MCTargetOptions.h:36
Triple.h
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MipsABIInfo::GetEhDataReg
unsigned GetEhDataReg(unsigned I) const
Definition: MipsABIInfo.cpp:117
CallingConv.h
llvm::MipsABIInfo::IsKnown
bool IsKnown() const
Definition: MipsABIInfo.h:39
llvm::MipsABIInfo::GetGPRMoveOp
unsigned GetGPRMoveOp() const
Definition: MipsABIInfo.cpp:113
llvm::MipsABIInfo::ABI::Unknown
@ Unknown
llvm::MipsABIInfo::Unknown
static MipsABIInfo Unknown()
Definition: MipsABIInfo.h:32
llvm::MipsABIInfo::IsN32
bool IsN32() const
Definition: MipsABIInfo.h:41
llvm::MipsABIInfo::GetNullPtr
unsigned GetNullPtr() const
Definition: MipsABIInfo.cpp:89
llvm::MipsABIInfo::ThisABI
ABI ThisABI
Definition: MipsABIInfo.h:27
llvm::MipsABIInfo::IsO32
bool IsO32() const
Definition: MipsABIInfo.h:40
llvm::MipsABIInfo::GetBasePtr
unsigned GetBasePtr() const
Definition: MipsABIInfo.cpp:81
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1172