LLVM 22.0.0git
IFSStub.cpp
Go to the documentation of this file.
1//===- IFSStub.cpp --------------------------------------------------------===//
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
12
13using namespace llvm;
14using namespace llvm::ifs;
15
18 Target = Stub.Target;
19 SoName = Stub.SoName;
21 Symbols = Stub.Symbols;
22}
23
25 IfsVersion = std::move(Stub.IfsVersion);
26 Target = std::move(Stub.Target);
27 SoName = std::move(Stub.SoName);
28 NeededLibs = std::move(Stub.NeededLibs);
29 Symbols = std::move(Stub.Symbols);
30}
31
34 Target = Stub.Target;
35 SoName = Stub.SoName;
37 Symbols = Stub.Symbols;
38}
39
42 Target = Stub.Target;
43 SoName = Stub.SoName;
45 Symbols = Stub.Symbols;
46}
47
49 IfsVersion = std::move(Stub.IfsVersion);
50 Target = std::move(Stub.Target);
51 SoName = std::move(Stub.SoName);
52 NeededLibs = std::move(Stub.NeededLibs);
53 Symbols = std::move(Stub.Symbols);
54}
55
57 return !Triple && !ObjectFormat && !Arch && !ArchString && !Endianness &&
58 !BitWidth;
59}
60
62 switch (BitWidth) {
64 return ELF::ELFCLASS32;
66 return ELF::ELFCLASS64;
67 default:
68 llvm_unreachable("unknown bitwidth");
69 }
70}
71
73 switch (Endianness) {
75 return ELF::ELFDATA2LSB;
77 return ELF::ELFDATA2MSB;
78 default:
79 llvm_unreachable("unknown endianness");
80 }
81}
82
84 switch (SymbolType) {
86 return ELF::STT_OBJECT;
88 return ELF::STT_FUNC;
90 return ELF::STT_TLS;
92 return ELF::STT_NOTYPE;
93 default:
94 llvm_unreachable("unknown symbol type");
95 }
96}
97
108
110 switch (Endianness) {
111 case ELF::ELFDATA2LSB:
113 case ELF::ELFDATA2MSB:
115 default:
117 }
118}
119
121 SymbolType = SymbolType & 0xf;
122 switch (SymbolType) {
123 case ELF::STT_OBJECT:
125 case ELF::STT_FUNC:
126 return IFSSymbolType::Func;
127 case ELF::STT_TLS:
128 return IFSSymbolType::TLS;
129 case ELF::STT_NOTYPE:
131 default:
133 }
134}
This file defines an internal representation of an InterFace Stub.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ STT_FUNC
Definition ELF.h:1410
@ STT_NOTYPE
Definition ELF.h:1408
@ STT_OBJECT
Definition ELF.h:1409
@ STT_TLS
Definition ELF.h:1414
@ ELFDATA2MSB
Definition ELF.h:341
@ ELFDATA2LSB
Definition ELF.h:340
@ ELFCLASS64
Definition ELF.h:334
@ ELFCLASS32
Definition ELF.h:333
LLVM_ABI uint8_t convertIFSEndiannessToELF(IFSEndiannessType Endianness)
This function convert endianness type from IFS enum to ELF format Currently, ELFDATA2LSB and ELFDATA2...
Definition IFSStub.cpp:72
LLVM_ABI uint8_t convertIFSBitWidthToELF(IFSBitWidthType BitWidth)
This function convert bit width type from IFS enum to ELF format Currently, ELFCLASS32 and ELFCLASS64...
Definition IFSStub.cpp:61
LLVM_ABI uint8_t convertIFSSymbolTypeToELF(IFSSymbolType SymbolType)
This function convert symbol type from IFS enum to ELF format Currently, STT_NOTYPE,...
Definition IFSStub.cpp:83
IFSEndiannessType
Definition IFSStub.h:37
IFSBitWidthType
Definition IFSStub.h:45
IFSSymbolType
Definition IFSStub.h:27
LLVM_ABI IFSBitWidthType convertELFBitWidthToIFS(uint8_t BitWidth)
This function extracts ELF bit width from e_ident[EI_CLASS] of an ELF file Currently,...
Definition IFSStub.cpp:98
LLVM_ABI IFSEndiannessType convertELFEndiannessToIFS(uint8_t Endianness)
This function extracts ELF endianness from e_ident[EI_DATA] of an ELF file Currently,...
Definition IFSStub.cpp:109
LLVM_ABI IFSSymbolType convertELFSymbolTypeToIFS(uint8_t SymbolType)
This function extracts symbol type from a symbol's st_info member and maps it to an IFSSymbolType enu...
Definition IFSStub.cpp:120
This is an optimization pass for GlobalISel generic memory operations.
constexpr unsigned BitWidth
std::vector< IFSSymbol > Symbols
Definition IFSStub.h:96
VersionTuple IfsVersion
Definition IFSStub.h:92
IFSTarget Target
Definition IFSStub.h:94
std::optional< std::string > SoName
Definition IFSStub.h:93
std::vector< std::string > NeededLibs
Definition IFSStub.h:95
std::optional< std::string > ArchString
Definition IFSStub.h:69
std::optional< std::string > Triple
Definition IFSStub.h:66
std::optional< IFSEndiannessType > Endianness
Definition IFSStub.h:70
std::optional< IFSBitWidthType > BitWidth
Definition IFSStub.h:71
std::optional< std::string > ObjectFormat
Definition IFSStub.h:67
LLVM_ABI bool empty()
Definition IFSStub.cpp:56
std::optional< IFSArch > Arch
Definition IFSStub.h:68