Coverage Report

Created: 2026-07-25 06:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/keystone/llvm/lib/Target/Mips/MCTargetDesc/MipsABIInfo.h
Line
Count
Source
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 LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
11
#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
12
13
#include "llvm/ADT/ArrayRef.h"
14
#include "llvm/ADT/Triple.h"
15
#include "llvm/MC/MCRegisterInfo.h"
16
17
namespace llvm_ks {
18
19
class MCTargetOptions;
20
class StringRef;
21
class TargetRegisterClass;
22
23
class MipsABIInfo {
24
public:
25
  enum class ABI { Unknown, O32, N32, N64, EABI };
26
27
protected:
28
  ABI ThisABI;
29
30
public:
31
111k
  MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}
32
33
6.57k
  static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); }
34
46.0k
  static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }
35
0
  static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }
36
59.1k
  static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }
37
0
  static MipsABIInfo EABI() { return MipsABIInfo(ABI::EABI); }
38
  static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU,
39
                                      const MCTargetOptions &Options);
40
41
0
  bool IsKnown() const { return ThisABI != ABI::Unknown; }
42
58
  bool IsO32() const { return ThisABI == ABI::O32; }
43
16.0k
  bool IsN32() const { return ThisABI == ABI::N32; }
44
17.0k
  bool IsN64() const { return ThisABI == ABI::N64; }
45
0
  bool IsEABI() const { return ThisABI == ABI::EABI; }
46
0
  ABI GetEnumValue() const { return ThisABI; }
47
48
  /// The registers to use for byval arguments.
49
  ArrayRef<MCPhysReg> GetByValArgRegs() const;
50
51
  /// The registers to use for the variable argument list.
52
  ArrayRef<MCPhysReg> GetVarArgRegs() const;
53
54
  /// Ordering of ABI's
55
  /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
56
  /// multiple ABI options.
57
0
  bool operator<(const MipsABIInfo Other) const {
58
0
    return ThisABI < Other.GetEnumValue();
59
0
  }
60
61
  unsigned GetStackPtr() const;
62
  unsigned GetFramePtr() const;
63
  unsigned GetBasePtr() const;
64
  unsigned GetNullPtr() const;
65
  unsigned GetZeroReg() const;
66
  unsigned GetPtrAdduOp() const;
67
  unsigned GetPtrAddiuOp() const;
68
  unsigned GetGPRMoveOp() const;
69
973
  inline bool ArePtrs64bit() const { return IsN64(); }
70
1.38k
  inline bool AreGprs64bit() const { return IsN32() || IsN64(); }
71
72
  unsigned GetEhDataReg(unsigned I) const;
73
};
74
}
75
76
#endif