778b04d9ce751daadf0ce8d7767f1e14d0cb1628
[oota-llvm.git] / lib / Target / Mips / MipsABIInfo.h
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/MC/MCRegisterInfo.h"
15
16 namespace llvm {
17
18 class MipsABIInfo {
19 public:
20   enum class ABI { Unknown, O32, N32, N64, EABI };
21
22 protected:
23   ABI ThisABI;
24
25 public:
26   MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}
27
28   static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); }
29   static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }
30   static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }
31   static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }
32   static MipsABIInfo EABI() { return MipsABIInfo(ABI::EABI); }
33
34   bool IsKnown() const { return ThisABI != ABI::Unknown; }
35   bool IsO32() const { return ThisABI == ABI::O32; }
36   bool IsN32() const { return ThisABI == ABI::N32; }
37   bool IsN64() const { return ThisABI == ABI::N64; }
38   bool IsEABI() const { return ThisABI == ABI::EABI; }
39   ABI GetEnumValue() const { return ThisABI; }
40
41   const ArrayRef<MCPhysReg> GetByValArgRegs() const;
42
43   /// Ordering of ABI's
44   /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
45   /// multiple ABI options.
46   bool operator<(const MipsABIInfo Other) const {
47     return ThisABI < Other.GetEnumValue();
48   }
49 };
50 }
51
52 #endif