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;
57 std::vector<std::vector<LetRecord> > LetStack;
58 std::map<std::string, std::unique_ptr<MultiClass>> MultiClasses;
62 typedef std::vector<ForeachLoop> LoopVector;
88 : Lex(SrcMgr), CurMultiClass(nullptr), Records(records), AnonCounter(0) {}
108 const std::vector<unsigned> &BitList,
Init *V);
109 bool SetValue(
Record *TheRec,
SMLoc Loc,
const std::string &ValName,
110 const std::vector<unsigned> &BitList,
Init *V) {
113 bool AddSubClass(Record *Rec, SubClassReference &SubClass);
115 SubMultiClassReference &SubMultiClass);
117 std::string GetNewAnonymousName();
123 IterRecord(VarInit *Var, Init *Val) : IterVar(Var), IterValue(Val) {}
128 typedef std::vector<IterRecord> IterSet;
130 bool ProcessForeachDefs(Record *CurRec, SMLoc Loc);
131 bool ProcessForeachDefs(Record *CurRec, SMLoc Loc, IterSet &IterVals);
134 bool ParseObjectList(
MultiClass *MC =
nullptr);
137 bool ParseMultiClass();
138 Record *InstantiateMulticlassDef(
MultiClass &MC,
141 SMRange DefmPrefixRange,
142 const std::vector<Init *> &TArgs,
143 std::vector<Init *> &TemplateVals);
148 const std::vector<Init *> &TArgs,
149 std::vector<Init *> &TemplateVals,
154 SMLoc DefmPrefixLoc);
158 bool ParseTopLevelLet(
MultiClass *CurMultiClass);
159 std::vector<LetRecord> ParseLetList();
161 bool ParseObjectBody(Record *CurRec);
162 bool ParseBody(Record *CurRec);
163 bool ParseBodyItem(Record *CurRec);
165 bool ParseTemplateArgList(Record *CurRec);
166 Init *ParseDeclaration(Record *CurRec,
bool ParsingTemplateArgs);
167 VarInit *ParseForeachDeclaration(ListInit *&ForeachListValue);
169 SubClassReference ParseSubClassReference(Record *CurRec,
bool isDefm);
170 SubMultiClassReference ParseSubMultiClassReference(
MultiClass *CurMC);
172 Init *ParseIDValue(Record *CurRec,
const std::string &
Name, SMLoc NameLoc,
173 IDParseMode Mode = ParseValueMode);
174 Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType =
nullptr,
175 IDParseMode Mode = ParseValueMode);
176 Init *ParseValue(Record *CurRec, RecTy *ItemType =
nullptr,
177 IDParseMode Mode = ParseValueMode);
178 std::vector<Init*> ParseValueList(Record *CurRec, Record *ArgsRec =
nullptr,
179 RecTy *EltTy =
nullptr);
180 std::vector<std::pair<llvm::Init*, std::string> > ParseDagArgList(Record *);
181 bool ParseOptionalRangeList(std::vector<unsigned> &
Ranges);
182 bool ParseOptionalBitList(std::vector<unsigned> &
Ranges);
183 std::vector<unsigned> ParseRangeList();
184 bool ParseRangePiece(std::vector<unsigned> &
Ranges);
186 Init *ParseOperation(Record *CurRec, RecTy *ItemType);
187 RecTy *ParseOperatorType();
188 Init *ParseObjectName(
MultiClass *CurMultiClass);
189 Record *ParseClassID();
191 bool ApplyLetStack(Record *CurRec);
ListInit - [AL, AH, CL] - Represent a list of defs.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const DependenciesMapTy & getDependencies() const
ForeachLoop(VarInit *IVar, ListInit *LValue)
const TGLexer::DependenciesMapTy & getDependencies() const
LetRecord(const std::string &N, const std::vector< unsigned > &B, Init *V, SMLoc L)
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
static StringInit * get(StringRef)
std::map< std::string, SMLoc > DependenciesMapTy
VarInit - '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.