1 //===---- MipsABIInfo.h - Information about MIPS ABI's --------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
11 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/Triple.h"
15 #include "llvm/IR/CallingConv.h"
16 #include "llvm/MC/MCRegisterInfo.h"
20 class MCTargetOptions;
25 enum class ABI { Unknown, O32, N32, N64, EABI };
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 EABI() { return MipsABIInfo(ABI::EABI); }
38 static MipsABIInfo computeTargetABI(Triple TT, StringRef CPU,
39 const MCTargetOptions &Options);
41 bool IsKnown() const { return ThisABI != ABI::Unknown; }
42 bool IsO32() const { return ThisABI == ABI::O32; }
43 bool IsN32() const { return ThisABI == ABI::N32; }
44 bool IsN64() const { return ThisABI == ABI::N64; }
45 bool IsEABI() const { return ThisABI == ABI::EABI; }
46 ABI GetEnumValue() const { return ThisABI; }
48 /// The registers to use for byval arguments.
49 const ArrayRef<MCPhysReg> GetByValArgRegs() const;
51 /// The registers to use for the variable argument list.
52 const ArrayRef<MCPhysReg> GetVarArgRegs() const;
54 /// Obtain the size of the area allocated by the callee for arguments.
55 /// CallingConv::FastCall affects the value for O32.
56 unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const;
59 /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
60 /// multiple ABI options.
61 bool operator<(const MipsABIInfo Other) const {
62 return ThisABI < Other.GetEnumValue();