Jim Grosbach | 7093326 | 2010-11-04 01:12:30 +0000 | [diff] [blame] | 1 | //===-- ARM/ARMFixupKinds.h - ARM Specific Fixup Entries --------*- 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 | #ifndef LLVM_ARM_ARMFIXUPKINDS_H |
| 11 | #define LLVM_ARM_ARMFIXUPKINDS_H |
| 12 | |
| 13 | #include "llvm/MC/MCFixup.h" |
| 14 | |
| 15 | namespace llvm { |
| 16 | namespace ARM { |
| 17 | enum Fixups { |
Jim Grosbach | dff84b0 | 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 | 8d6d7d6 | 2010-12-14 21:28:29 +0000 | [diff] [blame] | 21 | |
Owen Anderson | d7b3f58 | 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 | 8d6d7d6 | 2010-12-14 21:28:29 +0000 | [diff] [blame] | 25 | |
Owen Anderson | 9d63d90 | 2010-12-01 19:18:46 +0000 | [diff] [blame] | 26 | // fixup_arm_pcrel_10 - 10-bit PC relative relocation for symbol addresses |
Owen Anderson | d8e351b | 2010-12-08 00:18:36 +0000 | [diff] [blame] | 27 | // used in VFP instructions where the lower 2 bits are not encoded |
Owen Anderson | 9d63d90 | 2010-12-01 19:18:46 +0000 | [diff] [blame] | 28 | // (so it's encoded as an 8-bit immediate). |
| 29 | fixup_arm_pcrel_10, |
Owen Anderson | d8e351b | 2010-12-08 00:18:36 +0000 | [diff] [blame] | 30 | // fixup_t2_pcrel_10 - Equivalent to fixup_arm_pcrel_10, accounting for |
Owen Anderson | fb20d89 | 2010-12-09 00:27:41 +0000 | [diff] [blame] | 31 | // the short-swapped encoding of Thumb2 instructions. |
Owen Anderson | d8e351b | 2010-12-08 00:18:36 +0000 | [diff] [blame] | 32 | fixup_t2_pcrel_10, |
Jim Grosbach | d40963c | 2010-12-14 22:28:03 +0000 | [diff] [blame] | 33 | // fixup_thumb_adr_pcrel_10 - 10-bit PC relative relocation for symbol |
| 34 | // addresses where the lower 2 bits are not encoded (so it's encoded as an |
| 35 | // 8-bit immediate). |
| 36 | fixup_thumb_adr_pcrel_10, |
Jim Grosbach | dff84b0 | 2010-12-02 00:28:45 +0000 | [diff] [blame] | 37 | // fixup_arm_adr_pcrel_12 - 12-bit PC relative relocation for the ADR |
| 38 | // instruction. |
| 39 | fixup_arm_adr_pcrel_12, |
Owen Anderson | a838a25 | 2010-12-14 00:36:49 +0000 | [diff] [blame] | 40 | // fixup_t2_adr_pcrel_12 - 12-bit PC relative relocation for the ADR |
| 41 | // instruction. |
| 42 | fixup_t2_adr_pcrel_12, |
Jim Grosbach | 662a816 | 2010-12-06 23:57:07 +0000 | [diff] [blame] | 43 | // fixup_arm_branch - 24-bit PC relative relocation for direct branch |
Jim Grosbach | c466b93 | 2010-11-11 18:04:49 +0000 | [diff] [blame] | 44 | // instructions. |
| 45 | fixup_arm_branch, |
Jim Grosbach | 8d6d7d6 | 2010-12-14 21:28:29 +0000 | [diff] [blame] | 46 | // fixup_t2_condbranch - 20-bit PC relative relocation for Thumb2 direct |
Owen Anderson | c266600 | 2010-12-13 19:31:11 +0000 | [diff] [blame] | 47 | // uconditional branch instructions. |
| 48 | fixup_t2_condbranch, |
Jim Grosbach | 8d6d7d6 | 2010-12-14 21:28:29 +0000 | [diff] [blame] | 49 | // fixup_t2_uncondbranch - 20-bit PC relative relocation for Thumb2 direct |
Owen Anderson | c266600 | 2010-12-13 19:31:11 +0000 | [diff] [blame] | 50 | // branch unconditional branch instructions. |
| 51 | fixup_t2_uncondbranch, |
Bill Wendling | dff2f71 | 2010-12-08 23:01:43 +0000 | [diff] [blame] | 52 | |
Jim Grosbach | e246717 | 2010-12-10 18:21:33 +0000 | [diff] [blame] | 53 | // fixup_arm_thumb_br - 12-bit fixup for Thumb B instructions. |
| 54 | fixup_arm_thumb_br, |
| 55 | |
Bill Wendling | 09aa3f0 | 2010-12-09 00:39:08 +0000 | [diff] [blame] | 56 | // fixup_arm_thumb_blx - Fixup for Thumb BL instructions. |
Jim Grosbach | 662a816 | 2010-12-06 23:57:07 +0000 | [diff] [blame] | 57 | fixup_arm_thumb_bl, |
Jim Grosbach | c466b93 | 2010-11-11 18:04:49 +0000 | [diff] [blame] | 58 | |
Bill Wendling | 09aa3f0 | 2010-12-09 00:39:08 +0000 | [diff] [blame] | 59 | // fixup_arm_thumb_blx - Fixup for Thumb BLX instructions. |
| 60 | fixup_arm_thumb_blx, |
| 61 | |
Jim Grosbach | b492a7c | 2010-12-09 19:50:12 +0000 | [diff] [blame] | 62 | // fixup_arm_thumb_cb - Fixup for Thumb branch instructions. |
| 63 | fixup_arm_thumb_cb, |
Bill Wendling | dff2f71 | 2010-12-08 23:01:43 +0000 | [diff] [blame] | 64 | |
Bill Wendling | b8958b0 | 2010-12-08 01:57:09 +0000 | [diff] [blame] | 65 | // fixup_arm_thumb_cp - Fixup for Thumb load/store from constant pool instrs. |
| 66 | fixup_arm_thumb_cp, |
| 67 | |
Bill Wendling | ee2b350 | 2010-12-14 22:26:49 +0000 | [diff] [blame] | 68 | // fixup_arm_thumb_bcc - Fixup for Thumb conditional branching instructions. |
Jim Grosbach | 0108645 | 2010-12-10 17:13:40 +0000 | [diff] [blame] | 69 | fixup_arm_thumb_bcc, |
| 70 | |
Jason W Kim | 837caa9 | 2010-11-18 23:37:15 +0000 | [diff] [blame] | 71 | // The next two are for the movt/movw pair |
| 72 | // the 16bit imm field are split into imm{15-12} and imm{11-0} |
Jason W Kim | 837caa9 | 2010-11-18 23:37:15 +0000 | [diff] [blame] | 73 | fixup_arm_movt_hi16, // :upper16: |
| 74 | fixup_arm_movw_lo16, // :lower16: |
Evan Cheng | f3eb3bb | 2011-01-14 02:38:49 +0000 | [diff] [blame^] | 75 | fixup_t2_movt_hi16, // :upper16: |
| 76 | fixup_t2_movw_lo16, // :lower16: |
Jason W Kim | 837caa9 | 2010-11-18 23:37:15 +0000 | [diff] [blame] | 77 | |
Jason W Kim | 86a97f2 | 2011-01-12 00:19:25 +0000 | [diff] [blame] | 78 | // It is possible to create an "immediate" that happens to be pcrel. |
Jason W Kim | 8dc602d | 2011-01-12 23:25:02 +0000 | [diff] [blame] | 79 | // movw r0, :lower16:Foo-(Bar+8) and movt r0, :upper16:Foo-(Bar+8) |
| 80 | // result in different reloc tags than the above two. |
Jason W Kim | 86a97f2 | 2011-01-12 00:19:25 +0000 | [diff] [blame] | 81 | // Needed to support ELF::R_ARM_MOVT_PREL and ELF::R_ARM_MOVW_PREL_NC |
| 82 | fixup_arm_movt_hi16_pcrel, // :upper16: |
| 83 | fixup_arm_movw_lo16_pcrel, // :lower16: |
Evan Cheng | f3eb3bb | 2011-01-14 02:38:49 +0000 | [diff] [blame^] | 84 | fixup_t2_movt_hi16_pcrel, // :upper16: |
| 85 | fixup_t2_movw_lo16_pcrel, // :lower16: |
Jason W Kim | 86a97f2 | 2011-01-12 00:19:25 +0000 | [diff] [blame] | 86 | |
Jim Grosbach | c466b93 | 2010-11-11 18:04:49 +0000 | [diff] [blame] | 87 | // Marker |
| 88 | LastTargetFixupKind, |
| 89 | NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind |
Jim Grosbach | 7093326 | 2010-11-04 01:12:30 +0000 | [diff] [blame] | 90 | }; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | #endif |