LLVM 18.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 default:
93 return ELF::STT_NOTYPE;
94 }
95}
96
98 switch (BitWidth) {
99 case ELF::ELFCLASS32:
101 case ELF::ELFCLASS64:
103 default:
105 }
106}
107
109 switch (Endianness) {
110 case ELF::ELFDATA2LSB:
112 case ELF::ELFDATA2MSB:
114 default:
116 }
117}
118
120 SymbolType = SymbolType & 0xf;
121 switch (SymbolType) {
122 case ELF::STT_OBJECT:
124 case ELF::STT_FUNC:
125 return IFSSymbolType::Func;
126 case ELF::STT_TLS:
127 return IFSSymbolType::TLS;
128 case ELF::STT_NOTYPE:
130 default:
132 }
133}
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.
@ ELFDATA2MSB
Definition: ELF.h:336
@ ELFDATA2LSB
Definition: ELF.h:335
@ ELFCLASS64
Definition: ELF.h:329
@ ELFCLASS32
Definition: ELF.h:328
@ STT_FUNC
Definition: ELF.h:1256
@ STT_NOTYPE
Definition: ELF.h:1254
@ STT_OBJECT
Definition: ELF.h:1255
@ STT_TLS
Definition: ELF.h:1260
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:97
IFSEndiannessType convertELFEndiannessToIFS(uint8_t Endianness)
This function extracts ELF endianness from e_ident[EI_DATA] of an ELF file Currently,...
Definition: IFSStub.cpp:108
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:119
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
constexpr unsigned BitWidth
Definition: BitmaskEnum.h:184
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