14 #ifndef LLVM_LIB_TABLEGEN_TGPARSER_H
15 #define LLVM_LIB_TABLEGEN_TGPARSER_H
31 struct SubClassReference;
32 struct SubMultiClassReference;
36 std::vector<unsigned>
Bits;
56 std::vector<SmallVector<LetRecord, 4>> LetStack;
57 std::map<std::string, std::unique_ptr<MultiClass>> MultiClasses;
61 typedef std::vector<ForeachLoop> LoopVector;
87 : Lex(SrcMgr), CurMultiClass(nullptr), Records(records), AnonCounter(0) {}
108 bool AllowSelfAssignment =
false);
113 std::string GetNewAnonymousName();
124 typedef std::vector<IterRecord> IterSet;
126 bool ProcessForeachDefs(Record *CurRec, SMLoc Loc);
127 bool ProcessForeachDefs(Record *CurRec, SMLoc Loc, IterSet &IterVals);
130 bool ParseObjectList(
MultiClass *MC =
nullptr);
133 bool ParseMultiClass();
134 Record *InstantiateMulticlassDef(
MultiClass &MC, Record *DefProto,
135 Init *&DefmPrefix, SMRange DefmPrefixRange,
136 ArrayRef<Init *> TArgs,
137 ArrayRef<Init *> TemplateVals);
138 bool ResolveMulticlassDefArgs(
MultiClass &MC, Record *DefProto,
139 SMLoc DefmPrefixLoc, SMLoc SubClassLoc,
140 ArrayRef<Init *> TArgs,
141 ArrayRef<Init *> TemplateVals,
bool DeleteArgs);
145 SMLoc DefmPrefixLoc);
149 bool ParseTopLevelLet(
MultiClass *CurMultiClass);
150 void ParseLetList(SmallVectorImpl<LetRecord> &Result);
152 bool ParseObjectBody(Record *CurRec);
153 bool ParseBody(Record *CurRec);
154 bool ParseBodyItem(Record *CurRec);
156 bool ParseTemplateArgList(Record *CurRec);
157 Init *ParseDeclaration(Record *CurRec,
bool ParsingTemplateArgs);
158 VarInit *ParseForeachDeclaration(ListInit *&ForeachListValue);
160 SubClassReference ParseSubClassReference(Record *CurRec,
bool isDefm);
161 SubMultiClassReference ParseSubMultiClassReference(
MultiClass *CurMC);
163 Init *ParseIDValue(Record *CurRec, StringInit *
Name, SMLoc NameLoc,
164 IDParseMode
Mode = ParseValueMode);
165 Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType =
nullptr,
166 IDParseMode
Mode = ParseValueMode);
167 Init *ParseValue(Record *CurRec, RecTy *ItemType =
nullptr,
168 IDParseMode
Mode = ParseValueMode);
169 void ParseValueList(SmallVectorImpl<llvm::Init*> &Result, Record *CurRec,
170 Record *ArgsRec =
nullptr, RecTy *EltTy =
nullptr);
171 void ParseDagArgList(
172 SmallVectorImpl<std::pair<llvm::Init*, StringInit*>> &Result,
174 bool ParseOptionalRangeList(SmallVectorImpl<unsigned> &Ranges);
175 bool ParseOptionalBitList(SmallVectorImpl<unsigned> &Ranges);
176 void ParseRangeList(SmallVectorImpl<unsigned> &Result);
177 bool ParseRangePiece(SmallVectorImpl<unsigned> &Ranges);
179 Init *ParseOperation(Record *CurRec, RecTy *ItemType);
180 RecTy *ParseOperatorType();
181 Init *ParseObjectName(
MultiClass *CurMultiClass);
182 Record *ParseClassID();
184 bool ApplyLetStack(Record *CurRec);
[AL, AH, CL] - Represent a list of defs
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LetRecord(StringInit *N, ArrayRef< unsigned > B, Init *V, SMLoc L)
const DependenciesMapTy & getDependencies() const
ForeachLoop(VarInit *IVar, ListInit *LValue)
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
"foo" - Represent an initialization by a string value.
const TGLexer::DependenciesMapTy & getDependencies() const
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
std::vector< unsigned > Bits
ForeachLoop - Record the iteration state associated with a for loop.
bool Error(SMLoc L, const Twine &Msg) const
typename std::iterator_traits< IterT >::value_type IterValue
std::map< std::string, SMLoc > DependenciesMapTy
'Opcode' - Represent a reference to an entire variable object.
bool ParseFile()
ParseFile - Main entrypoint for parsing a tblgen file.
TGParser(SourceMgr &SrcMgr, RecordKeeper &records)
LLVM Value Representation.
Represents a location in source code.
bool TokError(const Twine &Msg) const
void PrintError(ArrayRef< SMLoc > ErrorLoc, const Twine &Msg)
TGLexer - TableGen Lexer class.