LLVM 17.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"
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 CPU,
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
This header is deprecated in favour of llvm/TargetParser/Triple.h.
static LVOptions Options
Definition: LVOptions.cpp:25
#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:74
bool IsN64() const
Definition: MipsABIInfo.h:42
unsigned GetGlobalPtr() const
Definition: MipsABIInfo.cpp:87
ABI GetEnumValue() const
Definition: MipsABIInfo.h:43
static MipsABIInfo O32()
Definition: MipsABIInfo.h:33
MipsABIInfo(ABI ThisABI)
Definition: MipsABIInfo.h:30
unsigned GetEhDataReg(unsigned I) const
ArrayRef< MCPhysReg > GetVarArgRegs() const
The registers to use for the variable argument list.
Definition: MipsABIInfo.cpp:42
bool ArePtrs64bit() const
Definition: MipsABIInfo.h:73
unsigned GetGPRMoveOp() const
unsigned GetStackPtr() const
Definition: MipsABIInfo.cpp:75
static MipsABIInfo N32()
Definition: MipsABIInfo.h:34
unsigned GetZeroReg() const
Definition: MipsABIInfo.cpp:95
unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const
Obtain the size of the area allocated by the callee for arguments.
Definition: MipsABIInfo.cpp:50
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:58
unsigned GetPtrAddiuOp() const
unsigned GetPtrAndOp() const
unsigned GetFramePtr() const
Definition: MipsABIInfo.cpp:79
static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
Definition: MipsABIInfo.cpp:58
static MipsABIInfo Unknown()
Definition: MipsABIInfo.h:32
ArrayRef< MCPhysReg > GetByValArgRegs() const
The registers to use for byval arguments.
Definition: MipsABIInfo.cpp:34
unsigned GetNullPtr() const
Definition: MipsABIInfo.cpp:91
unsigned GetPtrAdduOp() const
Definition: MipsABIInfo.cpp:99
bool IsKnown() const
Definition: MipsABIInfo.h:39
bool IsN32() const
Definition: MipsABIInfo.h:41
unsigned GetBasePtr() const
Definition: MipsABIInfo.cpp:83
unsigned GetPtrSubuOp() const
bool IsO32() const
Definition: MipsABIInfo.h:40
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ArrayRef(const T &OneElt) -> ArrayRef< T >