LLVM  14.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 
19 namespace llvm {
20 static 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 
38 static 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::Check::Size
@ Size
Definition: FileCheck.h:73
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::FK_PCRel_8
@ FK_PCRel_8
A eight-byte pc relative fixup.
Definition: MCFixup.h:31
isPCRel
static bool isPCRel(unsigned Kind)
Definition: HexagonMCCodeEmitter.cpp:552
llvm::FK_PCRel_1
@ FK_PCRel_1
A one-byte pc relative fixup.
Definition: MCFixup.h:28
llvm::FK_Data_4
@ FK_Data_4
A four-byte fixup.
Definition: MCFixup.h:25
llvm::FK_SecRel_4
@ FK_SecRel_4
A four-byte section relative fixup.
Definition: MCFixup.h:42
llvm::FK_SecRel_2
@ FK_SecRel_2
A two-byte section relative fixup.
Definition: MCFixup.h:41
llvm::getFixupKindLog2Size
static unsigned getFixupKindLog2Size(unsigned Kind)
Definition: M68kFixupKinds.h:20
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::getFixupForSize
static MCFixupKind getFixupForSize(unsigned Size, bool isPCRel)
Definition: M68kFixupKinds.h:38
llvm::FK_PCRel_2
@ FK_PCRel_2
A two-byte pc relative fixup.
Definition: MCFixup.h:29
llvm::FK_Data_1
@ FK_Data_1
A one-byte fixup.
Definition: MCFixup.h:23
llvm::FK_PCRel_4
@ FK_PCRel_4
A four-byte pc relative fixup.
Definition: MCFixup.h:30
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
MCFixup.h
llvm::FK_SecRel_1
@ FK_SecRel_1
A one-byte section relative fixup.
Definition: MCFixup.h:40
llvm::MCFixupKind
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:21
llvm::FK_Data_8
@ FK_Data_8
A eight-byte fixup.
Definition: MCFixup.h:26
llvm::FK_Data_2
@ FK_Data_2
A two-byte fixup.
Definition: MCFixup.h:24