Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/Mips/MCTargetDesc/MipsABIInfo.h
Line
Count
Source (jump to first uncovered line)
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
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
10
#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
11
12
#include "llvm/ADT/Triple.h"
13
#include "llvm/IR/CallingConv.h"
14
#include "llvm/MC/MCRegisterInfo.h"
15
16
namespace llvm {
17
18
template <typename T> class ArrayRef;
19
class MCTargetOptions;
20
class StringRef;
21
class TargetRegisterClass;
22
23
class MipsABIInfo {
24
public:
25
  enum class ABI { Unknown, O32, N32, N64 };
26
27
protected:
28
  ABI ThisABI;
29
30
public:
31
12.0k
  MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}
32
33
2.09k
  static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); }
34
6.58k
  static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }
35
523
  static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }
36
2.86k
  static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }
37
  static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU,
38
                                      const MCTargetOptions &Options);
39
40
0
  bool IsKnown() const { return ThisABI != ABI::Unknown; }
41
143k
  bool IsO32() const { return ThisABI == ABI::O32; }
42
195k
  bool IsN32() const { return ThisABI == ABI::N32; }
43
654k
  bool IsN64() const { return ThisABI == ABI::N64; }
44
2.01k
  ABI GetEnumValue() const { return ThisABI; }
45
46
  /// The registers to use for byval arguments.
47
  ArrayRef<MCPhysReg> GetByValArgRegs() const;
48
49
  /// The registers to use for the variable argument list.
50
  ArrayRef<MCPhysReg> GetVarArgRegs() const;
51
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;
55
56
  /// Ordering of ABI's
57
  /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
58
  /// multiple ABI options.
59
0
  bool operator<(const MipsABIInfo Other) const {
60
0
    return ThisABI < Other.GetEnumValue();
61
0
  }
62
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
310k
  inline bool ArePtrs64bit() const { return IsN64(); }
75
1.63k
  inline bool AreGprs64bit() const { return IsN32() || 
IsN64()1.62k
; }
76
77
  unsigned GetEhDataReg(unsigned I) const;
78
};
79
}
80
81
#endif