Go to the documentation of this file.
25 uint64_t value = de.getULEB128(cursor);
26 if (value >= strings.
size()) {
27 printAttribute(tag, value,
"");
30 " value: " +
Twine(value));
32 printAttribute(tag, value, strings[value]);
39 uint64_t value = de.getULEB128(cursor);
44 sw->printNumber(
"Tag", tag);
46 sw->printString(
"TagName", tagName);
47 sw->printNumber(
"Value", value);
56 setAttributeString(tag, desc);
60 sw->printNumber(
"Tag", tag);
62 sw->printString(
"TagName", tagName);
63 sw->printString(
"Value", desc);
76 sw->printNumber(
"Tag", tag);
77 sw->printNumber(
"Value", value);
79 sw->printString(
"TagName", tagName);
80 if (!valueDesc.
empty())
81 sw->printString(
"Description", valueDesc);
87 uint64_t value = de.getULEB128(cursor);
88 if (!cursor || !value)
90 indexList.push_back(value);
97 while ((pos = cursor.tell()) <
end) {
98 uint64_t tag = de.getULEB128(cursor);
100 if (
Error e = handler(tag, handled))
111 if (
Error e = integerAttribute(tag))
114 if (
Error e = stringAttribute(tag))
123 uint64_t end = cursor.tell() -
sizeof(length) + length;
124 StringRef vendorName = de.getCStrRef(cursor);
126 sw->printNumber(
"SectionLength", length);
127 sw->printString(
"Vendor", vendorName);
131 if (vendorName.
lower() != vendor)
133 "unrecognized vendor-name: " + vendorName);
135 while (cursor.tell() <
end) {
137 uint8_t tag = de.getU8(cursor);
140 return cursor.takeError();
144 sw->printNumber(
"Size",
size);
148 "invalid attribute size " +
Twine(
size) +
156 scopeName =
"FileAttributes";
159 scopeName =
"SectionAttributes";
160 indexName =
"Sections";
161 parseIndexList(indicies);
164 scopeName =
"SymbolAttributes";
165 indexName =
"Symbols";
166 parseIndexList(indicies);
177 if (!indicies.empty())
178 sw->printList(indexName, indicies);
181 }
else if (
Error e = parseAttributeList(
size - 5))
189 unsigned sectionNumber = 0;
194 struct ClearCursorError {
200 uint8_t formatVersion = de.getU8(cursor);
203 "unrecognized format-version: 0x" +
204 utohexstr(formatVersion));
206 while (!de.eof(cursor)) {
207 uint32_t sectionLength = de.getU32(cursor);
209 return cursor.takeError();
212 sw->startLine() <<
"Section " << ++sectionNumber <<
" {\n";
216 if (sectionLength < 4 || cursor.tell() - 4 + sectionLength > section.
size())
218 "invalid section length " +
219 Twine(sectionLength) +
" at offset 0x" +
220 utohexstr(cursor.tell() - 4));
222 if (
Error e = parseSubsection(sectionLength))
226 sw->startLine() <<
"}\n";
230 return cursor.takeError();
compiles conv shl5 shl ret i32 or10 it would be better as
This is an optimization pass for GlobalISel generic memory operations.
Error parseStringAttribute(const char *name, unsigned tag, ArrayRef< const char * > strings)
void printAttribute(unsigned tag, unsigned value, StringRef valueDesc)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static ErrorSuccess success()
Create a success value.
const_iterator end(StringRef path)
Get end iterator over path.
Deduce and propagate attributes
void consumeError(Error Err)
Consume a Error without doing anything.
static void clear(coro::Shape &Shape)
Error parseAttributeList(uint32_t length)
constexpr bool empty() const
empty - Check if the string is empty.
static Twine utohexstr(const uint64_t &Val)
std::string lower() const
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Error parse(ArrayRef< uint8_t > section, support::endianness endian)
StringRef - Represent a constant reference to a string, i.e.
Error integerAttribute(unsigned tag)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
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.
static constexpr EnumEntry< unsigned > tagNames[]
Error parseSubsection(uint32_t length)
size_t size() const
size - Get the array size.
ArrayRef(const T &OneElt) -> ArrayRef< T >
Error stringAttribute(unsigned tag)
void parseIndexList(SmallVectorImpl< uint8_t > &indexList)
StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap, bool hasTagPrefix=true)