31 #define RECORD(name, altName, print, parse) #name 41 #define RECORD(name, altName, print, parse) #altName 52 for (
unsigned i = 0; i < names.
size(); ++i) {
53 map.
insert(std::make_pair(names[i], i));
54 map.
insert(std::make_pair(altNames[i], i));
60 static const auto map =
createIndexMap(get_amd_kernel_code_t_FldNames(),
61 get_amd_kernel_code_t_FldAltNames());
62 return map.lookup(name) - 1;
66 return get_amd_kernel_code_t_FldNames()[index + 1];
72 return OS << Name <<
" = ";
75 template <
typename T, T amd_kernel_code_t::*ptr>
81 template <
typename T, T amd_kernel_code_t::*ptr,
int shift,
int w
idth = 1>
84 const auto Mask = (
static_cast<T>(1) << width) - 1;
91 static const PrintFx Table[] = {
92 #define RECORD(name, altName, print, parse) print 102 auto Printer = getPrinterTable()[FldIndex];
110 const int Size = getPrinterTable().size();
111 for (
int i = 0; i <
Size; ++i) {
123 Err <<
"expected '='";
129 Err <<
"integer absolute expression expected";
135 template <
typename T, T amd_kernel_code_t::*ptr>
145 template <
typename T, T amd_kernel_code_t::*ptr,
int shift,
int w
idth = 1>
151 const uint64_t
Mask = ((UINT64_C(1) << width) - 1) << shift;
153 C.*ptr |= (
T)((Value << shift) &
Mask);
161 static const ParseFx Table[] = {
162 #define RECORD(name, altName, print, parse) parse 171 amd_kernel_code_t &
C,
175 Err <<
"unexpected amd_kernel_code_t field name " <<
ID;
178 auto Parser = getParserTable()[Idx];
179 return Parser ? Parser(C, MCParser, Err) :
false;
static StringMap< int > createIndexMap(const ArrayRef< StringRef > &names, const ArrayRef< StringRef > &altNames)
This class represents lattice values for constants.
Generic assembler parser interface, for use by target specific assembly parsers.
print alias Alias Set Printer
bool parseAmdKernelCodeField(StringRef ID, MCAsmParser &Parser, amd_kernel_code_t &C, raw_ostream &Err)
bool(*)(amd_kernel_code_t &, MCAsmParser &MCParser, raw_ostream &Err) ParseFx
amdgpu Simplify well known AMD library false Value Value const Twine & Name
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
AMD Kernel Code Object (amd_kernel_code_t).
static bool parseBitField(amd_kernel_code_t &C, MCAsmParser &MCParser, raw_ostream &Err)
void(*)(StringRef, const amd_kernel_code_t &, raw_ostream &) PrintFx
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static void printField(StringRef Name, const amd_kernel_code_t &C, raw_ostream &OS)
static void printBitField(StringRef Name, const amd_kernel_code_t &c, raw_ostream &OS)
size_t size() const
size - Get the array size.
virtual MCAsmLexer & getLexer()=0
static raw_ostream & printName(raw_ostream &OS, StringRef Name)
void printAmdKernelCodeField(const amd_kernel_code_t &C, int FldIndex, raw_ostream &OS)
static int get_amd_kernel_code_t_FieldIndex(StringRef name)
static bool expectAbsExpression(MCAsmParser &MCParser, int64_t &Value, raw_ostream &Err)
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
const AsmToken & Lex()
Consume the next token from the input stream and return it.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
static StringRef get_amd_kernel_code_t_FieldName(int index)
virtual bool parseAbsoluteExpression(int64_t &Res)=0
Parse an expression which must evaluate to an absolute value.
bool isNot(AsmToken::TokenKind K) const
Check if the current token has kind K.
void dumpAmdKernelCode(const amd_kernel_code_t *C, raw_ostream &OS, const char *tab)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
static bool parseField(amd_kernel_code_t &C, MCAsmParser &MCParser, raw_ostream &Err)