LLVM 19.0.0git
LoongArchFixupKinds.h
Go to the documentation of this file.
1//===- LoongArchFixupKinds.h - LoongArch 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
9#ifndef LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHFIXUPKINDS_H
10#define LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHFIXUPKINDS_H
11
13#include "llvm/MC/MCFixup.h"
14
15#undef LoongArch
16
17namespace llvm {
18namespace LoongArch {
19//
20// This table *must* be in the same order of
21// MCFixupKindInfo Infos[LoongArch::NumTargetFixupKinds] in
22// LoongArchAsmBackend.cpp.
23//
24enum Fixups {
25 // Define fixups can be handled by LoongArchAsmBackend::applyFixup.
26 // 16-bit fixup corresponding to %b16(foo) for instructions like bne.
28 // 21-bit fixup corresponding to %b21(foo) for instructions like bnez.
30 // 26-bit fixup corresponding to %b26(foo)/%plt(foo) for instructions b/bl.
32 // 20-bit fixup corresponding to %abs_hi20(foo) for instruction lu12i.w.
34 // 12-bit fixup corresponding to %abs_lo12(foo) for instruction ori.
36 // 20-bit fixup corresponding to %abs64_lo20(foo) for instruction lu32i.d.
38 // 12-bit fixup corresponding to %abs_hi12(foo) for instruction lu52i.d.
40 // 20-bit fixup corresponding to %le_hi20(foo) for instruction lu12i.w.
42 // 12-bit fixup corresponding to %le_lo12(foo) for instruction ori.
44 // 20-bit fixup corresponding to %le64_lo20(foo) for instruction lu32i.d.
46 // 12-bit fixup corresponding to %le64_hi12(foo) for instruction lu52i.d.
48 // TODO: Add more fixup kind.
49
50 // Used as a sentinel, must be the last of the fixup which can be handled by
51 // LoongArchAsmBackend::applyFixup.
54
55 // Define fixups for force relocation as FirstLiteralRelocationKind+V
56 // represents the relocation type with number V.
57 // 20-bit fixup corresponding to %pc_hi20(foo) for instruction pcalau12i.
59 FirstLiteralRelocationKind + ELF::R_LARCH_PCALA_HI20,
60 // 12-bit fixup corresponding to %pc_lo12(foo) for instructions like addi.w/d.
62 // 20-bit fixup corresponding to %pc64_lo20(foo) for instruction lu32i.d.
64 // 12-bit fixup corresponding to %pc64_hi12(foo) for instruction lu52i.d.
66 // 20-bit fixup corresponding to %got_pc_hi20(foo) for instruction pcalau12i.
68 // 12-bit fixup corresponding to %got_pc_lo12(foo) for instructions
69 // ld.w/ld.d/add.d.
71 // 20-bit fixup corresponding to %got64_pc_lo20(foo) for instruction lu32i.d.
73 // 12-bit fixup corresponding to %got64_pc_hi12(foo) for instruction lu52i.d.
75 // 20-bit fixup corresponding to %got_hi20(foo) for instruction lu12i.w.
77 // 12-bit fixup corresponding to %got_lo12(foo) for instruction ori.
79 // 20-bit fixup corresponding to %got64_lo20(foo) for instruction lu32i.d.
81 // 12-bit fixup corresponding to %got64_hi12(foo) for instruction lu52i.d.
83 // Skip R_LARCH_TLS_LE_*.
84 // 20-bit fixup corresponding to %ie_pc_hi20(foo) for instruction pcalau12i.
86 FirstLiteralRelocationKind + ELF::R_LARCH_TLS_IE_PC_HI20,
87 // 12-bit fixup corresponding to %ie_pc_lo12(foo) for instructions
88 // ld.w/ld.d/add.d.
90 // 20-bit fixup corresponding to %ie64_pc_lo20(foo) for instruction lu32i.d.
92 // 12-bit fixup corresponding to %ie64_pc_hi12(foo) for instruction lu52i.d.
94 // 20-bit fixup corresponding to %ie_hi20(foo) for instruction lu12i.w.
96 // 12-bit fixup corresponding to %ie_lo12(foo) for instruction ori.
98 // 20-bit fixup corresponding to %ie64_lo20(foo) for instruction lu32i.d.
100 // 12-bit fixup corresponding to %ie64_hi12(foo) for instruction lu52i.d.
102 // 20-bit fixup corresponding to %ld_pc_hi20(foo) for instruction pcalau12i.
104 // 20-bit fixup corresponding to %ld_hi20(foo) for instruction lu12i.w.
106 // 20-bit fixup corresponding to %gd_pc_hi20(foo) for instruction pcalau12i.
108 // 20-bit fixup corresponding to %gd_hi20(foo) for instruction lu12i.w.
110 // Generate an R_LARCH_RELAX which indicates the linker may relax here.
112 // Generate an R_LARCH_ALIGN which indicates the linker may fixup align here.
114 // 36-bit fixup corresponding to %call36(foo) for a pair instructions:
115 // pcaddu18i+jirl.
117};
118} // end namespace LoongArch
119} // end namespace llvm
120
121#endif
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ FirstTargetFixupKind
Definition: MCFixup.h:45
@ FirstLiteralRelocationKind
The range [FirstLiteralRelocationKind, MaxTargetFixupKind) is used for relocations coming from ....
Definition: MCFixup.h:50