MCRelocationInfo.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //==-- llvm/MC/MCRelocationInfo.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 declares the MCRelocationInfo class, which provides methods to
  11. // create MCExprs from relocations, either found in an object::ObjectFile
  12. // (object::RelocationRef), or provided through the C API.
  13. //
  14. //===----------------------------------------------------------------------===//
  15. #ifndef LLVM_MC_MCRELOCATIONINFO_H
  16. #define LLVM_MC_MCRELOCATIONINFO_H
  17. #include "llvm/Support/Compiler.h"
  18. namespace llvm {
  19. namespace object {
  20. class RelocationRef;
  21. }
  22. class MCExpr;
  23. class MCContext;
  24. /// \brief Create MCExprs from relocations found in an object file.
  25. class MCRelocationInfo {
  26. MCRelocationInfo(const MCRelocationInfo &) = delete;
  27. void operator=(const MCRelocationInfo &) = delete;
  28. protected:
  29. MCContext &Ctx;
  30. public:
  31. MCRelocationInfo(MCContext &Ctx);
  32. virtual ~MCRelocationInfo();
  33. /// \brief Create an MCExpr for the relocation \p Rel.
  34. /// \returns If possible, an MCExpr corresponding to Rel, else 0.
  35. virtual const MCExpr *createExprForRelocation(object::RelocationRef Rel);
  36. /// \brief Create an MCExpr for the target-specific \p VariantKind.
  37. /// The VariantKinds are defined in llvm-c/Disassembler.h.
  38. /// Used by MCExternalSymbolizer.
  39. /// \returns If possible, an MCExpr corresponding to VariantKind, else 0.
  40. virtual const MCExpr *createExprForCAPIVariantKind(const MCExpr *SubExpr,
  41. unsigned VariantKind);
  42. };
  43. }
  44. #endif