Go to the documentation of this file.
39 if (!IO.outputting() && IO.matchEnumFallback())
65 return "Unsupported endianness";
94 return "Unsupported bit width";
104 IO.mapOptional(
"ObjectFormat",
Target.ObjectFormat);
105 IO.mapOptional(
"Arch",
Target.ArchString);
106 IO.mapOptional(
"Endianness",
Target.Endianness);
107 IO.mapOptional(
"BitWidth",
Target.BitWidth);
111 static const bool flow =
true;
117 IO.mapRequired(
"Name",
Symbol.Name);
118 IO.mapRequired(
"Type",
Symbol.Type);
124 IO.mapOptional(
"Size",
Symbol.Size);
126 IO.mapOptional(
"Size",
Symbol.Size);
128 IO.mapOptional(
"Undefined",
Symbol.Undefined,
false);
129 IO.mapOptional(
"Weak",
Symbol.Weak,
false);
130 IO.mapOptional(
"Warning",
Symbol.Warning);
134 static const bool flow =
true;
140 if (!IO.mapTag(
"!ifs-v1",
true))
141 IO.setError(
"Not a .tbe YAML file.");
142 IO.mapRequired(
"IfsVersion", Stub.
IfsVersion);
143 IO.mapOptional(
"SoName", Stub.
SoName);
144 IO.mapOptional(
"Target", Stub.
Target);
145 IO.mapOptional(
"NeededLibs", Stub.
NeededLibs);
146 IO.mapRequired(
"Symbols", Stub.
Symbols);
153 if (!IO.mapTag(
"!ifs-v1",
true))
154 IO.setError(
"Not a .tbe YAML file.");
155 IO.mapRequired(
"IfsVersion", Stub.
IfsVersion);
156 IO.mapOptional(
"SoName", Stub.
SoName);
158 IO.mapOptional(
"NeededLibs", Stub.
NeededLibs);
159 IO.mapRequired(
"Symbols", Stub.
Symbols);
170 if (Line ==
"Target:" || Line.
contains(
"{")) {
179 yaml::Input YamlIn(Buf);
184 YamlIn >> *
static_cast<IFSStub *
>(Stub.get());
186 if (std::error_code Err = YamlIn.error()) {
191 return make_error<StringError>(
192 "IFS version " + Stub->IfsVersion.getAsString() +
" is unsupported.",
194 if (Stub->Target.ArchString) {
202 yaml::Output YamlOut(OS,
nullptr, 0);
203 std::unique_ptr<IFSStubTriple> CopyStub(
new IFSStubTriple(Stub));
205 CopyStub->Target.ArchString = std::string(
210 if (CopyStub->Target.Triple ||
211 (!CopyStub->Target.ArchString && !CopyStub->Target.Endianness &&
212 !CopyStub->Target.BitWidth))
213 YamlOut << *CopyStub;
215 YamlOut << *static_cast<IFSStub *>(CopyStub.get());
223 std::error_code OverrideEC(1, std::generic_category());
227 return make_error<StringError>(
228 "Supplied Arch conflicts with the text stub", OverrideEC);
232 if (OverrideEndianness) {
235 return make_error<StringError>(
236 "Supplied Endianness conflicts with the text stub", OverrideEC);
240 if (OverrideBitWidth) {
243 return make_error<StringError>(
244 "Supplied BitWidth conflicts with the text stub", OverrideEC);
248 if (OverrideTriple) {
251 return make_error<StringError>(
252 "Supplied Triple conflicts with the text stub", OverrideEC);
260 std::error_code ValidationEC(1, std::generic_category());
264 return make_error<StringError>(
265 "Target triple cannot be used simultaneously with ELF target format",
279 return make_error<StringError>(
"Arch is not defined in the text stub",
283 return make_error<StringError>(
"BitWidth is not defined in the text stub",
287 return make_error<StringError>(
288 "Endianness is not defined in the text stub", ValidationEC);
295 Triple IFSTriple(TripleStr);
299 case Triple::ArchType::aarch64:
302 case Triple::ArchType::x86_64:
316 bool StripEndianness,
bool StripBitWidth) {
317 if (StripTriple || StripArch) {
321 if (StripTriple || StripEndianness) {
324 if (StripTriple || StripBitWidth) {
336 const std::vector<std::string> &Exclude) {
341 if (StripUndefined) {
343 return Sym.Undefined ||
Filter(Sym);
StringSwitch & Case(StringLiteral S, T Value)
std::vector< std::string > NeededLibs
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
This is an optimization pass for GlobalISel generic memory operations.
A forward iterator which reads text lines from a buffer.
static void output(const IFSBitWidthType &Value, void *, llvm::raw_ostream &Out)
LLVM_NODISCARD R Default(T Value)
Target - Wrapper for Target specific information.
Error filterIFSSyms(IFSStub &Stub, bool StripUndefined, const std::vector< std::string > &Exclude={})
static ErrorSuccess success()
Create a success value.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
static StringRef input(StringRef Scalar, void *, IFSEndiannessType &Value)
const VersionTuple IFSVersionCurrent(3, 0)
Triple - Helper class for working with autoconf configuration names.
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
static void mapping(IO &IO, IFSStub &Stub)
Error writeIFSToOutputStream(raw_ostream &OS, const IFSStub &Stub)
Attempts to write an IFS interface file to a raw_ostream.
Tagged union holding either a T or a Error.
MatchResult match(StringRef Buffer, const SourceMgr &SM) const
Matches the pattern string against the input buffer Buffer.
bool isArch64Bit() const
Test whether the architecture is 64-bit.
bool isLittleEndian() const
Tests whether the target triple is little endian.
Error validateIFSTarget(IFSStub &Stub, bool ParseTriple)
Validate the target platform inforation in the text stub.
Expected< std::unique_ptr< IFSStub > > readIFSFromBuffer(StringRef Buf)
Attempts to read an IFS interface file from a StringRef buffer.
LLVM_NODISCARD bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
This class implements an extremely fast bulk output stream that can only output to a stream.
Optional< std::string > SoName
ArchType getArch() const
Get the parsed architecture type of this triple.
Optional< IFSBitWidthType > BitWidth
Optional< std::string > ArchString
LLVM_NODISCARD StringRef trim(char Char) const
Return string with consecutive Char characters starting from the left and right removed.
Optional< std::string > Triple
static StringRef input(StringRef Scalar, void *, IFSBitWidthType &Value)
void stripIFSTarget(IFSStub &Stub, bool StripTriple, bool StripArch, bool StripEndianness, bool StripBitWidth)
Strips target platform information from the text stub.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
static void output(const IFSEndiannessType &Value, void *, llvm::raw_ostream &Out)
static void enumeration(IO &IO, IFSSymbolType &SymbolType)
constexpr const T & getValue() const &
print Print MemDeps of function
static Expected< GlobPattern > create(StringRef Pat)
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static void mapping(IO &IO, IFSStubTriple &Stub)
std::error_code make_error_code(BitcodeError E)
static void mapping(IO &IO, IFSTarget &Target)
IFSTarget parseTriple(StringRef TripleStr)
Parse llvm triple string into a IFSTarget struct.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Lightweight error class with error context and mandatory checking.
StringRef convertEMachineToArchName(uint16_t EMachine)
Convert an ELF's e_machine value into an architecture name.
std::vector< IFSSymbol > Symbols
Error takeError()
Take ownership of the stored error.
bool usesTriple(StringRef Buf)
Attempt to determine if a Text stub uses target triple.
static void mapping(IO &IO, IFSSymbol &Symbol)
static QuotingType mustQuote(StringRef)
static QuotingType mustQuote(StringRef)
A switch()-like statement whose cases are string literals.
uint16_t convertArchNameToEMachine(StringRef Arch)
Convert an architecture name into ELF's e_machine value.
Optional< std::string > ObjectFormat
Optional< IFSEndiannessType > Endianness
LLVM Value Representation.
Error overrideIFSTarget(IFSStub &Stub, Optional< IFSArch > OverrideArch, Optional< IFSEndiannessType > OverrideEndianness, Optional< IFSBitWidthType > OverrideBitWidth, Optional< std::string > OverrideTriple)
Override the target platform inforation in the text stub.