Home | History | Annotate | Download | only in TableGen

Lines Matching refs:CurRec

60 bool TGParser::AddValue(Record *CurRec, SMLoc Loc, const RecordVal &RV) {
61 if (!CurRec)
62 CurRec = &CurMultiClass->Rec;
64 if (RecordVal *ERV = CurRec->getValue(RV.getNameInit())) {
72 CurRec->addValue(RV);
79 bool TGParser::SetValue(Record *CurRec, SMLoc Loc, Init *ValName,
83 if (!CurRec) CurRec = &CurMultiClass->Rec;
85 RecordVal *RV = CurRec->getValue(ValName);
146 /// AddSubClass - Add SubClass as a subclass to CurRec, resolving its template
148 bool TGParser::AddSubClass(Record *CurRec, SubClassReference &SubClass) {
152 if (AddValue(CurRec, SubClass.RefRange.Start, Val))
167 if (SetValue(CurRec, SubClass.RefRange.Start, TArgs[i],
172 CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
175 CurRec->removeValue(TArgs[i]);
177 } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
190 if (CurRec->isSubClassOf(SCs[i]))
193 CurRec->addSuperClass(SCs[i], SCRanges[i]);
196 if (CurRec->isSubClassOf(SC))
199 CurRec->addSuperClass(SC, SubClass.RefRange);
209 Record *CurRec = &CurMC->Rec;
213 if (AddValue(CurRec, SubMultiClass.RefRange.Start, SMCVal))
224 for (const auto &MCVal : CurRec->getValues())
245 if (SetValue(CurRec, SubMultiClass.RefRange.Start, SMCTArgs[i],
251 CurRec->resolveReferencesTo(CurRec->getValue(SMCTArgs[i]));
254 CurRec->removeValue(SMCTArgs[i]);
271 } else if (!CurRec->getValue(SMCTArgs[i])->getValue()->isComplete()) {
285 bool TGParser::ProcessForeachDefs(Record *CurRec, SMLoc Loc) {
289 // We want to instantiate a new copy of CurRec for each combination
293 return ProcessForeachDefs(CurRec, Loc, IterVals);
299 bool TGParser::ProcessForeachDefs(Record *CurRec, SMLoc Loc, IterSet &IterVals){
312 Init *ItemVal = List->resolveListElementReference(*CurRec, nullptr, i);
314 if (ProcessForeachDefs(CurRec, Loc, IterVals))
324 auto IterRec = make_unique<Record>(*CurRec);
395 Record *CurRec = nullptr;
397 CurRec = &CurMultiClass->Rec;
400 if (CurRec) {
401 const TypedInit *CurRecName = dyn_cast<TypedInit>(CurRec->getNameInit());
409 return ParseValue(CurRec, Type, ParseNameMode);
457 ParseSubClassReference(Record *CurRec, bool isDefm) {
482 Result.TemplateArgs = ParseValueList(CurRec, Result.Rec);
713 Init *TGParser::ParseIDValue(Record *CurRec,
716 if (CurRec) {
717 if (const RecordVal *RV = CurRec->getValue(Name))
720 Init *TemplateArgName = QualifyName(*CurRec, CurMultiClass, Name, ":");
726 if (CurRec->isTemplateArg(TemplateArgName)) {
727 const RecordVal *RV = CurRec->getValue(TemplateArgName);
769 Init *TGParser::ParseOperation(Record *CurRec, RecTy *ItemType) {
815 Init *LHS = ParseValue(CurRec);
873 return (UnOpInit::get(Code, LHS, Type))->Fold(CurRec, CurMultiClass);
919 InitList.push_back(ParseValue(CurRec));
925 InitList.push_back(ParseValue(CurRec));
954 ->Fold(CurRec, CurMultiClass);
961 ->Fold(CurRec, CurMultiClass);
993 Init *LHS = ParseValue(CurRec);
1002 Init *MHS = ParseValue(CurRec, ItemType);
1012 Init *RHS = ParseValue(CurRec, ItemType);
1082 return (TernOpInit::get(Code, LHS, MHS, RHS, Type))->Fold(CurRec,
1138 Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType,
1147 return ParseSimpleValue(CurRec, ItemType, Mode);
1183 return ParseIDValue(CurRec, Name, NameLoc, Mode); // Value ::= IDValue
1200 std::vector<Init*> ValueList = ParseValueList(CurRec, Class);
1210 // Create the new record, set it as CurRec temporarily.
1262 Vals = ParseValueList(CurRec);
1325 Vals = ParseValueList(CurRec, nullptr,
1409 Init *Operator = ParseValue(CurRec);
1425 DagArgs = ParseDagArgList(CurRec);
1454 return ParseOperation(CurRec, ItemType);
1468 Init *TGParser::ParseValue(Record *CurRec, RecTy *ItemType, IDParseMode Mode) {
1469 Init *Result = ParseSimpleValue(CurRec, ItemType, Mode);
1568 Init *RHSResult = ParseValue(CurRec, ItemType, ParseNameMode);
1583 StringRecTy::get())->Fold(CurRec, CurMultiClass);
1596 TGParser::ParseDagArgList(Record *CurRec) {
1607 Init *Val = ParseValue(CurRec);
1638 std::vector<Init*> TGParser::ParseValueList(Record *CurRec, Record *ArgsRec,
1658 Result.push_back(ParseValue(CurRec, ItemType));
1675 Result.push_back(ParseValue(CurRec, ItemType));
1686 /// CurRec will be non-null) and within the template args for a multiclass (in
1687 /// which case CurRec will be null, but CurMultiClass will be set). This can
1689 /// CurRec and CurMultiClass.
1693 Init *TGParser::ParseDeclaration(Record *CurRec,
1712 if (CurRec)
1713 DeclName = QualifyName(*CurRec, CurMultiClass, DeclName, ":");
1722 if (AddValue(CurRec, IdLoc, RecordVal(DeclName, Type, HasField)))
1729 Init *Val = ParseValue(CurRec, Type);
1731 SetValue(CurRec, ValLoc, DeclName, std::vector<unsigned>(), Val))
1821 /// sequence of template-declarations in <>'s. If CurRec is non-null, these are
1827 bool TGParser::ParseTemplateArgList(Record *CurRec) {
1831 Record *TheRecToAddTo = CurRec ? CurRec : &CurMultiClass->Rec;
1834 Init *TemplArg = ParseDeclaration(CurRec, true/*templateargs*/);
1844 TemplArg = ParseDeclaration(CurRec, true/*templateargs*/);
1861 bool TGParser::ParseBodyItem(Record *CurRec) {
1863 if (!ParseDeclaration(CurRec, false))
1889 RecordVal *Field = CurRec->getValue(FieldName);
1895 Init *Val = ParseValue(CurRec, Type);
1902 return SetValue(CurRec, IdLoc, FieldName, BitList, Val);
1912 bool TGParser::ParseBody(Record *CurRec) {
1925 if (ParseBodyItem(CurRec))
1933 /// \brief Apply the current let bindings to \a CurRec.
1935 bool TGParser::ApplyLetStack(Record *CurRec) {
1938 if (SetValue(CurRec, LR.Loc, LR.Name, LR.Bits, LR.Value))
1944 /// optional ClassList followed by a Body. CurRec is the current def or class
1952 bool TGParser::ParseObjectBody(Record *CurRec) {
1958 SubClassReference SubClass = ParseSubClassReference(CurRec, false);
1964 if (AddSubClass(CurRec, SubClass))
1969 SubClass = ParseSubClassReference(CurRec, false);
1973 if (ApplyLetStack(CurRec))
1976 return ParseBody(CurRec);
1997 Record *CurRec = CurRecOwner.get(); // Keep a copy since we may release.
2003 if (Records.getDef(CurRec->getNameInitAsString()))
2004 return Error(DefLoc, "def '" + CurRec->getNameInitAsString()+
2008 if (ParseObjectBody(CurRec))
2016 if (ParseObjectBody(CurRec))
2021 if (Proto->getNameInit() == CurRec->getNameInit())
2022 return Error(DefLoc, "def '" + CurRec->getNameInitAsString() +
2025 } else if (ParseObjectBody(CurRec)) {
2033 CurRec->resolveReferences();
2036 assert(CurRec->getTemplateArgs().empty() && "How'd this get template args?");
2043 CurRec->addValue(*RV);
2047 if (ProcessForeachDefs(CurRec, DefLoc))
2049 CurRec->getNameInitAsString());
2115 Record *CurRec = Records.getClass(Lex.getCurStrVal());
2116 if (CurRec) {
2118 if (CurRec->getValues().size() > 1 || // Account for NAME.
2119 !CurRec->getSuperClasses().empty() ||
2120 !CurRec->getTemplateArgs().empty())
2121 return TokError("Class '" + CurRec->getNameInitAsString() +
2127 CurRec = NewRec.get();
2134 if (ParseTemplateArgList(CurRec))
2138 return ParseObjectBody(CurRec);
2351 auto CurRec = make_unique<Record>(DefName, Locs, Records, IsAnonymous);
2356 AddSubClass(CurRec.get(), Ref);
2361 if (SetValue(CurRec.get(), Ref.RefRange.Start, "NAME",
2364 CurRec->getNameInitAsString() + ":NAME to '" +
2373 RecordVal *DefNameRV = CurRec->getValue("NAME");
2374 CurRec->resolveReferencesTo(DefNameRV);
2380 RecordVal *DefNameRV = CurRec->getValue("NAME");
2381 CurRec->resolveReferencesTo(DefNameRV);
2385 DefName = CurRec->getNameInit();
2391 ResolveMulticlassDefArgs(MC, CurRec.get(), DefmPrefixRange.Start,
2394 DefName = CurRec->getNameInit();
2403 PrintFatalError(CurRec->getLoc()[CurRec->getLoc().size() - 1],
2408 CurRec->setName(DefName);
2421 if (Records.getDef(CurRec->getNameInitAsString())) {
2422 Error(DefmPrefixRange.Start, "def '" + CurRec->getNameInitAsString() +
2428 Record *CurRecSave = CurRec.get(); // Keep a copy before we release.
2429 Records.addDef(std::move(CurRec));
2435 return CurRec.release();
2438 bool TGParser::ResolveMulticlassDefArgs(MultiClass &MC, Record *CurRec,
2449 if (SetValue(CurRec, DefmPrefixLoc, TArgs[i], std::vector<unsigned>(),
2454 CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
2458 CurRec->removeValue(TArgs[i]);
2460 } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
2471 Record *CurRec,
2475 if (ApplyLetStack(CurRec))
2484 if (Proto->getNameInit() == CurRec->getNameInit())
2485 return Error(DefmPrefixLoc, "defm '" + CurRec->getNameInitAsString() +
2487 CurMultiClass->DefPrototypes.push_back(std::unique_ptr<Record>(CurRec));
2493 CurRec->addValue(*RV);
2551 Record *CurRec = InstantiateMulticlassDef(*MC, DefProto.get(), DefmPrefix,
2555 if (!CurRec)
2559 if (ResolveMulticlassDefArgs(*MC, CurRec, DefmLoc, SubClassLoc,
2563 if (ResolveMulticlassDef(*MC, CurRec, DefProto.get(), DefmLoc))
2569 CurRec->resolveReferences();
2570 CurRec->setResolveFirst(false);
2572 NewRecDefs.push_back(CurRec);
2604 for (Record *CurRec : NewRecDefs) {
2606 if (AddSubClass(CurRec, SubClass))
2609 if (ApplyLetStack(CurRec))
2620 for (Record *CurRec : NewRecDefs)
2624 CurRec->resolveReferences();