]> git.proxmox.com Git - rustc.git/blame - src/llvm/lib/Target/Mips/MCTargetDesc/MipsABIInfo.h
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / lib / Target / Mips / MCTargetDesc / MipsABIInfo.h
CommitLineData
85aaf69f
SL
1//===---- MipsABIInfo.h - Information about MIPS ABI's --------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef MIPSABIINFO_H
11#define MIPSABIINFO_H
12
13#include "llvm/ADT/ArrayRef.h"
14#include "llvm/IR/CallingConv.h"
15#include "llvm/MC/MCRegisterInfo.h"
16
17namespace llvm {
18
19class MipsABIInfo {
20public:
21 enum class ABI { Unknown, O32, N32, N64, EABI };
22
23protected:
24 ABI ThisABI;
25
26public:
27 MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}
28
29 static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); }
30 static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }
31 static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }
32 static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }
33 static MipsABIInfo EABI() { return MipsABIInfo(ABI::EABI); }
34
35 bool IsKnown() const { return ThisABI != ABI::Unknown; }
36 bool IsO32() const { return ThisABI == ABI::O32; }
37 bool IsN32() const { return ThisABI == ABI::N32; }
38 bool IsN64() const { return ThisABI == ABI::N64; }
39 bool IsEABI() const { return ThisABI == ABI::EABI; }
40 ABI GetEnumValue() const { return ThisABI; }
41
42 /// The registers to use for byval arguments.
43 const ArrayRef<MCPhysReg> GetByValArgRegs() const;
44
45 /// The registers to use for the variable argument list.
46 const ArrayRef<MCPhysReg> GetVarArgRegs() const;
47
48 /// Obtain the size of the area allocated by the callee for arguments.
49 /// CallingConv::FastCall affects the value for O32.
50 unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const;
51
52 /// Ordering of ABI's
53 /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
54 /// multiple ABI options.
55 bool operator<(const MipsABIInfo Other) const {
56 return ThisABI < Other.GetEnumValue();
57 }
58};
59}
60
61#endif