1 //===-- llvm/CodeGen/MachineModuleInfoImpls.h -------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines object-file format specific implementations of
11 // MachineModuleInfoImpl.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
16 #define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
18 #include "llvm/CodeGen/MachineModuleInfo.h"
23 /// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
24 /// for MachO targets.
25 class MachineModuleInfoMachO : public MachineModuleInfoImpl {
26 /// FnStubs - Darwin '$stub' stubs. The key is something like "Lfoo$stub",
27 /// the value is something like "_foo".
28 DenseMap<const MCSymbol*, const MCSymbol*> FnStubs;
30 /// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
31 /// "Lfoo$non_lazy_ptr", the value is something like "_foo".
32 DenseMap<const MCSymbol*, const MCSymbol*> GVStubs;
34 /// HiddenGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
35 /// "Lfoo$non_lazy_ptr", the value is something like "_foo". Unlike GVStubs
36 /// these are for things with hidden visibility.
37 DenseMap<const MCSymbol*, const MCSymbol*> HiddenGVStubs;
39 virtual void Anchor(); // Out of line virtual method.
41 MachineModuleInfoMachO(const MachineModuleInfo &) {}
43 const MCSymbol *&getFnStubEntry(const MCSymbol *Sym) {
44 assert(Sym && "Key cannot be null");
48 const MCSymbol *&getGVStubEntry(const MCSymbol *Sym) {
49 assert(Sym && "Key cannot be null");
53 const MCSymbol *&getHiddenGVStubEntry(const MCSymbol *Sym) {
54 assert(Sym && "Key cannot be null");
55 return HiddenGVStubs[Sym];
58 /// Accessor methods to return the set of stubs in sorted order.
59 typedef std::vector<std::pair<const MCSymbol*, const MCSymbol*> >
62 SymbolListTy GetFnStubList() const {
63 return GetSortedStubs(FnStubs);
65 SymbolListTy GetGVStubList() const {
66 return GetSortedStubs(GVStubs);
68 SymbolListTy GetHiddenGVStubList() const {
69 return GetSortedStubs(HiddenGVStubs);
74 GetSortedStubs(const DenseMap<const MCSymbol*, const MCSymbol*> &Map);
77 } // end namespace llvm