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