ARMFixupKinds.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //===-- ARMFixupKinds.h - ARM Specific Fixup Entries ------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMFIXUPKINDS_H
  9. #define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMFIXUPKINDS_H
  10. #include "llvm/MC/MCFixup.h"
  11. namespace llvm {
  12. namespace ARM {
  13. enum Fixups {
  14. // 12-bit PC relative relocation for symbol addresses
  15. fixup_arm_ldst_pcrel_12 = FirstTargetFixupKind,
  16. // Equivalent to fixup_arm_ldst_pcrel_12, with the 16-bit halfwords reordered.
  17. fixup_t2_ldst_pcrel_12,
  18. // 10-bit PC relative relocation for symbol addresses used in
  19. // LDRD/LDRH/LDRB/etc. instructions. All bits are encoded.
  20. fixup_arm_pcrel_10_unscaled,
  21. // 10-bit PC relative relocation for symbol addresses used in VFP instructions
  22. // where the lower 2 bits are not encoded (so it's encoded as an 8-bit
  23. // immediate).
  24. fixup_arm_pcrel_10,
  25. // Equivalent to fixup_arm_pcrel_10, accounting for the short-swapped encoding
  26. // of Thumb2 instructions.
  27. fixup_t2_pcrel_10,
  28. // 9-bit PC relative relocation for symbol addresses used in VFP instructions
  29. // where bit 0 not encoded (so it's encoded as an 8-bit immediate).
  30. fixup_arm_pcrel_9,
  31. // Equivalent to fixup_arm_pcrel_9, accounting for the short-swapped encoding
  32. // of Thumb2 instructions.
  33. fixup_t2_pcrel_9,
  34. // 12-bit immediate value.
  35. fixup_arm_ldst_abs_12,
  36. // 10-bit PC relative relocation for symbol addresses where the lower 2 bits
  37. // are not encoded (so it's encoded as an 8-bit immediate).
  38. fixup_thumb_adr_pcrel_10,
  39. // 12-bit PC relative relocation for the ADR instruction.
  40. fixup_arm_adr_pcrel_12,
  41. // 12-bit PC relative relocation for the ADR instruction.
  42. fixup_t2_adr_pcrel_12,
  43. // 24-bit PC relative relocation for conditional branch instructions.
  44. fixup_arm_condbranch,
  45. // 24-bit PC relative relocation for branch instructions. (unconditional)
  46. fixup_arm_uncondbranch,
  47. // 20-bit PC relative relocation for Thumb2 direct uconditional branch
  48. // instructions.
  49. fixup_t2_condbranch,
  50. // 20-bit PC relative relocation for Thumb2 direct branch unconditional branch
  51. // instructions.
  52. fixup_t2_uncondbranch,
  53. // 12-bit fixup for Thumb B instructions.
  54. fixup_arm_thumb_br,
  55. // The following fixups handle the ARM BL instructions. These can be
  56. // conditionalised; however, the ARM ELF ABI requires a different relocation
  57. // in that case: R_ARM_JUMP24 instead of R_ARM_CALL. The difference is that
  58. // R_ARM_CALL is allowed to change the instruction to a BLX inline, which has
  59. // no conditional version; R_ARM_JUMP24 would have to insert a veneer.
  60. //
  61. // MachO does not draw a distinction between the two cases, so it will treat
  62. // fixup_arm_uncondbl and fixup_arm_condbl as identical fixups.
  63. // Fixup for unconditional ARM BL instructions.
  64. fixup_arm_uncondbl,
  65. // Fixup for ARM BL instructions with nontrivial conditionalisation.
  66. fixup_arm_condbl,
  67. // Fixup for ARM BLX instructions.
  68. fixup_arm_blx,
  69. // Fixup for Thumb BL instructions.
  70. fixup_arm_thumb_bl,
  71. // Fixup for Thumb BLX instructions.
  72. fixup_arm_thumb_blx,
  73. // Fixup for Thumb branch instructions.
  74. fixup_arm_thumb_cb,
  75. // Fixup for Thumb load/store from constant pool instrs.
  76. fixup_arm_thumb_cp,
  77. // Fixup for Thumb conditional branching instructions.
  78. fixup_arm_thumb_bcc,
  79. // The next two are for the movt/movw pair
  80. // the 16bit imm field are split into imm{15-12} and imm{11-0}
  81. fixup_arm_movt_hi16, // :upper16:
  82. fixup_arm_movw_lo16, // :lower16:
  83. fixup_t2_movt_hi16, // :upper16:
  84. fixup_t2_movw_lo16, // :lower16:
  85. // Fixup for mod_imm
  86. fixup_arm_mod_imm,
  87. // Fixup for Thumb2 8-bit rotated operand
  88. fixup_t2_so_imm,
  89. // Fixups for Branch Future.
  90. fixup_bf_branch,
  91. fixup_bf_target,
  92. fixup_bfl_target,
  93. fixup_bfc_target,
  94. fixup_bfcsel_else_target,
  95. fixup_wls,
  96. fixup_le,
  97. // Marker
  98. LastTargetFixupKind,
  99. NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind
  100. };
  101. }
  102. } // namespace llvm
  103. #endif