Coverage Report

Created: 2019-02-20 07:29

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h
Line
Count
Source
1
//===- llvm/CodeGen/MachineModuleInfoImpls.h --------------------*- C++ -*-===//
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
// This file defines object-file format specific implementations of
10
// MachineModuleInfoImpl.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
15
#define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
16
17
#include "llvm/ADT/DenseMap.h"
18
#include "llvm/CodeGen/MachineModuleInfo.h"
19
#include <cassert>
20
21
namespace llvm {
22
23
class MCSymbol;
24
25
/// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
26
/// for MachO targets.
27
class MachineModuleInfoMachO : public MachineModuleInfoImpl {
28
  /// GVStubs - Darwin '$non_lazy_ptr' stubs.  The key is something like
29
  /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
30
  /// is true if this GV is external.
31
  DenseMap<MCSymbol *, StubValueTy> GVStubs;
32
33
  /// ThreadLocalGVStubs - Darwin '$non_lazy_ptr' stubs.  The key is something
34
  /// like "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra
35
  /// bit is true if this GV is external.
36
  DenseMap<MCSymbol *, StubValueTy> ThreadLocalGVStubs;
37
38
  virtual void anchor(); // Out of line virtual method.
39
40
public:
41
7.46k
  MachineModuleInfoMachO(const MachineModuleInfo &) {}
42
43
17.8k
  StubValueTy &getGVStubEntry(MCSymbol *Sym) {
44
17.8k
    assert(Sym && "Key cannot be null");
45
17.8k
    return GVStubs[Sym];
46
17.8k
  }
47
48
14
  StubValueTy &getThreadLocalGVStubEntry(MCSymbol *Sym) {
49
14
    assert(Sym && "Key cannot be null");
50
14
    return ThreadLocalGVStubs[Sym];
51
14
  }
52
53
  /// Accessor methods to return the set of stubs in sorted order.
54
7.46k
  SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
55
2.89k
  SymbolListTy GetThreadLocalGVStubList() {
56
2.89k
    return getSortedStubs(ThreadLocalGVStubs);
57
2.89k
  }
58
};
59
60
/// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
61
/// for ELF targets.
62
class MachineModuleInfoELF : public MachineModuleInfoImpl {
63
  /// GVStubs - These stubs are used to materialize global addresses in PIC
64
  /// mode.
65
  DenseMap<MCSymbol *, StubValueTy> GVStubs;
66
67
  virtual void anchor(); // Out of line virtual method.
68
69
public:
70
17.6k
  MachineModuleInfoELF(const MachineModuleInfo &) {}
71
72
19
  StubValueTy &getGVStubEntry(MCSymbol *Sym) {
73
19
    assert(Sym && "Key cannot be null");
74
19
    return GVStubs[Sym];
75
19
  }
76
77
  /// Accessor methods to return the set of stubs in sorted order.
78
79
17.6k
  SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
80
};
81
82
/// MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation
83
/// for COFF targets.
84
class MachineModuleInfoCOFF : public MachineModuleInfoImpl {
85
  /// GVStubs - These stubs are used to materialize global addresses in PIC
86
  /// mode.
87
  DenseMap<MCSymbol *, StubValueTy> GVStubs;
88
89
  virtual void anchor(); // Out of line virtual method.
90
91
public:
92
819
  MachineModuleInfoCOFF(const MachineModuleInfo &) {}
93
94
86
  StubValueTy &getGVStubEntry(MCSymbol *Sym) {
95
86
    assert(Sym && "Key cannot be null");
96
86
    return GVStubs[Sym];
97
86
  }
98
99
  /// Accessor methods to return the set of stubs in sorted order.
100
101
819
  SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
102
};
103
104
} // end namespace llvm
105
106
#endif // LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H