1f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===- llvm/CodeGen/MachineModuleInfoImpls.h --------------------*- C++ -*-===//
2f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
3f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//                     The LLVM Compiler Infrastructure
4f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
5f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This file is distributed under the University of Illinois Open Source
6f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// License. See LICENSE.TXT for details.
7f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
8f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===//
9f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
10f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This file defines object-file format specific implementations of
11f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// MachineModuleInfoImpl.
12f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
13f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===//
14f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
15f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
16f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
17f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
18f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/ADT/DenseMap.h"
19f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/CodeGen/MachineModuleInfo.h"
20f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include <cassert>
21f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
22f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace llvm {
23f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
24f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass MCSymbol;
25f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
26f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
27f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// for MachO targets.
28f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass MachineModuleInfoMachO : public MachineModuleInfoImpl {
29f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// GVStubs - Darwin '$non_lazy_ptr' stubs.  The key is something like
30f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
31f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// is true if this GV is external.
32f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  DenseMap<MCSymbol *, StubValueTy> GVStubs;
33f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
34f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// ThreadLocalGVStubs - Darwin '$non_lazy_ptr' stubs.  The key is something
35f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// like "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra
36f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// bit is true if this GV is external.
37f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  DenseMap<MCSymbol *, StubValueTy> ThreadLocalGVStubs;
38f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
39f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual void anchor(); // Out of line virtual method.
40f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
41f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
42f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  MachineModuleInfoMachO(const MachineModuleInfo &) {}
43f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
44f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  StubValueTy &getGVStubEntry(MCSymbol *Sym) {
45f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    assert(Sym && "Key cannot be null");
46f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    return GVStubs[Sym];
47f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  }
48f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
49f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  StubValueTy &getThreadLocalGVStubEntry(MCSymbol *Sym) {
50f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    assert(Sym && "Key cannot be null");
51f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    return ThreadLocalGVStubs[Sym];
52f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  }
53f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
54f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Accessor methods to return the set of stubs in sorted order.
55f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
56f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  SymbolListTy GetThreadLocalGVStubList() {
57f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    return getSortedStubs(ThreadLocalGVStubs);
58f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  }
59f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
60f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
61f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
62f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// for ELF targets.
63f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass MachineModuleInfoELF : public MachineModuleInfoImpl {
64f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// GVStubs - These stubs are used to materialize global addresses in PIC
65f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// mode.
66f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  DenseMap<MCSymbol *, StubValueTy> GVStubs;
67f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
68f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual void anchor(); // Out of line virtual method.
69f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
70f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
71f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  MachineModuleInfoELF(const MachineModuleInfo &) {}
72f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
73f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  StubValueTy &getGVStubEntry(MCSymbol *Sym) {
74f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    assert(Sym && "Key cannot be null");
75f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot    return GVStubs[Sym];
76f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  }
77f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
78f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Accessor methods to return the set of stubs in sorted order.
79f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
80f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
81f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
82f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
83f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot} // end namespace llvm
84f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
85f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#endif // LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
86