Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.1 KiB

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