Jia Liu | 1383022 | 2012-02-24 02:15:21 +0000 | [diff] [blame] | 1 | //===-- ARMFixupKinds.h - ARM Specific Fixup Entries ------------*- C++ -*-===// |
Jim Grosbach | 0fb841f | 2010-11-04 01:12:30 +0000 | [diff] [blame] | 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 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 10 | #ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMFIXUPKINDS_H |
| 11 | #define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMFIXUPKINDS_H |
Jim Grosbach | 0fb841f | 2010-11-04 01:12:30 +0000 | [diff] [blame] | 12 | |
| 13 | #include "llvm/MC/MCFixup.h" |
| 14 | |
| 15 | namespace llvm { |
| 16 | namespace ARM { |
| 17 | enum Fixups { |
Jim Grosbach | ce2bd8d | 2010-12-02 00:28:45 +0000 | [diff] [blame] | 18 | // fixup_arm_ldst_pcrel_12 - 12-bit PC relative relocation for symbol |
| 19 | // addresses |
| 20 | fixup_arm_ldst_pcrel_12 = FirstTargetFixupKind, |
Jim Grosbach | d96bd53 | 2010-12-14 21:28:29 +0000 | [diff] [blame] | 21 | |
Owen Anderson | 3e6ee1d | 2010-12-09 01:51:07 +0000 | [diff] [blame] | 22 | // fixup_t2_ldst_pcrel_12 - Equivalent to fixup_arm_ldst_pcrel_12, with |
| 23 | // the 16-bit halfwords reordered. |
| 24 | fixup_t2_ldst_pcrel_12, |
Jim Grosbach | d96bd53 | 2010-12-14 21:28:29 +0000 | [diff] [blame] | 25 | |
Jim Grosbach | 8648c10 | 2011-12-19 23:06:24 +0000 | [diff] [blame] | 26 | // fixup_arm_pcrel_10_unscaled - 10-bit PC relative relocation for symbol |
| 27 | // addresses used in LDRD/LDRH/LDRB/etc. instructions. All bits are encoded. |
| 28 | fixup_arm_pcrel_10_unscaled, |
Owen Anderson | 943fb60 | 2010-12-01 19:18:46 +0000 | [diff] [blame] | 29 | // fixup_arm_pcrel_10 - 10-bit PC relative relocation for symbol addresses |
Owen Anderson | 0f7142d | 2010-12-08 00:18:36 +0000 | [diff] [blame] | 30 | // used in VFP instructions where the lower 2 bits are not encoded |
Owen Anderson | 943fb60 | 2010-12-01 19:18:46 +0000 | [diff] [blame] | 31 | // (so it's encoded as an 8-bit immediate). |
| 32 | fixup_arm_pcrel_10, |
Owen Anderson | 0f7142d | 2010-12-08 00:18:36 +0000 | [diff] [blame] | 33 | // fixup_t2_pcrel_10 - Equivalent to fixup_arm_pcrel_10, accounting for |
Owen Anderson | 302d5fd | 2010-12-09 00:27:41 +0000 | [diff] [blame] | 34 | // the short-swapped encoding of Thumb2 instructions. |
Owen Anderson | 0f7142d | 2010-12-08 00:18:36 +0000 | [diff] [blame] | 35 | fixup_t2_pcrel_10, |
Oliver Stannard | 65b8538 | 2016-01-25 10:26:26 +0000 | [diff] [blame] | 36 | // fixup_arm_pcrel_9 - 9-bit PC relative relocation for symbol addresses |
| 37 | // used in VFP instructions where bit 0 not encoded (so it's encoded as an |
| 38 | // 8-bit immediate). |
| 39 | fixup_arm_pcrel_9, |
| 40 | // fixup_t2_pcrel_9 - Equivalent to fixup_arm_pcrel_9, accounting for |
| 41 | // the short-swapped encoding of Thumb2 instructions. |
| 42 | fixup_t2_pcrel_9, |
Jim Grosbach | 509dc2a | 2010-12-14 22:28:03 +0000 | [diff] [blame] | 43 | // fixup_thumb_adr_pcrel_10 - 10-bit PC relative relocation for symbol |
| 44 | // addresses where the lower 2 bits are not encoded (so it's encoded as an |
| 45 | // 8-bit immediate). |
| 46 | fixup_thumb_adr_pcrel_10, |
Jim Grosbach | ce2bd8d | 2010-12-02 00:28:45 +0000 | [diff] [blame] | 47 | // fixup_arm_adr_pcrel_12 - 12-bit PC relative relocation for the ADR |
| 48 | // instruction. |
| 49 | fixup_arm_adr_pcrel_12, |
Owen Anderson | 6d375e5 | 2010-12-14 00:36:49 +0000 | [diff] [blame] | 50 | // fixup_t2_adr_pcrel_12 - 12-bit PC relative relocation for the ADR |
| 51 | // instruction. |
| 52 | fixup_t2_adr_pcrel_12, |
Jason W Kim | d2e2f56 | 2011-02-04 19:47:15 +0000 | [diff] [blame] | 53 | // fixup_arm_condbranch - 24-bit PC relative relocation for conditional branch |
| 54 | // instructions. |
| 55 | fixup_arm_condbranch, |
| 56 | // fixup_arm_uncondbranch - 24-bit PC relative relocation for |
| 57 | // branch instructions. (unconditional) |
| 58 | fixup_arm_uncondbranch, |
Jim Grosbach | d96bd53 | 2010-12-14 21:28:29 +0000 | [diff] [blame] | 59 | // fixup_t2_condbranch - 20-bit PC relative relocation for Thumb2 direct |
Owen Anderson | 578074b | 2010-12-13 19:31:11 +0000 | [diff] [blame] | 60 | // uconditional branch instructions. |
| 61 | fixup_t2_condbranch, |
Jim Grosbach | d96bd53 | 2010-12-14 21:28:29 +0000 | [diff] [blame] | 62 | // fixup_t2_uncondbranch - 20-bit PC relative relocation for Thumb2 direct |
Owen Anderson | 578074b | 2010-12-13 19:31:11 +0000 | [diff] [blame] | 63 | // branch unconditional branch instructions. |
| 64 | fixup_t2_uncondbranch, |
Bill Wendling | a7d6aa9 | 2010-12-08 23:01:43 +0000 | [diff] [blame] | 65 | |
Jim Grosbach | e119da1 | 2010-12-10 18:21:33 +0000 | [diff] [blame] | 66 | // fixup_arm_thumb_br - 12-bit fixup for Thumb B instructions. |
| 67 | fixup_arm_thumb_br, |
| 68 | |
James Molloy | fb5cd60 | 2012-03-30 09:15:32 +0000 | [diff] [blame] | 69 | // The following fixups handle the ARM BL instructions. These can be |
| 70 | // conditionalised; however, the ARM ELF ABI requires a different relocation |
| 71 | // in that case: R_ARM_JUMP24 instead of R_ARM_CALL. The difference is that |
| 72 | // R_ARM_CALL is allowed to change the instruction to a BLX inline, which has |
| 73 | // no conditional version; R_ARM_JUMP24 would have to insert a veneer. |
| 74 | // |
| 75 | // MachO does not draw a distinction between the two cases, so it will treat |
| 76 | // fixup_arm_uncondbl and fixup_arm_condbl as identical fixups. |
| 77 | |
| 78 | // fixup_arm_uncondbl - Fixup for unconditional ARM BL instructions. |
| 79 | fixup_arm_uncondbl, |
| 80 | |
| 81 | // fixup_arm_condbl - Fixup for ARM BL instructions with nontrivial |
| 82 | // conditionalisation. |
| 83 | fixup_arm_condbl, |
Jim Grosbach | 7b811d3 | 2012-02-27 21:36:23 +0000 | [diff] [blame] | 84 | |
| 85 | // fixup_arm_blx - Fixup for ARM BLX instructions. |
| 86 | fixup_arm_blx, |
| 87 | |
Eric Christopher | bd59e89 | 2011-05-27 03:46:51 +0000 | [diff] [blame] | 88 | // fixup_arm_thumb_bl - Fixup for Thumb BL instructions. |
Jim Grosbach | 9e19946 | 2010-12-06 23:57:07 +0000 | [diff] [blame] | 89 | fixup_arm_thumb_bl, |
Jim Grosbach | 9d6d77a | 2010-11-11 18:04:49 +0000 | [diff] [blame] | 90 | |
Bill Wendling | 3392bfc | 2010-12-09 00:39:08 +0000 | [diff] [blame] | 91 | // fixup_arm_thumb_blx - Fixup for Thumb BLX instructions. |
| 92 | fixup_arm_thumb_blx, |
| 93 | |
Jim Grosbach | 68b27eb | 2010-12-09 19:50:12 +0000 | [diff] [blame] | 94 | // fixup_arm_thumb_cb - Fixup for Thumb branch instructions. |
| 95 | fixup_arm_thumb_cb, |
Bill Wendling | a7d6aa9 | 2010-12-08 23:01:43 +0000 | [diff] [blame] | 96 | |
Bill Wendling | 8a6449c | 2010-12-08 01:57:09 +0000 | [diff] [blame] | 97 | // fixup_arm_thumb_cp - Fixup for Thumb load/store from constant pool instrs. |
| 98 | fixup_arm_thumb_cp, |
| 99 | |
Bill Wendling | 6ea3053 | 2010-12-14 22:26:49 +0000 | [diff] [blame] | 100 | // fixup_arm_thumb_bcc - Fixup for Thumb conditional branching instructions. |
Jim Grosbach | 78485ad | 2010-12-10 17:13:40 +0000 | [diff] [blame] | 101 | fixup_arm_thumb_bcc, |
| 102 | |
Jason W Kim | 5a97bd8 | 2010-11-18 23:37:15 +0000 | [diff] [blame] | 103 | // The next two are for the movt/movw pair |
| 104 | // the 16bit imm field are split into imm{15-12} and imm{11-0} |
Jason W Kim | 5a97bd8 | 2010-11-18 23:37:15 +0000 | [diff] [blame] | 105 | fixup_arm_movt_hi16, // :upper16: |
| 106 | fixup_arm_movw_lo16, // :lower16: |
Evan Cheng | d4a5c05 | 2011-01-14 02:38:49 +0000 | [diff] [blame] | 107 | fixup_t2_movt_hi16, // :upper16: |
| 108 | fixup_t2_movw_lo16, // :lower16: |
Jason W Kim | 5a97bd8 | 2010-11-18 23:37:15 +0000 | [diff] [blame] | 109 | |
James Molloy | b876c72 | 2016-04-01 09:40:47 +0000 | [diff] [blame] | 110 | // fixup_arm_mod_imm - Fixup for mod_imm |
| 111 | fixup_arm_mod_imm, |
| 112 | |
Jim Grosbach | 9d6d77a | 2010-11-11 18:04:49 +0000 | [diff] [blame] | 113 | // Marker |
| 114 | LastTargetFixupKind, |
| 115 | NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind |
Jim Grosbach | 0fb841f | 2010-11-04 01:12:30 +0000 | [diff] [blame] | 116 | }; |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 117 | } |
| 118 | } |
Jim Grosbach | 0fb841f | 2010-11-04 01:12:30 +0000 | [diff] [blame] | 119 | |
| 120 | #endif |