LLVM 20.0.0git
M68kFixupKinds.h
Go to the documentation of this file.
1//===-- M68kFixupKinds.h - M68k 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/// \file
10/// This file contains M68k specific fixup entries.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_M68k_MCTARGETDESC_M68kFIXUPKINDS_H
15#define LLVM_LIB_TARGET_M68k_MCTARGETDESC_M68kFIXUPKINDS_H
16
17#include "llvm/MC/MCFixup.h"
18
19namespace llvm {
20static inline unsigned getFixupKindLog2Size(unsigned Kind) {
21 switch (Kind) {
22 case FK_PCRel_1:
23 case FK_SecRel_1:
24 case FK_Data_1:
25 return 0;
26 case FK_PCRel_2:
27 case FK_SecRel_2:
28 case FK_Data_2:
29 return 1;
30 case FK_PCRel_4:
31 case FK_SecRel_4:
32 case FK_Data_4:
33 return 2;
34 }
35 llvm_unreachable("invalid fixup kind!");
36}
37
38static inline MCFixupKind getFixupForSize(unsigned Size, bool isPCRel) {
39 switch (Size) {
40 case 8:
41 return isPCRel ? FK_PCRel_1 : FK_Data_1;
42 case 16:
43 return isPCRel ? FK_PCRel_2 : FK_Data_2;
44 case 32:
45 return isPCRel ? FK_PCRel_4 : FK_Data_4;
46 case 64:
47 return isPCRel ? FK_PCRel_8 : FK_Data_8;
48 }
49 llvm_unreachable("Invalid generic fixup size!");
50}
51
52} // namespace llvm
53
54#endif // LLVM_LIB_TARGET_M68k_MCTARGETDESC_M68kFIXUPKINDS_H
uint64_t Size
static bool isPCRel(unsigned Kind)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
static MCFixupKind getFixupForSize(unsigned Size, bool isPCRel)
static unsigned getFixupKindLog2Size(unsigned Kind)
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:21
@ FK_PCRel_4
A four-byte pc relative fixup.
Definition: MCFixup.h:30
@ FK_PCRel_2
A two-byte pc relative fixup.
Definition: MCFixup.h:29
@ FK_SecRel_2
A two-byte section relative fixup.
Definition: MCFixup.h:41
@ FK_Data_8
A eight-byte fixup.
Definition: MCFixup.h:26
@ FK_Data_1
A one-byte fixup.
Definition: MCFixup.h:23
@ FK_Data_4
A four-byte fixup.
Definition: MCFixup.h:25
@ FK_PCRel_8
A eight-byte pc relative fixup.
Definition: MCFixup.h:31
@ FK_SecRel_4
A four-byte section relative fixup.
Definition: MCFixup.h:42
@ FK_PCRel_1
A one-byte pc relative fixup.
Definition: MCFixup.h:28
@ FK_SecRel_1
A one-byte section relative fixup.
Definition: MCFixup.h:40
@ FK_Data_2
A two-byte fixup.
Definition: MCFixup.h:24