LLVM  9.0.0svn
MachineModuleInfoImpls.h
Go to the documentation of this file.
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"
19 #include <cassert>
20 
21 namespace llvm {
22 
23 class MCSymbol;
24 
25 /// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
26 /// for MachO targets.
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.
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:
42 
44  assert(Sym && "Key cannot be null");
45  return GVStubs[Sym];
46  }
47 
49  assert(Sym && "Key cannot be null");
50  return ThreadLocalGVStubs[Sym];
51  }
52 
53  /// Accessor methods to return the set of stubs in sorted order.
54  SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
56  return getSortedStubs(ThreadLocalGVStubs);
57  }
58 };
59 
60 /// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
61 /// for ELF targets.
63  /// GVStubs - These stubs are used to materialize global addresses in PIC
64  /// mode.
66 
67  virtual void anchor(); // Out of line virtual method.
68 
69 public:
71 
73  assert(Sym && "Key cannot be null");
74  return GVStubs[Sym];
75  }
76 
77  /// Accessor methods to return the set of stubs in sorted order.
78 
79  SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
80 };
81 
82 /// MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation
83 /// for COFF targets.
85  /// GVStubs - These stubs are used to materialize global addresses in PIC
86  /// mode.
88 
89  virtual void anchor(); // Out of line virtual method.
90 
91 public:
93 
95  assert(Sym && "Key cannot be null");
96  return GVStubs[Sym];
97  }
98 
99  /// Accessor methods to return the set of stubs in sorted order.
100 
102 };
103 
104 } // end namespace llvm
105 
106 #endif // LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
StubValueTy & getThreadLocalGVStubEntry(MCSymbol *Sym)
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation for COFF targets.
PointerIntPair - This class implements a pair of a pointer and small integer.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
StubValueTy & getGVStubEntry(MCSymbol *Sym)
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
MachineModuleInfoELF(const MachineModuleInfo &)
StubValueTy & getGVStubEntry(MCSymbol *Sym)
MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation for ELF targets.
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets...
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
MachineModuleInfoCOFF(const MachineModuleInfo &)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineModuleInfoMachO(const MachineModuleInfo &)
This class can be derived from and used by targets to hold private target-specific information for ea...
static SymbolListTy getSortedStubs(DenseMap< MCSymbol *, StubValueTy > &)
Return the entries from a DenseMap in a deterministic sorted orer.
This class contains meta information specific to a module.