[InstCombine] Signed saturation patterns
[llvm-core.git] / lib / Target / Mips / MCTargetDesc / MipsABIInfo.h
blob534e6573b63c5eb5c3ff733783662bb1921d016c
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
10 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
12 #include "llvm/ADT/Triple.h"
13 #include "llvm/IR/CallingConv.h"
14 #include "llvm/MC/MCRegisterInfo.h"
16 namespace llvm {
18 template <typename T> class ArrayRef;
19 class MCTargetOptions;
20 class StringRef;
21 class TargetRegisterClass;
23 class MipsABIInfo {
24 public:
25 enum class ABI { Unknown, O32, N32, N64 };
27 protected:
28 ABI ThisABI;
30 public:
31 MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}
33 static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); }
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);
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; }
46 /// The registers to use for byval arguments.
47 ArrayRef<MCPhysReg> GetByValArgRegs() const;
49 /// The registers to use for the variable argument list.
50 ArrayRef<MCPhysReg> GetVarArgRegs() const;
52 /// Obtain the size of the area allocated by the callee for arguments.
53 /// CallingConv::FastCall affects the value for O32.
54 unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const;
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();
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(); }
77 unsigned GetEhDataReg(unsigned I) const;
81 #endif