21 #include "llvm/Config/llvm-config.h" 51 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 62 assert(RHS &&
"NULL pointer");
71 if (
const BitsRecTy *BitsTy = dyn_cast<BitsRecTy>(RHS))
72 return BitsTy->getNumBits() == 1;
77 static std::vector<BitsRecTy*> Shared;
78 if (Sz >= Shared.size())
79 Shared.resize(Sz + 1);
92 return cast<BitsRecTy>(RHS)->
Size ==
Size;
98 if (
const BitsRecTy *RHSb = dyn_cast<BitsRecTy>(RHS))
99 return RHSb->Size ==
Size;
123 return "list<" + Ty->getAsString() +
">";
127 if (
const auto *ListTy = dyn_cast<ListRecTy>(RHS))
133 if (
const ListRecTy *RHSl = dyn_cast<ListRecTy>(RHS))
134 return getElementType()->typeIsA(RHSl->getElementType());
150 if (UnsortedClasses.
empty()) {
156 UnsortedClasses[0]->getRecords().RecordTypePool;
159 UnsortedClasses.
end());
173 for (
unsigned i = 0; i < Classes.size(); ++i) {
174 for (
unsigned j = 0; j < Classes.size(); ++j) {
175 assert(i == j || !Classes[i]->isSubClassOf(Classes[j]));
177 assert(&Classes[0]->getRecords() == &Classes[i]->getRecords());
181 void *Mem = Allocator.
Allocate(totalSizeToAlloc<Record *>(Classes.size()),
184 std::uninitialized_copy(Classes.begin(), Classes.end(),
196 return getClasses()[0]->getNameInitAsString();
198 std::string Str =
"{";
200 for (
Record *R : getClasses()) {
204 Str += R->getNameInitAsString();
212 return MySuperClass == Class ||
226 return isSubClassOf(TargetClass);
240 while (!Stack.
empty()) {
258 if (
RecordRecTy *RecTy1 = dyn_cast<RecordRecTy>(T1)) {
259 if (
RecordRecTy *RecTy2 = dyn_cast<RecordRecTy>(T2))
268 if (
ListRecTy *ListTy1 = dyn_cast<ListRecTy>(T1)) {
269 if (
ListRecTy *ListTy2 = dyn_cast<ListRecTy>(T2)) {
271 ListTy2->getElementType());
284 void Init::anchor() {}
286 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 307 return V ? &True : &False;
311 if (isa<BitRecTy>(Ty))
312 return const_cast<BitInit *
>(
this);
314 if (isa<IntRecTy>(Ty))
317 if (
auto *BRT = dyn_cast<BitsRecTy>(Ty)) {
319 if (BRT->getNumBits() == 1)
330 for (
Init *
I : Range)
344 void *Mem = Allocator.
Allocate(totalSizeToAlloc<Init *>(Range.
size()),
347 std::uninitialized_copy(Range.
begin(), Range.
end(),
358 if (isa<BitRecTy>(Ty)) {
359 if (getNumBits() != 1)
return nullptr;
363 if (
auto *BRT = dyn_cast<BitsRecTy>(Ty)) {
366 if (getNumBits() != BRT->getNumBits())
return nullptr;
367 return const_cast<BitsInit *
>(
this);
370 if (isa<IntRecTy>(Ty)) {
372 for (
unsigned i = 0, e = getNumBits(); i != e; ++i)
373 if (
auto *
Bit = dyn_cast<BitInit>(getBit(i)))
374 Result |=
static_cast<int64_t
>(
Bit->getValue()) << i;
387 for (
unsigned i = 0, e = Bits.
size(); i != e; ++i) {
388 if (Bits[i] >= getNumBits())
390 NewBits[i] = getBit(Bits[i]);
396 for (
unsigned i = 0, e = getNumBits(); i != e; ++i) {
397 if (!getBit(i)->isConcrete())
404 std::string Result =
"{ ";
405 for (
unsigned i = 0, e = getNumBits(); i != e; ++i) {
406 if (i) Result +=
", ";
408 Result +=
Bit->getAsString();
412 return Result +
" }";
418 bool Changed =
false;
421 Init *CachedBitVarRef =
nullptr;
422 Init *CachedBitVarResolved =
nullptr;
424 for (
unsigned i = 0, e = getNumBits(); i != e; ++i) {
425 Init *CurBit = getBit(i);
426 Init *NewBit = CurBit;
428 if (
VarBitInit *CurBitVar = dyn_cast<VarBitInit>(CurBit)) {
429 if (CurBitVar->getBitVar() != CachedBitVarRef) {
430 CachedBitVarRef = CurBitVar->getBitVar();
434 NewBit = CachedBitVarResolved->
getBit(CurBitVar->getBitNum());
443 Changed |= CurBit != NewBit;
449 return const_cast<BitsInit *
>(
this);
466 return (NumBits >=
sizeof(Value) * 8) ||
467 (Value >> NumBits == 0) || (Value >> (NumBits-1) == -1);
471 if (isa<IntRecTy>(Ty))
472 return const_cast<IntInit *
>(
this);
474 if (isa<BitRecTy>(Ty)) {
475 int64_t Val = getValue();
476 if (Val != 0 && Val != 1)
return nullptr;
480 if (
auto *BRT = dyn_cast<BitsRecTy>(Ty)) {
481 int64_t
Value = getValue();
487 for (
unsigned i = 0; i != BRT->getNumBits(); ++i)
488 NewBits[i] =
BitInit::get(Value & ((i < 64) ? (1LL << i) : 0));
500 for (
unsigned i = 0, e = Bits.
size(); i != e; ++i) {
512 auto &Entry = *ThePool.
insert(std::make_pair(V,
nullptr)).first;
521 auto &Entry = *ThePool.
insert(std::make_pair(V,
nullptr)).first;
528 if (isa<StringRecTy>(Ty))
530 if (isa<CodeRecTy>(Ty))
537 if (isa<CodeRecTy>(Ty))
538 return const_cast<CodeInit *
>(
this);
539 if (isa<StringRecTy>(Ty))
551 for (
Init *
I : Range)
565 assert(Range.
empty() || !isa<TypedInit>(Range[0]) ||
566 cast<TypedInit>(Range[0])->getType()->typeIsConvertibleTo(EltTy));
568 void *Mem = Allocator.
Allocate(totalSizeToAlloc<Init *>(Range.
size()),
571 std::uninitialized_copy(Range.
begin(), Range.
end(),
578 RecTy *EltTy = cast<ListRecTy>(
getType())->getElementType();
587 if (
auto *LRT = dyn_cast<ListRecTy>(Ty)) {
593 bool Changed =
false;
594 RecTy *ElementType = LRT->getElementType();
595 for (
Init *
I : getValues())
596 if (
Init *CI =
I->convertInitializerTo(ElementType)) {
614 for (
unsigned Element : Elements) {
615 if (Element >=
size())
623 assert(i < NumValues &&
"List element index out of range!");
633 bool Changed =
false;
635 for (
Init *CurElt : getValues()) {
636 Init *
E = CurElt->resolveReferences(R);
637 Changed |= E != CurElt;
643 return const_cast<ListInit *
>(
this);
647 for (
Init *Element : *
this) {
655 std::string Result =
"[";
656 const char *sep =
"";
657 for (
Init *Element : *
this) {
667 return const_cast<OpInit*
>(
this);
700 if (isa<StringRecTy>(
getType())) {
701 if (
StringInit *LHSs = dyn_cast<StringInit>(LHS))
704 if (
DefInit *LHSd = dyn_cast<DefInit>(LHS))
707 if (
IntInit *LHSi = dyn_cast<IntInit>(LHS))
709 }
else if (isa<RecordRecTy>(
getType())) {
711 if (!CurRec && !IsFinal)
713 assert(CurRec &&
"NULL pointer");
727 Twine(
"Undefined reference to record: '") +
728 Name->getValue() +
"'\n");
736 Twine(
"Expected type '") +
737 getType()->getAsString() +
"', got '" +
750 if (
ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
751 assert(!LHSl->empty() &&
"Empty list in head");
752 return LHSl->getElement(0);
757 if (
ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
758 assert(!LHSl->empty() &&
"Empty list in tail");
761 return ListInit::get(LHSl->getValues().slice(1), LHSl->getElementType());
766 if (
ListInit *LHSl = dyn_cast<ListInit>(LHS))
771 if (
ListInit *LHSl = dyn_cast<ListInit>(LHS))
773 if (
StringInit *LHSs = dyn_cast<StringInit>(LHS))
777 return const_cast<UnOpInit *
>(
this);
786 return const_cast<UnOpInit *
>(
this);
792 case CAST: Result =
"!cast<" +
getType()->getAsString() +
">";
break;
793 case HEAD: Result =
"!head";
break;
794 case TAIL: Result =
"!tail";
break;
795 case SIZE: Result =
"!size";
break;
796 case EMPTY: Result =
"!empty";
break;
798 return Result +
"(" + LHS->getAsString() +
")";
839 if (
const StringInit *I0s = dyn_cast<StringInit>(I0))
840 if (
const StringInit *I1s = dyn_cast<StringInit>(I1))
855 if (LOp->
getDef() != ROp->getDef()) {
857 LHSs->
getAsString() +
"' vs. '" + RHSs->getAsString() +
862 for (
unsigned i = 0, e = LHSs->
getNumArgs(); i != e; ++i) {
866 for (
unsigned i = 0, e = RHSs->getNumArgs(); i != e; ++i) {
867 Args.push_back(RHSs->getArg(i));
880 Args.
insert(Args.
end(), RHSs->begin(), RHSs->end());
901 dyn_cast_or_null<IntInit>(LHS->convertInitializerTo(
IntRecTy::get()));
903 dyn_cast_or_null<IntInit>(RHS->convertInitializerTo(
IntRecTy::get()));
908 case EQ: Result = L->
getValue() == R->getValue();
break;
909 case NE: Result = L->
getValue() != R->getValue();
break;
910 case LE: Result = L->
getValue() <= R->getValue();
break;
911 case LT: Result = L->
getValue() < R->getValue();
break;
912 case GE: Result = L->
getValue() >= R->getValue();
break;
913 case GT: Result = L->
getValue() > R->getValue();
break;
939 dyn_cast_or_null<IntInit>(LHS->convertInitializerTo(
IntRecTy::get()));
941 dyn_cast_or_null<IntInit>(RHS->convertInitializerTo(
IntRecTy::get()));
943 int64_t LHSv = LHSi->
getValue(), RHSv = RHSi->getValue();
947 case ADD: Result = LHSv + RHSv;
break;
948 case AND: Result = LHSv & RHSv;
break;
949 case OR: Result = LHSv | RHSv;
break;
950 case SHL: Result = LHSv << RHSv;
break;
951 case SRA: Result = LHSv >> RHSv;
break;
952 case SRL: Result = (uint64_t)LHSv >> (uint64_t)RHSv;
break;
966 if (LHS != lhs || RHS != rhs)
975 case CONCAT: Result =
"!con";
break;
976 case ADD: Result =
"!add";
break;
977 case AND: Result =
"!and";
break;
978 case OR: Result =
"!or";
break;
979 case SHL: Result =
"!shl";
break;
980 case SRA: Result =
"!sra";
break;
981 case SRL: Result =
"!srl";
break;
982 case EQ: Result =
"!eq";
break;
983 case NE: Result =
"!ne";
break;
984 case LE: Result =
"!le";
break;
985 case LT: Result =
"!lt";
break;
986 case GE: Result =
"!ge";
break;
987 case GT: Result =
"!gt";
break;
988 case LISTCONCAT: Result =
"!listconcat";
break;
989 case STRCONCAT: Result =
"!strconcat";
break;
991 return Result +
"(" + LHS->getAsString() +
", " + RHS->getAsString() +
")";
1032 bool Change =
false;
1038 for (
unsigned int i = 0; i < MHSd->
getNumArgs(); ++i) {
1043 if (
DagInit *Argd = dyn_cast<DagInit>(Arg))
1048 NewArgs.
push_back(std::make_pair(NewArg, ArgName));
1061 if (
DagInit *MHSd = dyn_cast<DagInit>(MHS))
1064 if (
ListInit *MHSl = dyn_cast<ListInit>(MHS)) {
1067 for (
Init *&Item : NewList) {
1069 if (NewItem != Item)
1072 return ListInit::get(NewList, cast<ListRecTy>(Type)->getElementType());
1093 if (LHSd && MHSd && RHSd) {
1094 Record *Val = RHSd->getDef();
1096 Val = MHSd->getDef();
1099 if (LHSv && MHSv && RHSv) {
1100 std::string Val = RHSv->getName();
1101 if (LHSv->getAsString() == RHSv->getAsString())
1102 Val = MHSv->getName();
1105 if (LHSs && MHSs && RHSs) {
1106 std::string Val = RHSs->getValue();
1108 std::string::size_type found;
1109 std::string::size_type idx = 0;
1111 found = Val.find(LHSs->getValue(), idx);
1112 if (found == std::string::npos)
1114 Val.replace(found, LHSs->getValue().size(), MHSs->getValue());
1115 idx = found + MHSs->getValue().size();
1130 if (
IntInit *LHSi = dyn_cast_or_null<IntInit>(
1132 if (LHSi->getValue())
1142 bool MHSok = MHSl || isa<UnsetInit>(MHS);
1143 bool RHSok = RHSl || isa<UnsetInit>(RHS);
1145 if (isa<UnsetInit>(MHS) && isa<UnsetInit>(RHS))
1148 if (MHSok && RHSok && (!MHSl || !RHSl || MHSl->
size() == RHSl->size())) {
1150 unsigned Size = MHSl ? MHSl->
size() : RHSl->size();
1151 for (
unsigned i = 0; i !=
Size; ++i) {
1154 if (!isa<StringInit>(Name) && !isa<UnsetInit>(Name))
1156 Children.
emplace_back(Node, dyn_cast<StringInit>(Name));
1174 if (
Value->getValue())
1191 if (LHS != lhs || MHS != mhs || RHS != rhs)
1199 bool UnquotedLHS =
false;
1201 case SUBST: Result =
"!subst";
break;
1202 case FOREACH: Result =
"!foreach"; UnquotedLHS =
true;
break;
1203 case IF: Result =
"!if";
break;
1204 case DAG: Result =
"!dag";
break;
1206 return (Result +
"(" +
1207 (UnquotedLHS ? LHS->getAsUnquotedString() : LHS->getAsString()) +
1208 ", " + MHS->getAsString() +
", " + RHS->getAsString() +
")");
1244 Init *Accum = Start;
1245 for (
Init *Elt : *LI) {
1257 Init *NewStart = Start->resolveReferences(R);
1258 Init *NewList =
List->resolveReferences(R);
1264 if (Start == NewStart &&
List == NewList && Expr == NewExpr)
1267 return get(NewStart, NewList, A,
B, NewExpr,
getType())
1276 return (
Twine(
"!foldl(") + Start->getAsString() +
", " +
List->getAsString() +
1277 ", " + A->getAsUnquotedString() +
", " +
B->getAsUnquotedString() +
1278 ", " + Expr->getAsString() +
")")
1308 if (
TypedInit *TI = dyn_cast<TypedInit>(Expr)) {
1310 if (TI->getType()->typeIsConvertibleTo(
CheckType))
1317 if (!
CheckType->typeIsConvertibleTo(TI->getType()) || isa<DefInit>(Expr))
1329 if (Expr != NewExpr)
1340 Expr->getAsString() +
")")
1346 for (
Record *Rec : RecordType->getClasses()) {
1348 return Field->getType();
1359 if (isa<BitRecTy>(
getType()) && isa<BitsRecTy>(Ty) &&
1360 cast<BitsRecTy>(Ty)->getNumBits() == 1)
1368 if (!T)
return nullptr;
1373 for (
unsigned Bit : Bits) {
1387 if (
Init *Converted = convertInitializerTo(Ty)) {
1388 assert(!isa<TypedInit>(Converted) ||
1402 if (!T)
return nullptr;
1404 if (Elements.
size() == 1)
1409 for (
unsigned Element : Elements)
1422 using Key = std::pair<RecTy *, Init *>;
1425 Key TheKey(std::make_pair(T, VN));
1434 StringInit *NameString = cast<StringInit>(getNameInit());
1440 return const_cast<VarInit*
>(
this);
1447 return const_cast<VarInit *
>(
this);
1451 using Key = std::pair<TypedInit *, unsigned>;
1454 Key TheKey(std::make_pair(T, B));
1463 return TI->getAsString() +
"{" +
utostr(
Bit) +
"}";
1467 Init *
I = TI->resolveReferences(R);
1469 return I->
getBit(getBitNum());
1476 using Key = std::pair<TypedInit *, unsigned>;
1479 Key TheKey(std::make_pair(T, E));
1487 return TI->getAsString() +
"[" +
utostr(Element) +
"]";
1495 if (getElementNum() <
List->size())
1496 return List->getElement(getElementNum());
1498 if (NewTI != TI && isa<TypedInit>(NewTI))
1517 if (
auto *RRT = dyn_cast<RecordRecTy>(Ty))
1519 return const_cast<DefInit *
>(
this);
1525 return RV->getType();
1530 return Def->getName();
1539 for (
Init *
I : Args)
1553 void *Mem = Allocator.
Allocate(totalSizeToAlloc<Init *>(Args.
size()),
1556 std::uninitialized_copy(Args.
begin(), Args.
end(),
1566 DefInit *VarDefInit::instantiate() {
1570 Class->getLoc(), Records,
1572 Record *NewRec = NewRecOwner.get();
1575 for (
const RecordVal &Val : Class->getValues())
1582 for (
unsigned i = 0, e = TArgs.
size(); i != e; ++i) {
1583 if (i < args_size())
1584 R.
set(TArgs[i], getArg(i));
1586 R.
set(TArgs[i], NewRec->getValue(TArgs[i])->getValue());
1588 NewRec->removeValue(TArgs[i]);
1591 NewRec->resolveReferences(R);
1595 for (
const auto &SCPair : SCs)
1596 NewRec->addSuperClass(SCPair.first, SCPair.second);
1598 NewRec->addSuperClass(Class,
1599 SMRange(Class->getLoc().back(),
1600 Class->getLoc().back()));
1603 NewRec->resolveReferences();
1604 Records.
addDef(std::move(NewRecOwner));
1614 bool Changed =
false;
1619 Init *NewArg =
Arg->resolveReferences(UR);
1621 Changed |= NewArg !=
Arg;
1627 return New->instantiate();
1639 Arg->resolveReferences(R);
1642 return const_cast<VarDefInit *>(
this)->instantiate();
1647 std::string Result = Class->getNameInitAsString() +
"<";
1648 const char *sep =
"";
1652 Result +=
Arg->getAsString();
1654 return Result +
">";
1658 using Key = std::pair<Init *, StringInit *>;
1661 Key TheKey(std::make_pair(R, FN));
1682 if (
DefInit *DI = dyn_cast<DefInit>(Rec)) {
1686 Twine(
"Attempting to access field '") +
1687 FieldName->getAsUnquotedString() +
"' of '" +
1688 Rec->getAsString() +
"' is a forbidden self-reference");
1690 if (FieldVal->isComplete())
1701 "Number of conditions and values must match!");
1706 while (Case != CondRange.
end()) {
1715 makeArrayRef(getTrailingObjects<Init *>() + NumConds, NumConds),
1723 "Number of conditions and values must match!");
1730 if (
CondOpInit *
I = ThePool.FindNodeOrInsertPos(ID, IP))
1733 void *Mem = Allocator.
Allocate(totalSizeToAlloc<Init *>(2*CondRange.
size()),
1737 std::uninitialized_copy(CondRange.
begin(), CondRange.
end(),
1739 std::uninitialized_copy(ValRange.
begin(), ValRange.
end(),
1741 ThePool.InsertNode(I, IP);
1747 bool Changed =
false;
1748 for (
const Init *Case : getConds()) {
1751 Changed |= NewCase != Case;
1755 for (
const Init *Val : getVals()) {
1758 Changed |= NewVal != Val;
1769 for (
unsigned i = 0; i < NumConds; ++i) {
1770 Init *Cond = getCond(i);
1773 if (
IntInit *CondI = dyn_cast_or_null<IntInit>(
1775 if (CondI->getValue())
1783 " does not have any true condition in:" +
1789 for (
const Init *Case : getConds())
1790 if (!Case->isConcrete())
1793 for (
const Init *Val : getVals())
1794 if (!Val->isConcrete())
1801 for (
const Init *Case : getConds())
1802 if (!Case->isComplete())
1805 for (
const Init *Val : getVals())
1806 if (!Val->isConcrete())
1813 std::string Result =
"!cond(";
1814 for (
unsigned i = 0; i < getNumConds(); i++) {
1815 Result += getCond(i)->getAsString() +
": ";
1816 Result +=
getVal(i)->getAsString();
1817 if (i != getNumConds()-1)
1820 return Result +
")";
1835 while (Arg != ArgRange.
end()) {
1836 assert(Name != NameRange.
end() &&
"Arg name underflow!");
1840 assert(Name == NameRange.
end() &&
"Arg name overflow!");
1855 void *Mem = Allocator.
Allocate(totalSizeToAlloc<Init *, StringInit *>(ArgRange.
size(), NameRange.
size()),
alignof(
BitsInit));
1857 std::uninitialized_copy(ArgRange.
begin(), ArgRange.
end(),
1859 std::uninitialized_copy(NameRange.
begin(), NameRange.
end(),
1867 ArrayRef<std::pair<Init*, StringInit*>> args) {
1871 for (
const auto &
Arg : args) {
1886 bool ArgsChanged =
false;
1887 for (
const Init *
Arg : getArgs()) {
1888 Init *NewArg =
Arg->resolveReferences(R);
1890 ArgsChanged |= NewArg !=
Arg;
1893 Init *
Op = Val->resolveReferences(R);
1894 if (Op != Val || ArgsChanged)
1895 return DagInit::get(Op, ValName, NewArgs, getArgNames());
1897 return const_cast<DagInit *
>(
this);
1901 if (!Val->isConcrete())
1903 for (
const Init *Elt : getArgs()) {
1904 if (!Elt->isConcrete())
1911 std::string Result =
"(" + Val->getAsString();
1913 Result +=
":" + ValName->getAsUnquotedString();
1915 Result +=
" " + getArg(0)->getAsString();
1916 if (getArgName(0)) Result +=
":$" + getArgName(0)->getAsUnquotedString();
1917 for (
unsigned i = 1, e = getNumArgs(); i != e; ++i) {
1918 Result +=
", " + getArg(i)->getAsString();
1919 if (getArgName(i)) Result +=
":$" + getArgName(i)->getAsUnquotedString();
1922 return Result +
")";
1930 :
Name(N), TyAndPrefix(T, P) {
1932 assert(
Value &&
"Cannot create unset value for current type!");
1946 if (!isa<BitsInit>(
Value)) {
1948 Bits.
reserve(BTy->getNumBits());
1949 for (
unsigned i = 0, e = BTy->getNumBits(); i < e; ++i)
1955 return Value ==
nullptr;
1961 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 1972 if (PrintSem) OS <<
";\n";
1975 unsigned Record::LastID = 0;
1977 void Record::checkName() {
1979 const TypedInit *TypedName = cast<const TypedInit>(Name);
1980 if (!isa<StringRecTy>(TypedName->
getType()))
1982 "' is not a string!");
1987 getDirectSuperClasses(DirectSCs);
2015 while (!SCs.
empty()) {
2026 if (SkipVal == &
Value)
2030 if (
Value.setValue(VR)) {
2032 if (
TypedInit *VRT = dyn_cast<TypedInit>(VR))
2034 (
Twine(
"of type '") + VRT->getType()->getAsString() +
"' ").str();
2036 "is found when setting '" +
2037 Value.getNameInitAsString() +
2040 "' after resolving references: " +
2047 if (NewName != OldName) {
2056 resolveReferences(R);
2061 resolveReferences(R, RV);
2064 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 2072 if (!TArgs.
empty()) {
2074 bool NeedComma =
false;
2075 for (
const Init *
TA : TArgs) {
2076 if (NeedComma) OS <<
", ";
2079 assert(RV &&
"Template argument record not found??");
2080 RV->
print(OS,
false);
2089 for (
const auto &SuperPair : SC)
2090 OS <<
" " << SuperPair.first->getNameInitAsString();
2098 if (!Val.getPrefix() && !R.
isTemplateArg(Val.getNameInit()))
2108 "' does not have a field named `" + FieldName +
"'!\n");
2116 "' does not have a field named `" + FieldName +
"'!\n");
2119 return SI->getValue();
2121 return CI->getValue();
2124 FieldName +
"' does not have a string initializer!");
2131 "' does not have a field named `" + FieldName +
"'!\n");
2136 FieldName +
"' does not have a BitsInit initializer!");
2143 "' does not have a field named `" + FieldName +
"'!\n");
2148 FieldName +
"' does not have a list initializer!");
2151 std::vector<Record*>
2154 std::vector<Record*> Defs;
2156 if (
DefInit *DI = dyn_cast<DefInit>(
I))
2157 Defs.push_back(DI->getDef());
2160 FieldName +
"' list is not entirely DefInit!");
2169 "' does not have a field named `" + FieldName +
"'!\n");
2172 return II->getValue();
2175 "' does not have an int initializer: " +
2179 std::vector<int64_t>
2182 std::vector<int64_t> Ints;
2184 if (
IntInit *II = dyn_cast<IntInit>(
I))
2185 Ints.push_back(II->getValue());
2188 Twine(
"Record `") +
getName() +
"', field `" + FieldName +
2189 "' does not have a list of ints initializer: " +
2195 std::vector<StringRef>
2198 std::vector<StringRef> Strings;
2201 Strings.push_back(
SI->getValue());
2204 Twine(
"Record `") +
getName() +
"', field `" + FieldName +
2205 "' does not have a list of strings initializer: " +
2215 "' does not have a field named `" + FieldName +
"'!\n");
2218 return DI->getDef();
2220 FieldName +
"' does not have a def initializer!");
2227 "' does not have a field named `" + FieldName +
"'!\n");
2230 return BI->getValue();
2232 FieldName +
"' does not have a bit initializer!");
2239 "' does not have a field named `" + FieldName.
str() +
"'!\n");
2241 if (isa<UnsetInit>(R->
getValue())) {
2247 return BI->getValue();
2249 FieldName +
"' does not have a bit initializer!");
2256 "' does not have a field named `" + FieldName +
"'!\n");
2261 FieldName +
"' does not have a dag initializer!");
2264 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 2269 OS <<
"------------- Classes -----------------\n";
2271 OS <<
"class " << *
C.second;
2273 OS <<
"------------- Defs -----------------\n";
2275 OS <<
"def " << *D.second;
2285 std::vector<Record *>
2287 Record *Class = getClass(ClassName);
2289 PrintFatalError(
"ERROR: Couldn't find the `" + ClassName +
"' class!\n");
2291 std::vector<Record*> Defs;
2292 for (
const auto &D : getDefs())
2294 Defs.push_back(D.second.get());
2300 auto It = Map.find(VarName);
2301 if (It == Map.end())
2304 Init *
I = It->second.V;
2306 if (!It->second.Resolved && Map.size() > 1) {
2318 Init *Val = Cache.lookup(VarName);
2322 for (
Init *S : Stack) {
2328 if (!isa<UnsetInit>(RV->getValue())) {
2329 Val = RV->getValue();
2330 Stack.push_back(VarName);
2344 I = R->resolve(VarName);
2345 if (I && !FoundUnresolved) {
2351 FoundUnresolved |= Sub.FoundUnresolved;
2356 FoundUnresolved =
true;
2362 if (VarName == VarNameToTrack)
static BinOpInit * get(BinaryOp opc, Init *lhs, Init *rhs, RecTy *Type)
Represents a range in source code.
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
Init * convertInitializerTo(RecTy *Ty) const override
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
StringRef getName() const
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
RecTyKind
Subclass discriminator (for dyn_cast<> et al.)
void print(raw_ostream &OS) const
Init * getBit(unsigned Bit) const override
This method is used to return the initializer for the specified bit.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
StringRef getName() const
Record * getValueAsDef(StringRef FieldName) const
This method looks up the specified field and returns its value as a Record, throwing an exception if ...
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
BitsInit * getValueAsBitsInit(StringRef FieldName) const
This method looks up the specified field and returns its value as a BitsInit, throwing an exception i...
const T & back() const
back - Get the last element.
This class represents lattice values for constants.
X.Y - Represent a reference to a subfield of a variable.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const override
This method is used to implement the bitrange selection operator.
virtual std::string getAsUnquotedString() const
Convert this value to a string form, without adding quote markers.
Record * getCurrentRecord() const
bool foundUnresolved() const
[AL, AH, CL] - Represent a list of defs
'7' - Represent an initialization by a literal integer value.
static void ProfileFoldOpInit(FoldingSetNodeID &ID, Init *A, Init *B, Init *Start, Init *List, Init *Expr, RecTy *Type)
'list<Ty>' - Represent a list of values, all of which must be of the specified type.
void getDirectSuperClasses(SmallVectorImpl< Record *> &Classes) const
Append the direct super classes of this record to Classes.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
!op (X, Y) - Combine two inits.
Init * getBit(unsigned Bit) const override
This method is used to return the initializer for the specified bit.
bool typeIsA(const RecTy *RHS) const override
Return true if 'this' type is equal to or a subtype of RHS.
void Profile(FoldingSetNodeID &ID) const
DagInit * getValueAsDag(StringRef FieldName) const
This method looks up the specified field and returns its value as an Dag, throwing an exception if th...
std::string getAsString() const override
Convert this value to a string form.
Init * convertInitializerTo(RecTy *Ty) const override
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
void push_back(const T &Elt)
AL - Represent a reference to a 'def' in the description.
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit), or nullptr if the name could not be resolved.
Init * getBit(unsigned Bit) const override
This method is used to return the initializer for the specified bit.
T * FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos)
FindNodeOrInsertPos - Look up the node specified by ID.
static UnOpInit * get(UnaryOp opc, Init *lhs, RecTy *Type)
void addDef(std::unique_ptr< Record > R)
Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const override
This method is used to implement the bitrange selection operator.
RecTy * getFieldType(StringInit *FieldName) const override
This method is used to implement the FieldInit class.
Init * getCastTo(RecTy *Ty) const override
If this initializer is convertible to Ty, return an initializer whose type is-a Ty, generating a !cast operation if required.
Init * Fold(Record *CurRec, bool IsFinal=false) const
std::string getAsString() const override
Convert this value to a string form.
static Init * getStrConcat(Init *lhs, Init *rhs)
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
static VarInit * get(StringRef VN, RecTy *T)
ListInit * getValueAsListInit(StringRef FieldName) const
This method looks up the specified field and returns its value as a ListInit, throwing an exception i...
int64_t getValueAsInt(StringRef FieldName) const
This method looks up the specified field and returns its value as an int64_t, throwing an exception i...
Resolve all references to a specific RecordVal.
const_record_iterator classes_begin() const
static BumpPtrAllocator Allocator
void reserve(size_type N)
virtual Init * getCastTo(RecTy *Ty) const =0
If this initializer is convertible to Ty, return an initializer whose type is-a Ty, generating a !cast operation if required.
Resolve all variables from a record except for unset variables.
bool typeIsA(const RecTy *RHS) const override
Return true if 'this' type is equal to or a subtype of RHS.
'{ a, b, c }' - Represents an initializer for a BitsRecTy value.
Record * getElementAsRecord(unsigned i) const
std::string getAsString() const override
std::string getNameInitAsString() const
void dump() const
Debugging method that may be called through a debugger, just invokes print on stderr.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
static bool getVal(MDTuple *MD, const char *Key, uint64_t &Val)
static IntInit * get(int64_t V)
static BitsInit * get(ArrayRef< Init *> Range)
(Optionally) delegate resolving to a sub-resolver, and keep track whether there were unresolved refer...
bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const
This method looks up the specified field and returns its value as a bit.
Init * getArg(unsigned Num) const
ArrayRef< std::pair< Record *, SMRange > > getSuperClasses() const
'?' - Represents an uninitialized value
'true'/'false' - Represent a concrete initializer for a bit.
Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const override
This method is used to implement the bitrange selection operator.
static Init * ForeachApply(Init *LHS, Init *MHSe, Init *RHS, Record *CurRec)
static BitsRecTy * get(unsigned Sz)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This is the common super-class of types that have a specific, explicit, type.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
static RecordRecTy * resolveRecordTypes(RecordRecTy *T1, RecordRecTy *T2)
Shift and rotation operations.
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
void Profile(FoldingSetNodeID &ID) const
Init * getBit(unsigned Bit) const override
This method is used to return the initializer for the specified bit.
RecTy * getElementType() const
static StringRecTy * get()
void Profile(FoldingSetNodeID &ID) const
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
ArrayRef< Init * > getTemplateArgs() const
std::string getAsString() const override
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
std::string getAsString() const override
List[4] - Represent access to one element of a var or field.
'[classname]' - Type of record values that have zero or more superclasses.
Init * convertInitializerTo(RecTy *Ty) const override
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
std::string getAsString() const override
Convert this value to a string form.
std::vector< Record * > getValueAsListOfDefs(StringRef FieldName) const
This method looks up the specified field and returns its value as a vector of records, throwing an exception if the field does not exist or if the value is not the right type.
void AddInteger(signed I)
!foldl (a, b, expr, start, lst) - Fold over a list.
Init * getValueInit(StringRef FieldName) const
Return the initializer for a value with the specified name, or throw an exception if the field does n...
!cond(condition_1: value1, ...
void print(raw_ostream &OS, bool PrintSem=true) const
std::string getAsString() const override
Convert this value to a string form.
const_iterator end() const
virtual Init * resolve(Init *VarName)=0
Return the initializer for the given variable name (should normally be a StringInit), or nullptr if the name could not be resolved.
StringInit * getArgName(unsigned Num) const
void InsertNode(T *N, void *InsertPos)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
ArrayRef< SMLoc > getLoc() const
Type * getType() const
All values are typed, get the type of this value.
'bits<n>' - Represent a fixed number of bits
ArrayRef< Record * > getClasses() const
std::string itostr(int64_t X)
void Profile(FoldingSetNodeID &ID) const
bool isTemplateArg(Init *Name) const
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
Simple integer binary arithmetic operators.
bool isSubClassOf(const Record *R) const
ArrayRef< Init * > getValues() const
std::string getAsString() const override
Convert this value to a string form.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
unsigned getNumBits() const
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit), or nullptr if the name could not be resolved.
virtual Init * getBit(unsigned Bit) const =0
This method is used to return the initializer for the specified bit.
ArrayRef< RecordVal > getValues() const
const_record_iterator classes_end() const
Init * convertInitListSlice(ArrayRef< unsigned > Elements) const override
This method is used to implement the list slice selection operator.
'code' - Represent a code fragment
void resolveReferencesTo(const RecordVal *RV)
If anything in this record refers to RV, replace the reference to RV with the RHS of RV...
bool isSubClassOf(Record *Class) const
Init * convertInitializerTo(RecTy *Ty) const override
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
virtual Init * convertInitializerTo(RecTy *Ty) const =0
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
void addShadow(Init *Key)
Init * convertInitializerTo(RecTy *Ty) const override
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
void Profile(FoldingSetNodeID &ID) const
Base class for operators.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
Init * getElement(unsigned i) const
Resolve arbitrary mappings.
Init * getNameInit() const
The instances of the Type class are immutable: once they are created, they are never changed...
Allocate memory in an ever growing pool, as if by bump-pointer.
virtual bool isConcrete() const
Is this a concrete and fully resolved value without any references or stuck operations? Unset values are concrete.
void resolveReferences()
If there are any field references that refer to fields that have been filled in, we can propagate the...
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void set(Init *Key, Init *Value)
"foo" - Represent an initialization by a string value.
RecTy * getFieldType(StringInit *FieldName) const override
This method is used to implement the FieldInit class.
static void ProfileTernOpInit(FoldingSetNodeID &ID, unsigned Opcode, Init *LHS, Init *MHS, Init *RHS, RecTy *Type)
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
static void ProfileUnOpInit(FoldingSetNodeID &ID, unsigned Opcode, Init *Op, RecTy *Type)
static ManagedStatic< OptionRegistry > OR
const T * getTrailingObjects() const
Returns a pointer to the trailing object array of the given type (which must be one of those specifie...
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
!op (X) - Transform an init.
Init * getCastTo(RecTy *Ty) const override
If this initializer is convertible to Ty, return an initializer whose type is-a Ty, generating a !cast operation if required.
const std::string getNameInitAsString() const
static void ProfileDagInit(FoldingSetNodeID &ID, Init *V, StringInit *VN, ArrayRef< Init *> ArgRange, ArrayRef< StringInit *> NameRange)
static DagInit * get(Init *V, StringInit *VN, ArrayRef< Init *> ArgRange, ArrayRef< StringInit *> NameRange)
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
StringRef getValueAsString(StringRef FieldName) const
This method looks up the specified field and returns its value as a string, throwing an exception if ...
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
'string' - Represent an string value
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations? Unset values are concrete.
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
static BitInit * get(bool V)
static bool canFitInBitfield(int64_t Value, unsigned NumBits)
std::string getAsString() const override
Convert this value to a string form.
static CodeInit * get(StringRef)
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
static void ProfileBinOpInit(FoldingSetNodeID &ID, unsigned Opcode, Init *LHS, Init *RHS, RecTy *Type)
DefInit * getDefInit()
get the corresponding DefInit.
static wasm::ValType getType(const TargetRegisterClass *RC)
static Init * ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type, Record *CurRec)
FoldingSet - This template class is used to instantiate a specialized implementation of the folding s...
std::string getAsString() const override
Convert this value to a string form.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::vector< int64_t > getValueAsListOfInts(StringRef FieldName) const
This method looks up the specified field and returns its value as a vector of integers, throwing an exception if the field does not exist or if the value is not the right type.
static RecordRecTy * get(ArrayRef< Record *> Classes)
Get the record type with the given non-redundant list of superclasses.
void sort(IteratorTy Start, IteratorTy End)
Init * convertInitializerTo(RecTy *Ty) const override
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
std::vector< Record * > getAllDerivedDefinitions(StringRef ClassName) const
This method returns all concrete definitions that derive from the specified class name...
Delegate resolving to a sub-resolver, but shadow some variable names.
void setFinal(bool Final)
std::vector< StringRef > getValueAsListOfStrings(StringRef FieldName) const
This method looks up the specified field and returns its value as a vector of strings, throwing an exception if the field does not exist or if the value is not the right type.
static FieldInit * get(Init *R, StringInit *FN)
virtual Init * resolveReferences(Resolver &R) const
This method is used by classes that refer to other variables which may not be defined at the time the...
Init * Fold(Record *CurRec) const
std::string getAsString() const override
Init * convertInitListSlice(ArrayRef< unsigned > Elements) const override
This method is used to implement the list slice selection operator.
static StringInit * ConcatStringInits(const StringInit *I0, const StringInit *I1)
bool typeIsA(const RecTy *RHS) const override
Return true if 'this' type is equal to or a subtype of RHS.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
virtual bool typeIsA(const RecTy *RHS) const
Return true if 'this' type is equal to or a subtype of RHS.
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit), or nullptr if the name could not be resolved.
const RecordVal * getValue(const Init *Name) const
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
const RecordMap & getClasses() const
Init * getOperator() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static VarBitInit * get(TypedInit *T, unsigned B)
static StringInit * get(StringRef)
RecordKeeper & getRecords() const
std::string getAsString() const override
Convert this value to a string form.
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
CHAIN = SC CHAIN, Imm128 - System call.
Init * Fold(Record *CurRec) const
unsigned getNumArgs() const
Init * convertInitializerTo(RecTy *Ty) const override
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
std::string getAsString() const override
Convert this value to a string form.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
RecTy * getElementType() const
static DefInit * get(Record *)
ArrayRef< T > drop_back(size_t N=1) const
Drop the last N elements of the array.
classname<targs...> - Represent an uninstantiated anonymous class instantiation.
std::string utostr(uint64_t X, bool isNeg=false)
Init * convertInitializerTo(RecTy *Ty) const override
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
static VarDefInit * get(Record *Class, ArrayRef< Init *> Args)
Init * getBit(unsigned Bit) const override
This method is used to return the initializer for the specified bit.
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
static IsAOpInit * get(RecTy *CheckType, Init *Expr)
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit), or nullptr if the name could not be resolved.
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const Twine &Msg)
void Profile(FoldingSetNodeID &ID) const
void Profile(FoldingSetNodeID &ID) const
!isa<type>(expr) - Dynamically determine the type of an expression.
iterator insert(iterator I, T &&Elt)
static FoldOpInit * get(Init *Start, Init *List, Init *A, Init *B, Init *Expr, RecTy *Type)
static void ProfileIsAOpInit(FoldingSetNodeID &ID, RecTy *CheckType, Init *Expr)
'int' - Represent an integer value of no particular size
Init * getBit(unsigned Bit) const override
This method is used to return the initializer for the specified bit.
bool getValueAsBit(StringRef FieldName) const
This method looks up the specified field and returns its value as a bit, throwing an exception if the...
std::string getAsString() const override
Convert this value to a string form.
void Profile(FoldingSetNodeID &ID) const
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
Bitwise operators - logical and, logical or, logical xor.
Init * getNameInit() const
void emplace_back(ArgTypes &&... Args)
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations? Unset values are concrete.
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations? Unset values are concrete.
static Init * ForeachDagApply(Init *LHS, DagInit *MHSd, Init *RHS, Record *CurRec)
LLVM_NODISCARD bool empty() const
Init * Fold(Record *CurRec) const
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
void addValue(const RecordVal &RV)
static TernOpInit * get(TernaryOp opc, Init *lhs, Init *mhs, Init *rhs, RecTy *Type)
const_iterator begin() const
static VarListElementInit * get(TypedInit *T, unsigned E)
RecTy * resolveTypes(RecTy *T1, RecTy *T2)
Find a common type that T1 and T2 convert to.
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
static void ProfileVarDefInit(FoldingSetNodeID &ID, Record *Class, ArrayRef< Init *> Args)
void Profile(FoldingSetNodeID &ID) const
Opcode{0} - Represent access to one bit of a variable or field.
'Opcode' - Represent a reference to an entire variable object.
void Profile(FoldingSetNodeID &ID) const
std::string getAsString() const override
Convert this value to a string form.
static void ProfileCondOpInit(FoldingSetNodeID &ID, ArrayRef< Init *> CondRange, ArrayRef< Init *> ValRange, const RecTy *ValType)
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
std::string getAsString() const override
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
'bit' - Represent a single bit
!op (X, Y, Z) - Combine two inits.
static void ProfileBitsInit(FoldingSetNodeID &ID, ArrayRef< Init *> Range)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
Init * Fold(Record *CurRec) const
static ListInit * get(ArrayRef< Init *> Range, RecTy *EltTy)
virtual bool keepUnsetBits() const
RecTyKind getRecTyKind() const
virtual bool typeIsConvertibleTo(const RecTy *RHS) const
Return true if all values of 'this' type can be converted to the specified type.
StringRef getValue() const
'dag' - Represent a dag fragment
Record * getDef(StringRef Name) const
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckType(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI, const DataLayout &DL)
StringRef getName() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Init * getBit(unsigned Bit) const override
This method is used to return the initializer for the specified bit.
LLVM Value Representation.
(v a, b) - Represent a DAG tree value.
virtual std::string getAsString() const =0
Convert this value to a string form.
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations? Unset values are concrete.
static void ProfileListInit(FoldingSetNodeID &ID, ArrayRef< Init *> Range, RecTy *EltTy)
This class implements an extremely fast bulk output stream that can only output to a stream...
static CondOpInit * get(ArrayRef< Init *> C, ArrayRef< Init *> V, RecTy *Type)
StringRef - Represent a constant reference to a string, i.e.
void Profile(FoldingSetNodeID &ID) const
static void ProfileRecordRecTy(FoldingSetNodeID &ID, ArrayRef< Record *> Classes)
std::string getAsString() const override
Convert this value to a string form.
bool isComplete() const override
This virtual method should be overridden by values that may not be completely specified yet...
virtual std::string getAsString() const =0
Init * convertInitializerTo(RecTy *Ty) const override
Convert to an initializer whose type is-a Ty, or return nullptr if this is not possible (this can hap...
ListRecTy * getListTy()
Returns the type representing list<this>.
Init * getNewAnonymousName()
GetNewAnonymousName - Generate a unique anonymous name that can be used as an identifier.
for(unsigned i=Desc.getNumOperands(), e=OldMI.getNumOperands();i !=e;++i)
const RecordMap & getDefs() const
std::string getAsString() const override
Convert this value to a string form.
Init * Fold(Record *CurRec) const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
std::string getAsString() const override
Convert this value to a string form.
bool empty() const
empty - Check if the array is empty.
RecordVal(Init *N, RecTy *T, bool P)