LLVM 22.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/IR/CallingConv.h"
15
16namespace llvm {
17
18template <typename T> class ArrayRef;
19class MCTargetOptions;
20class StringRef;
21
23public:
24 enum class ABI { Unknown, O32, N32, N64 };
25
26protected:
28
29public:
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 ABIName);
37
38 bool IsKnown() const { return ThisABI != ABI::Unknown; }
39 bool IsO32() const { return ThisABI == ABI::O32; }
40 bool IsN32() const { return ThisABI == ABI::N32; }
41 bool IsN64() const { return ThisABI == ABI::N64; }
42 ABI GetEnumValue() const { return ThisABI; }
43
44 /// The registers to use for byval arguments.
46
47 /// The registers to use for the variable argument list.
48 ArrayRef<MCPhysReg> getVarArgRegs(bool isGP64bit) const;
49
50 /// Obtain the size of the area allocated by the callee for arguments.
51 /// CallingConv::FastCall affects the value for O32.
53
54 /// Ordering of ABI's
55 /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
56 /// multiple ABI options.
57 bool operator<(const MipsABIInfo Other) const {
58 return ThisABI < Other.GetEnumValue();
59 }
60
61 unsigned GetStackPtr() const;
62 unsigned GetFramePtr() const;
63 unsigned GetBasePtr() const;
64 unsigned GetGlobalPtr() const;
65 unsigned GetNullPtr() const;
66 unsigned GetZeroReg() const;
67 unsigned GetPtrAdduOp() const;
68 unsigned GetPtrAddiuOp() const;
69 unsigned GetPtrSubuOp() const;
70 unsigned GetPtrAndOp() const;
71 unsigned GetGPRMoveOp() const;
72 inline bool ArePtrs64bit() const { return IsN64(); }
73 inline bool AreGprs64bit() const { return IsN32() || IsN64(); }
74
75 unsigned GetEhDataReg(unsigned I) const;
76};
77}
78
79#endif
#define I(x, y, z)
Definition MD5.cpp:58
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
bool AreGprs64bit() const
Definition MipsABIInfo.h:73
bool IsN64() const
Definition MipsABIInfo.h:41
unsigned GetGlobalPtr() const
ABI GetEnumValue() const
Definition MipsABIInfo.h:42
static MipsABIInfo O32()
Definition MipsABIInfo.h:33
MipsABIInfo(ABI ThisABI)
Definition MipsABIInfo.h:30
unsigned GetEhDataReg(unsigned I) const
bool ArePtrs64bit() const
Definition MipsABIInfo.h:72
unsigned GetGPRMoveOp() const
unsigned GetStackPtr() const
static MipsABIInfo N32()
Definition MipsABIInfo.h:34
unsigned GetZeroReg() const
unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const
Obtain the size of the area allocated by the callee for arguments.
static MipsABIInfo N64()
Definition MipsABIInfo.h:35
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:57
unsigned GetPtrAddiuOp() const
unsigned GetPtrAndOp() const
unsigned GetFramePtr() const
static MipsABIInfo computeTargetABI(const Triple &TT, StringRef ABIName)
static MipsABIInfo Unknown()
Definition MipsABIInfo.h:32
ArrayRef< MCPhysReg > GetByValArgRegs() const
The registers to use for byval arguments.
unsigned GetNullPtr() const
ArrayRef< MCPhysReg > getVarArgRegs(bool isGP64bit) const
The registers to use for the variable argument list.
unsigned GetPtrAdduOp() const
bool IsKnown() const
Definition MipsABIInfo.h:38
bool IsN32() const
Definition MipsABIInfo.h:40
unsigned GetBasePtr() const
unsigned GetPtrSubuOp() const
bool IsO32() const
Definition MipsABIInfo.h:39
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
@ Other
Any other memory.
Definition ModRef.h:68