27 #define RECORD(name, altName, print, parse) #name
37 #define RECORD(name, altName, print, parse) #altName
48 for (
unsigned i = 0;
i < names.
size(); ++
i) {
49 map.
insert(std::make_pair(names[
i], i));
50 map.
insert(std::make_pair(altNames[i], i));
56 static const auto map =
createIndexMap(get_amd_kernel_code_t_FldNames(),
57 get_amd_kernel_code_t_FldAltNames());
58 return map.lookup(name) - 1;
62 return get_amd_kernel_code_t_FldNames()[index + 1];
69 return OS << Name <<
" = ";
72 template <
typename T, T amd_kernel_code_t::*ptr>
78 template <
typename T, T amd_kernel_code_t::*ptr,
int shift,
int w
idth = 1>
81 const auto Mask = (
static_cast<T>(1) << width) - 1;
90 static const PrintFx Table[] = {
91 #define RECORD(name, altName, print, parse) print
101 auto Printer = getPrinterTable()[FldIndex];
109 const int Size = getPrinterTable().size();
110 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);
162 static const ParseFx Table[] = {
163 #define RECORD(name, altName, print, parse) parse
176 Err <<
"unexpected amd_kernel_code_t field name " <<
ID;
179 auto Parser = getParserTable()[Idx];
180 return Parser ? Parser(C, MCParser, Err) :
false;
static StringMap< int > createIndexMap(const ArrayRef< StringRef > &names, const ArrayRef< StringRef > &altNames)
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)
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)
bool isNot(AsmToken::TokenKind K) const
Check if the current token has kind K.
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)
size_t size() const
size - Get the array size.
static void printBitField(StringRef Name, const amd_kernel_code_t &c, raw_ostream &OS)
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.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
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"...
bool(* ParseFx)(amd_kernel_code_t &, MCAsmParser &MCParser, raw_ostream &Err)
static StringRef get_amd_kernel_code_t_FieldName(int index)
void(* PrintFx)(StringRef, const amd_kernel_code_t &, raw_ostream &)
virtual bool parseAbsoluteExpression(int64_t &Res)=0
Parse an expression which must evaluate to an absolute value.
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)