13 #ifndef LLVM_LIB_TABLEGEN_TGPARSER_H 14 #define LLVM_LIB_TABLEGEN_TGPARSER_H 31 struct SubClassReference;
32 struct SubMultiClassReference;
36 std::vector<unsigned>
Bits;
40 : Name(N), Bits(B), Value(V), Loc(L) {
46 std::unique_ptr<Record>
Rec;
47 std::unique_ptr<ForeachLoop>
Loop;
54 : Loop(
std::move(Loop)) {}
72 : Loc(Loc), IterVar(IVar), ListValue(LValue) {}
83 std::map<std::string, Init *, std::less<>> vars;
84 std::unique_ptr<TGLocalVarScope> parent;
89 : parent(
std::move(parent)) {}
94 return std::move(parent);
98 auto It = vars.find(Name);
102 return parent->getVar(Name);
111 return vars.find(Name) != vars.end();
115 bool Ins = vars.insert(std::make_pair(Name, I)).second;
117 assert(Ins &&
"Local variable already exists");
128 Rec(Name, Loc, Records) {}
133 std::vector<SmallVector<LetRecord, 4>> LetStack;
134 std::map<std::string, std::unique_ptr<MultiClass>> MultiClasses;
138 std::vector<std::unique_ptr<ForeachLoop>>
Loops;
148 std::unique_ptr<TGLocalVarScope> CurLocalScope;
167 : Lex(SM, Macros), CurMultiClass(nullptr), Records(records) {}
185 CurLocalScope = std::make_unique<TGLocalVarScope>(std::move(CurLocalScope));
189 return CurLocalScope.get();
192 assert(ExpectedStackTop == CurLocalScope.get() &&
193 "Mismatched pushes and pops of local variable scopes");
194 CurLocalScope = CurLocalScope->extractParent();
201 bool AllowSelfAssignment =
false);
211 std::vector<RecordsEntry> *Dest,
SMLoc *Loc =
nullptr);
213 bool Final, std::vector<RecordsEntry> *Dest,
214 SMLoc *Loc =
nullptr);
215 bool addDefOne(std::unique_ptr<Record> Rec);
218 bool ParseObjectList(
MultiClass *MC =
nullptr);
221 bool ParseMultiClass();
229 bool ParseTopLevelLet(
MultiClass *CurMultiClass);
232 bool ParseObjectBody(
Record *CurRec);
233 bool ParseBody(
Record *CurRec);
234 bool ParseBodyItem(
Record *CurRec);
236 bool ParseTemplateArgList(
Record *CurRec);
237 Init *ParseDeclaration(
Record *CurRec,
bool ParsingTemplateArgs);
238 VarInit *ParseForeachDeclaration(
Init *&ForeachListValue);
244 IDParseMode
Mode = ParseValueMode);
246 IDParseMode
Mode = ParseValueMode);
248 IDParseMode
Mode = ParseValueMode);
250 Record *ArgsRec =
nullptr,
RecTy *EltTy =
nullptr);
251 void ParseDagArgList(
262 RecTy *ParseOperatorType();
266 bool ApplyLetStack(
Record *CurRec);
This class represents lattice values for constants.
static void SetValue(Value *V, GenericValue Val, ExecutionContext &SF)
std::unique_ptr< ForeachLoop > Loop
std::unique_ptr< Record > Rec
RecordsEntry(std::unique_ptr< Record > Rec)
const TGLexer::DependenciesSetTy & getDependencies() const
std::unique_ptr< TGLocalVarScope > extractParent()
C::iterator addEntry(C &Container, StringRef InstallName)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
TGParser(SourceMgr &SM, ArrayRef< std::string > Macros, RecordKeeper &records)
This is the common super-class of types that have a specific, explicit, type.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
LetRecord(StringInit *N, ArrayRef< unsigned > B, Init *V, SMLoc L)
TGLocalVarScope(std::unique_ptr< TGLocalVarScope > parent)
ForeachLoop(SMLoc Loc, VarInit *IVar, Init *LValue)
std::vector< RecordsEntry > Entries
MultiClass(StringRef Name, SMLoc Loc, RecordKeeper &Records)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
"foo" - Represent an initialization by a string value.
RecordsEntry - Can be either a record or a foreach loop.
TGLocalVarScope * PushLocalScope()
const DependenciesSetTy & getDependencies() const
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
std::vector< unsigned > Bits
bool Error(SMLoc L, const Twine &Msg) const
std::set< std::string > DependenciesSetTy
ForeachLoop - Record the iteration state associated with a for loop.
Init * getVar(StringRef Name) const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool TokError(const Twine &Msg) const
void addVar(StringRef Name, Init *I)
Represents a single loop in the control flow graph.
SmallVector< Init *, 16 > Elements
'Opcode' - Represent a reference to an entire variable object.
bool varAlreadyDefined(StringRef Name) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
RecordsEntry(std::unique_ptr< ForeachLoop > Loop)
std::vector< RecordsEntry > Entries
StringRef - Represent a constant reference to a string, i.e.
Represents a location in source code.
void PopLocalScope(TGLocalVarScope *ExpectedStackTop)
void PrintError(ArrayRef< SMLoc > ErrorLoc, const Twine &Msg)
TGLexer - TableGen Lexer class.