LLVM 20.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
99 switch (BitWidth) {
100 case ELF::ELFCLASS32:
102 case ELF::ELFCLASS64:
104 default:
106 }
107}
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.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ ELFCLASS64
Definition: ELF.h:330
@ ELFCLASS32
Definition: ELF.h:329
@ STT_FUNC
Definition: ELF.h:1355
@ STT_NOTYPE
Definition: ELF.h:1353
@ STT_OBJECT
Definition: ELF.h:1354
@ STT_TLS
Definition: ELF.h:1359
@ ELFDATA2MSB
Definition: ELF.h:337
@ ELFDATA2LSB
Definition: ELF.h:336
uint8_t convertIFSEndiannessToELF(IFSEndiannessType Endianness)
This function convert endianness type from IFS enum to ELF format Currently, ELFDATA2LSB and ELFDATA2...
Definition: IFSStub.cpp:72
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
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:36
IFSBitWidthType
Definition: IFSStub.h:44
IFSSymbolType
Definition: IFSStub.h:26
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
IFSEndiannessType convertELFEndiannessToIFS(uint8_t Endianness)
This function extracts ELF endianness from e_ident[EI_DATA] of an ELF file Currently,...
Definition: IFSStub.cpp:109
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.
Definition: AddressRanges.h:18
constexpr unsigned BitWidth
Definition: BitmaskEnum.h:217
std::vector< IFSSymbol > Symbols
Definition: IFSStub.h:95
VersionTuple IfsVersion
Definition: IFSStub.h:91
IFSTarget Target
Definition: IFSStub.h:93
std::optional< std::string > SoName
Definition: IFSStub.h:92
std::vector< std::string > NeededLibs
Definition: IFSStub.h:94
std::optional< std::string > ArchString
Definition: IFSStub.h:68
std::optional< IFSEndiannessType > Endianness
Definition: IFSStub.h:69
std::optional< IFSBitWidthType > BitWidth
Definition: IFSStub.h:70
std::optional< std::string > ObjectFormat
Definition: IFSStub.h:66
std::optional< IFSArch > Arch
Definition: IFSStub.h:67