Coverage Report

Created: 2018-11-12 17:33

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/MC/MachineLocation.h
Line
Count
Source (jump to first uncovered line)
1
//===- llvm/MC/MachineLocation.h --------------------------------*- C++ -*-===//
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
// The MachineLocation class is used to represent a simple location in a machine
10
// frame.  Locations will be one of two forms; a register or an address formed
11
// from a base address plus an offset.  Register indirection can be specified by
12
// explicitly passing an offset to the constructor.
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_MC_MACHINELOCATION_H
16
#define LLVM_MC_MACHINELOCATION_H
17
18
#include <cstdint>
19
#include <cassert>
20
21
namespace llvm {
22
23
class MachineLocation {
24
private:
25
  bool IsRegister = false;              ///< True if location is a register.
26
  unsigned Register = 0;                ///< gcc/gdb register number.
27
28
public:
29
  enum : uint32_t {
30
    // The target register number for an abstract frame pointer. The value is
31
    // an arbitrary value that doesn't collide with any real target register.
32
    VirtualFP = ~0U
33
  };
34
35
51
  MachineLocation() = default;
36
  /// Create a direct register location.
37
  explicit MachineLocation(unsigned R, bool Indirect = false)
38
1.94k
      : IsRegister(!Indirect), Register(R) {}
39
40
504
  bool operator==(const MachineLocation &Other) const {
41
504
    return IsRegister == Other.IsRegister && 
Register == Other.Register501
;
42
504
  }
43
44
  // Accessors.
45
  /// \return true iff this is a register-indirect location.
46
1.51k
  bool isIndirect()      const { return !IsRegister; }
47
0
  bool isReg()           const { return IsRegister; }
48
2.42k
  unsigned getReg()      const { return Register; }
49
0
  void setIsRegister(bool Is)  { IsRegister = Is; }
50
0
  void setRegister(unsigned R) { Register = R; }
51
};
52
53
0
inline bool operator!=(const MachineLocation &LHS, const MachineLocation &RHS) {
54
0
  return !(LHS == RHS);
55
0
}
56
57
} // end namespace llvm
58
59
#endif // LLVM_MC_MACHINELOCATION_H