LLVM  14.0.0git
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"
18 #include "llvm/ADT/StringSet.h"
20 #include <cassert>
21 
22 namespace llvm {
23 
24 class MCSymbol;
25 
26 /// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
27 /// for MachO targets.
29  /// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
30  /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
31  /// is true if this GV is external.
33 
34  /// ThreadLocalGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something
35  /// like "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra
36  /// bit is true if this GV is external.
37  DenseMap<MCSymbol *, StubValueTy> ThreadLocalGVStubs;
38 
39  virtual void anchor(); // Out of line virtual method.
40 
41 public:
43 
45  assert(Sym && "Key cannot be null");
46  return GVStubs[Sym];
47  }
48 
50  assert(Sym && "Key cannot be null");
51  return ThreadLocalGVStubs[Sym];
52  }
53 
54  /// Accessor methods to return the set of stubs in sorted order.
55  SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
57  return getSortedStubs(ThreadLocalGVStubs);
58  }
59 };
60 
61 /// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
62 /// for ELF targets.
64  /// GVStubs - These stubs are used to materialize global addresses in PIC
65  /// mode.
67 
68  virtual void anchor(); // Out of line virtual method.
69 
70 public:
72 
74  assert(Sym && "Key cannot be null");
75  return GVStubs[Sym];
76  }
77 
78  /// Accessor methods to return the set of stubs in sorted order.
79 
80  SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
81 };
82 
83 /// MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation
84 /// for COFF targets.
86  /// GVStubs - These stubs are used to materialize global addresses in PIC
87  /// mode.
89 
90  virtual void anchor(); // Out of line virtual method.
91 
92 public:
94 
96  assert(Sym && "Key cannot be null");
97  return GVStubs[Sym];
98  }
99 
100  /// Accessor methods to return the set of stubs in sorted order.
101 
103 };
104 
105 /// MachineModuleInfoWasm - This is a MachineModuleInfoImpl implementation
106 /// for Wasm targets.
108  virtual void anchor(); // Out of line virtual method.
109 
110 public:
112 
114 };
115 
116 } // end namespace llvm
117 
118 #endif // LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::MachineModuleInfoWasm::MachineSymbolsUsed
StringSet MachineSymbolsUsed
Definition: MachineModuleInfoImpls.h:113
llvm::MachineModuleInfoImpl::SymbolListTy
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
Definition: MachineModuleInfo.h:63
llvm::MachineModuleInfoImpl::StubValueTy
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
Definition: MachineModuleInfo.h:62
llvm::MachineModuleInfoImpl
This class can be derived from and used by targets to hold private target-specific information for ea...
Definition: MachineModuleInfo.h:60
DenseMap.h
llvm::MachineModuleInfoMachO::getGVStubEntry
StubValueTy & getGVStubEntry(MCSymbol *Sym)
Definition: MachineModuleInfoImpls.h:44
llvm::MachineModuleInfoMachO::GetThreadLocalGVStubList
SymbolListTy GetThreadLocalGVStubList()
Definition: MachineModuleInfoImpls.h:56
llvm::MachineModuleInfo
This class contains meta information specific to a module.
Definition: MachineModuleInfo.h:78
llvm::MachineModuleInfoWasm::MachineModuleInfoWasm
MachineModuleInfoWasm(const MachineModuleInfo &)
Definition: MachineModuleInfoImpls.h:111
llvm::MachineModuleInfoCOFF
MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation for COFF targets.
Definition: MachineModuleInfoImpls.h:85
llvm::MachineModuleInfoImpl::getSortedStubs
static SymbolListTy getSortedStubs(DenseMap< MCSymbol *, StubValueTy > &)
Return the entries from a DenseMap in a deterministic sorted orer.
Definition: MachineModuleInfoImpls.cpp:35
llvm::DenseMap
Definition: DenseMap.h:714
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineModuleInfo.h
llvm::MachineModuleInfoCOFF::GetGVStubList
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
Definition: MachineModuleInfoImpls.h:102
llvm::StringSet
StringSet - A wrapper for StringMap that provides set-like functionality.
Definition: StringSet.h:22
llvm::MachineModuleInfoELF::getGVStubEntry
StubValueTy & getGVStubEntry(MCSymbol *Sym)
Definition: MachineModuleInfoImpls.h:73
llvm::MachineModuleInfoWasm
MachineModuleInfoWasm - This is a MachineModuleInfoImpl implementation for Wasm targets.
Definition: MachineModuleInfoImpls.h:107
llvm::MachineModuleInfoCOFF::getGVStubEntry
StubValueTy & getGVStubEntry(MCSymbol *Sym)
Definition: MachineModuleInfoImpls.h:95
llvm::MachineModuleInfoMachO::MachineModuleInfoMachO
MachineModuleInfoMachO(const MachineModuleInfo &)
Definition: MachineModuleInfoImpls.h:42
llvm::MachineModuleInfoELF::GetGVStubList
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
Definition: MachineModuleInfoImpls.h:80
StringSet.h
llvm::MachineModuleInfoCOFF::MachineModuleInfoCOFF
MachineModuleInfoCOFF(const MachineModuleInfo &)
Definition: MachineModuleInfoImpls.h:93
llvm::MachineModuleInfoMachO::GetGVStubList
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
Definition: MachineModuleInfoImpls.h:55
llvm::MachineModuleInfoELF::MachineModuleInfoELF
MachineModuleInfoELF(const MachineModuleInfo &)
Definition: MachineModuleInfoImpls.h:71
llvm::PointerIntPair
PointerIntPair - This class implements a pair of a pointer and small integer.
Definition: PointerIntPair.h:45
llvm::MachineModuleInfoELF
MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation for ELF targets.
Definition: MachineModuleInfoImpls.h:63
llvm::MachineModuleInfoMachO::getThreadLocalGVStubEntry
StubValueTy & getThreadLocalGVStubEntry(MCSymbol *Sym)
Definition: MachineModuleInfoImpls.h:49
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172
llvm::MachineModuleInfoMachO
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets.
Definition: MachineModuleInfoImpls.h:28