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.

72 lines
2.4 KiB

  1. //===-- llvm/Target/Mangler.h - Self-contained name mangler -----*- 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. // Unified name mangler for various backends.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_TARGET_MANGLER_H
  14. #define LLVM_TARGET_MANGLER_H
  15. #include "llvm/ADT/DenseMap.h"
  16. namespace llvm {
  17. class Twine;
  18. class GlobalValue;
  19. template <typename T> class SmallVectorImpl;
  20. class MCContext;
  21. class MCSymbol;
  22. class DataLayout;
  23. class Mangler {
  24. public:
  25. enum ManglerPrefixTy {
  26. Default, ///< Emit default string before each symbol.
  27. Private, ///< Emit "private" prefix before each symbol.
  28. LinkerPrivate ///< Emit "linker private" prefix before each symbol.
  29. };
  30. private:
  31. MCContext &Context;
  32. const DataLayout &TD;
  33. /// AnonGlobalIDs - We need to give global values the same name every time
  34. /// they are mangled. This keeps track of the number we give to anonymous
  35. /// ones.
  36. ///
  37. DenseMap<const GlobalValue*, unsigned> AnonGlobalIDs;
  38. /// NextAnonGlobalID - This simple counter is used to unique value names.
  39. ///
  40. unsigned NextAnonGlobalID;
  41. public:
  42. Mangler(MCContext &context, const DataLayout &td)
  43. : Context(context), TD(td), NextAnonGlobalID(1) {}
  44. /// getSymbol - Return the MCSymbol for the specified global value. This
  45. /// symbol is the main label that is the address of the global.
  46. MCSymbol *getSymbol(const GlobalValue *GV);
  47. /// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
  48. /// and the specified global variable's name. If the global variable doesn't
  49. /// have a name, this fills in a unique name for the global.
  50. void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
  51. bool isImplicitlyPrivate);
  52. /// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
  53. /// and the specified name as the global variable name. GVName must not be
  54. /// empty.
  55. void getNameWithPrefix(SmallVectorImpl<char> &OutName, const Twine &GVName,
  56. ManglerPrefixTy PrefixTy = Mangler::Default);
  57. };
  58. } // End llvm namespace
  59. #endif // LLVM_TARGET_MANGLER_H