9#ifndef LLVM_SUPPORT_ELFCOMPACTATTRPARSER_H
10#define LLVM_SUPPORT_ELFCOMPACTATTRPARSER_H
20#include <unordered_map>
28 std::unordered_map<unsigned, unsigned> attributes;
29 std::unordered_map<unsigned, StringRef> attributesStr;
39 void printAttribute(
unsigned tag,
unsigned value,
StringRef valueDesc);
41 Error parseStringAttribute(
const char *
name,
unsigned tag,
48 attributesStr.emplace(tag,
value);
53 Error integerAttribute(
unsigned tag);
54 Error stringAttribute(
unsigned tag);
58 : vendor(vendor), sw(sw), tagToStringMap(tagNameMap) {}
60 : vendor(vendor), sw(nullptr), tagToStringMap(tagNameMap) {}
65 auto I = attributes.find(tag);
66 if (
I == attributes.end())
70 std::optional<unsigned>
72 unsigned tag)
const override {
73 assert(
"" == buildAttributeSubsectionName &&
74 "buildAttributeSubsectionName must be an empty string");
75 return getAttributeValue(tag);
78 auto I = attributesStr.find(tag);
79 if (
I == attributesStr.end())
83 std::optional<StringRef>
85 unsigned tag)
const override {
86 assert(
"" == buildAttributeSubsectionName &&
87 "buildAttributeSubsectionName must be an empty string");
88 return getAttributeString(tag);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Given that RA is a live value
std::optional< StringRef > getAttributeString(unsigned tag) const override
ELFCompactAttrParser(ScopedPrinter *sw, TagNameMap tagNameMap, StringRef vendor)
ELFCompactAttrParser(TagNameMap tagNameMap, StringRef vendor)
void setAttributeString(unsigned tag, StringRef value)
std::optional< StringRef > getAttributeString(StringRef buildAttributeSubsectionName, unsigned tag) const override
std::optional< unsigned > getAttributeValue(StringRef buildAttributeSubsectionName, unsigned tag) const override
TagNameMap tagToStringMap
std::optional< unsigned > getAttributeValue(unsigned tag) const override
virtual ~ELFCompactAttrParser()
Lightweight error class with error context and mandatory checking.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.