blob: 3fe2302bdd37270069c82d181f14357ca390a2c2 [file] [log] [blame]
Jia Liu13830222012-02-24 02:15:21 +00001//===-- ARMFixupKinds.h - ARM Specific Fixup Entries ------------*- C++ -*-===//
Jim Grosbach0fb841f2010-11-04 01:12:30 +00002//
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 Kramera7c40ef2014-08-13 16:26:38 +000010#ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMFIXUPKINDS_H
11#define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMFIXUPKINDS_H
Jim Grosbach0fb841f2010-11-04 01:12:30 +000012
13#include "llvm/MC/MCFixup.h"
14
15namespace llvm {
16namespace ARM {
17enum Fixups {
Jim Grosbachce2bd8d2010-12-02 00:28:45 +000018 // fixup_arm_ldst_pcrel_12 - 12-bit PC relative relocation for symbol
19 // addresses
20 fixup_arm_ldst_pcrel_12 = FirstTargetFixupKind,
Jim Grosbachd96bd532010-12-14 21:28:29 +000021
Owen Anderson3e6ee1d2010-12-09 01:51:07 +000022 // 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 Grosbachd96bd532010-12-14 21:28:29 +000025
Jim Grosbach8648c102011-12-19 23:06:24 +000026 // 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 Anderson943fb602010-12-01 19:18:46 +000029 // fixup_arm_pcrel_10 - 10-bit PC relative relocation for symbol addresses
Owen Anderson0f7142d2010-12-08 00:18:36 +000030 // used in VFP instructions where the lower 2 bits are not encoded
Owen Anderson943fb602010-12-01 19:18:46 +000031 // (so it's encoded as an 8-bit immediate).
32 fixup_arm_pcrel_10,
Owen Anderson0f7142d2010-12-08 00:18:36 +000033 // fixup_t2_pcrel_10 - Equivalent to fixup_arm_pcrel_10, accounting for
Owen Anderson302d5fd2010-12-09 00:27:41 +000034 // the short-swapped encoding of Thumb2 instructions.
Owen Anderson0f7142d2010-12-08 00:18:36 +000035 fixup_t2_pcrel_10,
Oliver Stannard65b85382016-01-25 10:26:26 +000036 // 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 Grosbach509dc2a2010-12-14 22:28:03 +000043 // 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 Grosbachce2bd8d2010-12-02 00:28:45 +000047 // fixup_arm_adr_pcrel_12 - 12-bit PC relative relocation for the ADR
48 // instruction.
49 fixup_arm_adr_pcrel_12,
Owen Anderson6d375e52010-12-14 00:36:49 +000050 // fixup_t2_adr_pcrel_12 - 12-bit PC relative relocation for the ADR
51 // instruction.
52 fixup_t2_adr_pcrel_12,
Jason W Kimd2e2f562011-02-04 19:47:15 +000053 // 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 Grosbachd96bd532010-12-14 21:28:29 +000059 // fixup_t2_condbranch - 20-bit PC relative relocation for Thumb2 direct
Owen Anderson578074b2010-12-13 19:31:11 +000060 // uconditional branch instructions.
61 fixup_t2_condbranch,
Jim Grosbachd96bd532010-12-14 21:28:29 +000062 // fixup_t2_uncondbranch - 20-bit PC relative relocation for Thumb2 direct
Owen Anderson578074b2010-12-13 19:31:11 +000063 // branch unconditional branch instructions.
64 fixup_t2_uncondbranch,
Bill Wendlinga7d6aa92010-12-08 23:01:43 +000065
Jim Grosbache119da12010-12-10 18:21:33 +000066 // fixup_arm_thumb_br - 12-bit fixup for Thumb B instructions.
67 fixup_arm_thumb_br,
68
James Molloyfb5cd602012-03-30 09:15:32 +000069 // 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 Grosbach7b811d32012-02-27 21:36:23 +000084
85 // fixup_arm_blx - Fixup for ARM BLX instructions.
86 fixup_arm_blx,
87
Eric Christopherbd59e892011-05-27 03:46:51 +000088 // fixup_arm_thumb_bl - Fixup for Thumb BL instructions.
Jim Grosbach9e199462010-12-06 23:57:07 +000089 fixup_arm_thumb_bl,
Jim Grosbach9d6d77a2010-11-11 18:04:49 +000090
Bill Wendling3392bfc2010-12-09 00:39:08 +000091 // fixup_arm_thumb_blx - Fixup for Thumb BLX instructions.
92 fixup_arm_thumb_blx,
93
Jim Grosbach68b27eb2010-12-09 19:50:12 +000094 // fixup_arm_thumb_cb - Fixup for Thumb branch instructions.
95 fixup_arm_thumb_cb,
Bill Wendlinga7d6aa92010-12-08 23:01:43 +000096
Bill Wendling8a6449c2010-12-08 01:57:09 +000097 // fixup_arm_thumb_cp - Fixup for Thumb load/store from constant pool instrs.
98 fixup_arm_thumb_cp,
99
Bill Wendling6ea30532010-12-14 22:26:49 +0000100 // fixup_arm_thumb_bcc - Fixup for Thumb conditional branching instructions.
Jim Grosbach78485ad2010-12-10 17:13:40 +0000101 fixup_arm_thumb_bcc,
102
Jason W Kim5a97bd82010-11-18 23:37:15 +0000103 // 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 Kim5a97bd82010-11-18 23:37:15 +0000105 fixup_arm_movt_hi16, // :upper16:
106 fixup_arm_movw_lo16, // :lower16:
Evan Chengd4a5c052011-01-14 02:38:49 +0000107 fixup_t2_movt_hi16, // :upper16:
108 fixup_t2_movw_lo16, // :lower16:
Jason W Kim5a97bd82010-11-18 23:37:15 +0000109
James Molloyb876c722016-04-01 09:40:47 +0000110 // fixup_arm_mod_imm - Fixup for mod_imm
111 fixup_arm_mod_imm,
112
Jim Grosbach9d6d77a2010-11-11 18:04:49 +0000113 // Marker
114 LastTargetFixupKind,
115 NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind
Jim Grosbach0fb841f2010-11-04 01:12:30 +0000116};
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000117}
118}
Jim Grosbach0fb841f2010-11-04 01:12:30 +0000119
120#endif