Path: blob/main/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h
35294 views
//===- LoongArchFixupKinds.h - LoongArch Specific Fixup Entries -*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHFIXUPKINDS_H9#define LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHFIXUPKINDS_H1011#include "llvm/BinaryFormat/ELF.h"12#include "llvm/MC/MCFixup.h"1314#undef LoongArch1516namespace llvm {17namespace LoongArch {18//19// This table *must* be in the same order of20// MCFixupKindInfo Infos[LoongArch::NumTargetFixupKinds] in21// LoongArchAsmBackend.cpp.22//23enum Fixups {24// Define fixups can be handled by LoongArchAsmBackend::applyFixup.25// 16-bit fixup corresponding to %b16(foo) for instructions like bne.26fixup_loongarch_b16 = FirstTargetFixupKind,27// 21-bit fixup corresponding to %b21(foo) for instructions like bnez.28fixup_loongarch_b21,29// 26-bit fixup corresponding to %b26(foo)/%plt(foo) for instructions b/bl.30fixup_loongarch_b26,31// 20-bit fixup corresponding to %abs_hi20(foo) for instruction lu12i.w.32fixup_loongarch_abs_hi20,33// 12-bit fixup corresponding to %abs_lo12(foo) for instruction ori.34fixup_loongarch_abs_lo12,35// 20-bit fixup corresponding to %abs64_lo20(foo) for instruction lu32i.d.36fixup_loongarch_abs64_lo20,37// 12-bit fixup corresponding to %abs_hi12(foo) for instruction lu52i.d.38fixup_loongarch_abs64_hi12,39// 20-bit fixup corresponding to %le_hi20(foo) for instruction lu12i.w.40fixup_loongarch_tls_le_hi20,41// 12-bit fixup corresponding to %le_lo12(foo) for instruction ori.42fixup_loongarch_tls_le_lo12,43// 20-bit fixup corresponding to %le64_lo20(foo) for instruction lu32i.d.44fixup_loongarch_tls_le64_lo20,45// 12-bit fixup corresponding to %le64_hi12(foo) for instruction lu52i.d.46fixup_loongarch_tls_le64_hi12,47// TODO: Add more fixup kind.4849// Used as a sentinel, must be the last of the fixup which can be handled by50// LoongArchAsmBackend::applyFixup.51fixup_loongarch_invalid,52NumTargetFixupKinds = fixup_loongarch_invalid - FirstTargetFixupKind,5354// Define fixups for force relocation as FirstLiteralRelocationKind+V55// represents the relocation type with number V.56// 20-bit fixup corresponding to %pc_hi20(foo) for instruction pcalau12i.57fixup_loongarch_pcala_hi20 =58FirstLiteralRelocationKind + ELF::R_LARCH_PCALA_HI20,59// 12-bit fixup corresponding to %pc_lo12(foo) for instructions like addi.w/d.60fixup_loongarch_pcala_lo12,61// 20-bit fixup corresponding to %pc64_lo20(foo) for instruction lu32i.d.62fixup_loongarch_pcala64_lo20,63// 12-bit fixup corresponding to %pc64_hi12(foo) for instruction lu52i.d.64fixup_loongarch_pcala64_hi12,65// 20-bit fixup corresponding to %got_pc_hi20(foo) for instruction pcalau12i.66fixup_loongarch_got_pc_hi20,67// 12-bit fixup corresponding to %got_pc_lo12(foo) for instructions68// ld.w/ld.d/add.d.69fixup_loongarch_got_pc_lo12,70// 20-bit fixup corresponding to %got64_pc_lo20(foo) for instruction lu32i.d.71fixup_loongarch_got64_pc_lo20,72// 12-bit fixup corresponding to %got64_pc_hi12(foo) for instruction lu52i.d.73fixup_loongarch_got64_pc_hi12,74// 20-bit fixup corresponding to %got_hi20(foo) for instruction lu12i.w.75fixup_loongarch_got_hi20,76// 12-bit fixup corresponding to %got_lo12(foo) for instruction ori.77fixup_loongarch_got_lo12,78// 20-bit fixup corresponding to %got64_lo20(foo) for instruction lu32i.d.79fixup_loongarch_got64_lo20,80// 12-bit fixup corresponding to %got64_hi12(foo) for instruction lu52i.d.81fixup_loongarch_got64_hi12,82// Skip R_LARCH_TLS_LE_*.83// 20-bit fixup corresponding to %ie_pc_hi20(foo) for instruction pcalau12i.84fixup_loongarch_tls_ie_pc_hi20 =85FirstLiteralRelocationKind + ELF::R_LARCH_TLS_IE_PC_HI20,86// 12-bit fixup corresponding to %ie_pc_lo12(foo) for instructions87// ld.w/ld.d/add.d.88fixup_loongarch_tls_ie_pc_lo12,89// 20-bit fixup corresponding to %ie64_pc_lo20(foo) for instruction lu32i.d.90fixup_loongarch_tls_ie64_pc_lo20,91// 12-bit fixup corresponding to %ie64_pc_hi12(foo) for instruction lu52i.d.92fixup_loongarch_tls_ie64_pc_hi12,93// 20-bit fixup corresponding to %ie_hi20(foo) for instruction lu12i.w.94fixup_loongarch_tls_ie_hi20,95// 12-bit fixup corresponding to %ie_lo12(foo) for instruction ori.96fixup_loongarch_tls_ie_lo12,97// 20-bit fixup corresponding to %ie64_lo20(foo) for instruction lu32i.d.98fixup_loongarch_tls_ie64_lo20,99// 12-bit fixup corresponding to %ie64_hi12(foo) for instruction lu52i.d.100fixup_loongarch_tls_ie64_hi12,101// 20-bit fixup corresponding to %ld_pc_hi20(foo) for instruction pcalau12i.102fixup_loongarch_tls_ld_pc_hi20,103// 20-bit fixup corresponding to %ld_hi20(foo) for instruction lu12i.w.104fixup_loongarch_tls_ld_hi20,105// 20-bit fixup corresponding to %gd_pc_hi20(foo) for instruction pcalau12i.106fixup_loongarch_tls_gd_pc_hi20,107// 20-bit fixup corresponding to %gd_hi20(foo) for instruction lu12i.w.108fixup_loongarch_tls_gd_hi20,109// Generate an R_LARCH_RELAX which indicates the linker may relax here.110fixup_loongarch_relax = FirstLiteralRelocationKind + ELF::R_LARCH_RELAX,111// Generate an R_LARCH_ALIGN which indicates the linker may fixup align here.112fixup_loongarch_align = FirstLiteralRelocationKind + ELF::R_LARCH_ALIGN,113// 20-bit fixup corresponding to %pcrel_20(foo) for instruction pcaddi.114fixup_loongarch_pcrel20_s2,115// 36-bit fixup corresponding to %call36(foo) for a pair instructions:116// pcaddu18i+jirl.117fixup_loongarch_call36 = FirstLiteralRelocationKind + ELF::R_LARCH_CALL36,118// 20-bit fixup corresponding to %desc_pc_hi20(foo) for instruction pcalau12i.119fixup_loongarch_tls_desc_pc_hi20 =120FirstLiteralRelocationKind + ELF::R_LARCH_TLS_DESC_PC_HI20,121// 12-bit fixup corresponding to %desc_pc_lo12(foo) for instructions like122// addi.w/d.123fixup_loongarch_tls_desc_pc_lo12,124// 20-bit fixup corresponding to %desc64_pc_lo20(foo) for instruction lu32i.d.125fixup_loongarch_tls_desc64_pc_lo20,126// 12-bit fixup corresponding to %desc64_pc_hi12(foo) for instruction lu52i.d.127fixup_loongarch_tls_desc64_pc_hi12,128// 20-bit fixup corresponding to %desc_hi20(foo) for instruction lu12i.w.129fixup_loongarch_tls_desc_hi20,130// 12-bit fixup corresponding to %desc_lo12(foo) for instruction ori.131fixup_loongarch_tls_desc_lo12,132// 20-bit fixup corresponding to %desc64_lo20(foo) for instruction lu32i.d.133fixup_loongarch_tls_desc64_lo20,134// 12-bit fixup corresponding to %desc64_hi12(foo) for instruction lu52i.d.135fixup_loongarch_tls_desc64_hi12,136// 12-bit fixup corresponding to %desc_ld(foo) for instruction ld.w/d.137fixup_loongarch_tls_desc_ld,138// 12-bit fixup corresponding to %desc_call(foo) for instruction jirl.139fixup_loongarch_tls_desc_call,140// 20-bit fixup corresponding to %le_hi20_r(foo) for instruction lu12i.w.141fixup_loongarch_tls_le_hi20_r,142// Fixup corresponding to %le_add_r(foo) for instruction PseudoAddTPRel_W/D.143fixup_loongarch_tls_le_add_r,144// 12-bit fixup corresponding to %le_lo12_r(foo) for instruction addi.w/d.145fixup_loongarch_tls_le_lo12_r,146// 20-bit fixup corresponding to %ld_pcrel_20(foo) for instruction pcaddi.147fixup_loongarch_tls_ld_pcrel20_s2,148// 20-bit fixup corresponding to %gd_pcrel_20(foo) for instruction pcaddi.149fixup_loongarch_tls_gd_pcrel20_s2,150// 20-bit fixup corresponding to %desc_pcrel_20(foo) for instruction pcaddi.151fixup_loongarch_tls_desc_pcrel20_s2,152};153} // end namespace LoongArch154} // end namespace llvm155156#endif157158159