MCAsmBackend.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //===-- MCAsmBackend.cpp - Target MC Assembly Backend ----------------------==//
  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. #include "llvm/MC/MCAsmBackend.h"
  10. #include "llvm/ADT/STLExtras.h"
  11. #include "llvm/MC/MCFixupKindInfo.h"
  12. using namespace llvm;
  13. MCAsmBackend::MCAsmBackend() : HasDataInCodeSupport(false) {}
  14. MCAsmBackend::~MCAsmBackend() {}
  15. const MCFixupKindInfo &MCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
  16. static const MCFixupKindInfo Builtins[] = {
  17. {"FK_Data_1", 0, 8, 0},
  18. {"FK_Data_2", 0, 16, 0},
  19. {"FK_Data_4", 0, 32, 0},
  20. {"FK_Data_8", 0, 64, 0},
  21. {"FK_PCRel_1", 0, 8, MCFixupKindInfo::FKF_IsPCRel},
  22. {"FK_PCRel_2", 0, 16, MCFixupKindInfo::FKF_IsPCRel},
  23. {"FK_PCRel_4", 0, 32, MCFixupKindInfo::FKF_IsPCRel},
  24. {"FK_PCRel_8", 0, 64, MCFixupKindInfo::FKF_IsPCRel},
  25. {"FK_GPRel_1", 0, 8, 0},
  26. {"FK_GPRel_2", 0, 16, 0},
  27. {"FK_GPRel_4", 0, 32, 0},
  28. {"FK_GPRel_8", 0, 64, 0},
  29. {"FK_SecRel_1", 0, 8, 0},
  30. {"FK_SecRel_2", 0, 16, 0},
  31. {"FK_SecRel_4", 0, 32, 0},
  32. {"FK_SecRel_8", 0, 64, 0}};
  33. assert((size_t)Kind <= array_lengthof(Builtins) && "Unknown fixup kind");
  34. return Builtins[Kind];
  35. }
  36. bool MCAsmBackend::fixupNeedsRelaxationAdvanced(
  37. const MCFixup &Fixup, bool Resolved, uint64_t Value,
  38. const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const {
  39. if (!Resolved)
  40. return true;
  41. return fixupNeedsRelaxation(Fixup, Value, DF, Layout);
  42. }