22 #include "llvm/Support/DataTypes.h"
48 const std::string &
str()
const {
return data; }
74 return LHS.
str() == RHS.
str();
89 void RecTy::anchor() { }
99 assert (RHS &&
"NULL pointer");
110 if (Val != 0 && Val != 1)
return 0;
117 if (isa<BitRecTy>(Ty) || isa<BitsRecTy>(Ty) || isa<IntRecTy>(Ty))
125 if(
const BitsRecTy *BitsTy = dyn_cast<BitsRecTy>(RHS))
126 return BitsTy->getNumBits() == 1;
131 static std::vector<BitsRecTy*> Shared;
132 if (Sz >= Shared.size())
133 Shared.resize(Sz + 1);
141 return "bits<" +
utostr(Size) +
">";
147 for (
unsigned i = 0; i != Size; ++i)
154 if (Size != 1)
return 0;
162 return (NumBits >=
sizeof(Value) * 8) ||
163 (Value >> NumBits == 0) || (Value >> (NumBits-1) == -1);
177 for (
unsigned i = 0; i != Size; ++i)
191 if (Size == 1 && isa<BitRecTy>(VI->
getType()))
197 for (
unsigned i = 0; i != Size; ++i)
207 return cast<BitsRecTy>(RHS)->Size == Size;
218 for (
unsigned i = 0, e = BI->
getNumBits(); i != e; ++i)
220 Result |=
Bit->getValue() << i;
241 if (L == 0)
return 0;
254 if (L == 0 || R == 0)
return 0;
265 if (isa<StringRecTy>(TI->
getType()))
275 std::vector<Init*> Elements;
279 for (
unsigned i = 0, e = LI->
getSize(); i != e; ++i)
281 Elements.push_back(CI);
285 if (!isa<ListRecTy>(LI->
getType()))
300 if(
const ListRecTy* ListTy = dyn_cast<ListRecTy>(RHS))
301 return ListTy->getElementType()->typeIsConvertibleTo(Ty);
314 if (L == 0)
return 0;
326 if (L == 0 || R == 0)
return 0;
352 if (RRT->getRecord()->isSubClassOf(
getRecord()) ||
367 for (
unsigned i = 0, e = SC.size(); i != e; ++i)
384 if (
RecordRecTy *RecTy1 = dyn_cast<RecordRecTy>(T1)) {
386 const std::vector<Record *> &T1SuperClasses =
387 RecTy1->getRecord()->getSuperClasses();
388 for(std::vector<Record *>::const_iterator i = T1SuperClasses.begin(),
389 iend = T1SuperClasses.end();
395 if (NewType1 != SuperRecTy1) {
402 if (
RecordRecTy *RecTy2 = dyn_cast<RecordRecTy>(T2)) {
404 const std::vector<Record *> &T2SuperClasses =
405 RecTy2->getRecord()->getSuperClasses();
406 for (std::vector<Record *>::const_iterator i = T2SuperClasses.begin(),
407 iend = T2SuperClasses.end();
413 if (NewType2 != SuperRecTy2) {
428 void Init::anchor() { }
431 void UnsetInit::anchor() { }
438 void BitInit::anchor() { }
444 return V ? &True : &False;
466 if (
BitsInit *
I = ThePool.FindNodeOrInsertPos(ID, IP))
470 ThePool.InsertNode(I, IP);
483 for (
unsigned i = 0, e = Bits.size(); i != e; ++i) {
486 NewBits[i] =
getBit(Bits[i]);
492 std::string Result =
"{ ";
493 for (
unsigned i = 0, e =
getNumBits(); i != e; ++i) {
494 if (i) Result +=
", ";
496 Result +=
Bit->getAsString();
500 return Result +
" }";
516 bool Changed =
false;
519 Init *CachedInit = 0;
520 Init *CachedBitVar = 0;
521 bool CachedBitVarChanged =
false;
523 for (
unsigned i = 0, e =
getNumBits(); i != e; ++i) {
524 Init *CurBit = Bits[i];
529 if (CurBitVar == CachedBitVar) {
530 if (CachedBitVarChanged) {
536 CachedBitVar = CurBitVar;
537 CachedBitVarChanged =
false;
543 CachedBitVarChanged |= B != CurBitVar;
544 Changed |= B != CurBitVar;
545 }
while (B != CurBitVar);
546 CachedInit = CurBitVar;
548 if (CachedBitVarChanged) {
557 return const_cast<BitsInit *
>(
this);
562 class Pool :
public T {
568 for (
typename T::iterator
I = this->
begin(), E = this->
end();
I != E; ++
I) {
569 typename T::value_type &Item = *
I;
576 static Pool<DenseMap<int64_t, IntInit *> > ThePool;
591 for (
unsigned i = 0, e = Bits.size(); i != e; ++i) {
600 void StringInit::anchor() { }
603 static Pool<StringMap<StringInit *> > ThePool;
633 if (
ListInit *
I = ThePool.FindNodeOrInsertPos(ID, IP))
637 ThePool.InsertNode(I, IP);
643 assert(ListType &&
"Bad type for ListInit!");
651 std::vector<Init*> Vals;
652 for (
unsigned i = 0, e = Elements.size(); i != e; ++i) {
661 assert(i < Values.size() &&
"List element index out of range!");
669 std::vector<Init*> Resolved;
671 bool Changed =
false;
673 for (
unsigned i = 0, e =
getSize(); i != e; ++i) {
680 Changed |= E != CurElt;
681 }
while (E != CurElt);
682 Resolved.push_back(E);
687 return const_cast<ListInit *
>(
this);
691 unsigned Elt)
const {
698 if (IRV || !isa<UnsetInit>(E))
704 std::string Result =
"[";
705 for (
unsigned i = 0, e = Values.size(); i != e; ++i) {
706 if (i) Result +=
", ";
707 Result += Values[i]->getAsString();
713 unsigned Elt)
const {
717 Resolved = OResolved->
Fold(&R, 0);
720 if (Resolved !=
this) {
722 assert(Typed &&
"Expected typed init for list reference");
736 return const_cast<OpInit*
>(
this);
741 typedef std::pair<std::pair<unsigned, Init *>,
RecTy *> Key;
742 static Pool<DenseMap<Key, UnOpInit *> > ThePool;
744 Key TheKey(std::make_pair(std::make_pair(opc, lhs), Type));
747 if (!I) I =
new UnOpInit(opc, lhs, Type);
755 if (
StringInit *LHSs = dyn_cast<StringInit>(LHS))
758 if (
DefInit *LHSd = dyn_cast<DefInit>(LHS))
761 if (
IntInit *LHSi = dyn_cast<IntInit>(LHS))
764 if (
StringInit *LHSs = dyn_cast<StringInit>(LHS)) {
765 std::string
Name = LHSs->getValue();
770 if (RV->getType() !=
getType())
780 assert(RV &&
"Template arg doesn't exist??");
794 assert(RV &&
"Template arg doesn't exist??");
807 "Undefined reference:'" + Name +
"'\n");
813 if (
ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
814 if (LHSl->getSize() == 0) {
815 assert(0 &&
"Empty list in car");
818 return LHSl->getElement(0);
823 if (
ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
824 if (LHSl->getSize() == 0) {
825 assert(0 &&
"Empty list in cdr");
840 if (
ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
841 if (LHSl->getSize() == 0) {
847 if (
StringInit *LHSs = dyn_cast<StringInit>(LHS)) {
848 if (LHSs->getValue().empty()) {
858 return const_cast<UnOpInit *
>(
this);
873 case HEAD: Result =
"!head";
break;
874 case TAIL: Result =
"!tail";
break;
875 case EMPTY: Result =
"!empty";
break;
883 std::pair<std::pair<unsigned, Init *>,
Init *>,
887 static Pool<DenseMap<Key, BinOpInit *> > ThePool;
889 Key TheKey(std::make_pair(std::make_pair(std::make_pair(opc, lhs), rhs),
893 if (!I) I =
new BinOpInit(opc, lhs, rhs, Type);
905 if (LOp == 0 || ROp == 0 || LOp->
getDef() != ROp->getDef())
907 std::vector<Init*> Args;
908 std::vector<std::string> ArgNames;
909 for (
unsigned i = 0, e = LHSs->
getNumArgs(); i != e; ++i) {
910 Args.push_back(LHSs->
getArg(i));
913 for (
unsigned i = 0, e = RHSs->getNumArgs(); i != e; ++i) {
914 Args.push_back(RHSs->getArg(i));
915 ArgNames.push_back(RHSs->getArgName(i));
944 return IntInit::get(LHSs->getValue() == RHSs->getValue());
955 int64_t LHSv = LHSi->
getValue(), RHSv = RHSi->getValue();
959 case ADD: Result = LHSv + RHSv;
break;
960 case SHL: Result = LHSv << RHSv;
break;
961 case SRA: Result = LHSv >> RHSv;
break;
962 case SRL: Result = (uint64_t)LHSv >> (uint64_t)RHSv;
break;
976 if (LHS != lhs || RHS != rhs)
984 case CONCAT: Result =
"!con";
break;
985 case ADD: Result =
"!add";
break;
986 case SHL: Result =
"!shl";
break;
987 case SRA: Result =
"!sra";
break;
988 case SRL: Result =
"!srl";
break;
989 case EQ: Result =
"!eq";
break;
990 case STRCONCAT: Result =
"!strconcat";
break;
1000 std::pair<std::pair<unsigned, RecTy *>,
Init *>,
1007 static Pool ThePool;
1009 Key TheKey(std::make_pair(std::make_pair(std::make_pair(std::make_pair(opc,
1016 if (!I) I =
new TernOpInit(opc, lhs, mhs, rhs, Type);
1026 std::vector<Init *> NewOperands;
1033 CurRec, CurMultiClass);
1046 Type, CurRec, CurMultiClass);
1048 NewOperands.push_back(Result);
1050 NewOperands.push_back(Arg);
1053 NewOperands.push_back(Arg);
1061 Init *NewVal = NewOp->
Fold(CurRec, CurMultiClass);
1062 if (NewVal != NewOp)
1084 if ((MHSd && isa<DagRecTy>(Type)) || (MHSl && isa<ListRecTy>(
Type))) {
1088 Type, CurRec, CurMultiClass);
1093 std::vector<std::pair<Init *, std::string> > args;
1094 for (
unsigned int i = 0; i < MHSd->
getNumArgs(); ++i) {
1096 std::string ArgName;
1102 CurRec, CurMultiClass);
1108 args.push_back(std::make_pair(Arg, ArgName));
1114 std::vector<Init *> NewOperands;
1115 std::vector<Init *> NewList(MHSl->begin(), MHSl->end());
1117 for (std::vector<Init *>::iterator li = NewList.begin(),
1118 liend = NewList.end();
1122 NewOperands.clear();
1123 for(
int i = 0; i < RHSo->getNumOperands(); ++i) {
1125 if (LHS->
getAsString() == RHSo->getOperand(i)->getAsString()) {
1126 NewOperands.push_back(Item);
1128 NewOperands.push_back(RHSo->getOperand(i));
1134 Init *NewItem = NewOp->
Fold(CurRec, CurMultiClass);
1135 if (NewItem != NewOp)
1159 if ((LHSd && MHSd && RHSd)
1160 || (LHSv && MHSv && RHSv)
1161 || (LHSs && MHSs && RHSs)) {
1163 Record *Val = RHSd->getDef();
1165 Val = MHSd->getDef();
1170 std::string Val = RHSv->getName();
1171 if (LHSv->getAsString() == RHSv->getAsString()) {
1172 Val = MHSv->getName();
1177 std::string Val = RHSs->getValue();
1179 std::string::size_type found;
1180 std::string::size_type idx = 0;
1182 found = Val.find(LHSs->getValue(), idx);
1183 if (found != std::string::npos) {
1184 Val.replace(found, LHSs->getValue().size(), MHSs->getValue());
1186 idx = found + MHSs->getValue().size();
1187 }
while (found != std::string::npos);
1197 CurRec, CurMultiClass);
1207 LHSi = dyn_cast<IntInit>(
I);
1226 if (Opc ==
IF && lhs != LHS) {
1229 Value = dyn_cast<IntInit>(
I);
1235 RHS,
getType()))->Fold(&R, 0);
1239 rhs,
getType()))->Fold(&R, 0);
1247 if (LHS != lhs || MHS != mhs || RHS != rhs)
1256 case SUBST: Result =
"!subst";
break;
1257 case FOREACH: Result =
"!foreach";
break;
1258 case IF: Result =
"!if";
break;
1266 if (
RecordVal *
Field = RecordType->getRecord()->getValue(FieldName))
1267 return Field->getType();
1274 if (T == 0)
return 0;
1278 for (
unsigned i = 0, e = Bits.size(); i != e; ++i) {
1279 if (Bits[i] >= NumBits)
1290 if (T == 0)
return 0;
1292 if (Elements.size() == 1)
1295 std::vector<Init*> ListInits;
1296 ListInits.reserve(Elements.size());
1297 for (
unsigned i = 0, e = Elements.size(); i != e; ++i)
1310 typedef std::pair<RecTy *, Init *> Key;
1311 static Pool<DenseMap<Key, VarInit *> > ThePool;
1313 Key TheKey(std::make_pair(T, VN));
1316 if (!I) I =
new VarInit(VN, T);
1322 assert(NameString &&
"VarInit name is not a string!");
1328 return const_cast<VarInit*
>(
this);
1334 unsigned Elt)
const {
1339 assert(RV &&
"Reference to a non-existent variable?");
1343 assert(VI &&
"Invalid list element!");
1353 if (IRV || !isa<UnsetInit>(E))
1362 return RV->getType();
1367 const std::string &FieldName)
const {
1368 if (isa<RecordRecTy>(
getType()))
1370 if (RV != Val && (RV || isa<UnsetInit>(Val->getValue())))
1372 Init *TheInit = Val->getValue();
1373 assert(TheInit !=
this &&
"Infinite loop detected!");
1389 if (RV == Val || (RV == 0 && !isa<UnsetInit>(Val->getValue())))
1390 return Val->getValue();
1391 return const_cast<VarInit *
>(
this);
1395 typedef std::pair<TypedInit *, unsigned> Key;
1398 static Pool ThePool;
1400 Key TheKey(std::make_pair(T, B));
1421 typedef std::pair<TypedInit *, unsigned> Key;
1424 static Pool ThePool;
1426 Key TheKey(std::make_pair(T, E));
1453 unsigned Elt)
const {
1457 if (
TypedInit *TInit = dyn_cast<TypedInit>(Result)) {
1458 Init *Result2 = TInit->resolveListElementReference(R, RV, Elt);
1459 if (Result2)
return Result2;
1474 return RV->getType();
1479 const std::string &FieldName)
const {
1489 typedef std::pair<Init *, TableGenStringKey> Key;
1491 static Pool ThePool;
1493 Key TheKey(std::make_pair(R, FN));
1507 unsigned Elt)
const {
1509 if (
ListInit *
LI = dyn_cast<ListInit>(ListVal)) {
1510 if (Elt >=
LI->getSize())
return 0;
1511 Init *E =
LI->getElement(Elt);
1516 if (RV || !isa<UnsetInit>(E))
1531 if (NewRec != Rec) {
1545 while (Arg != ArgRange.
end()) {
1546 assert(Name != NameRange.
end() &&
"Arg name underflow!");
1550 assert(Name == NameRange.
end() &&
"Arg name overflow!");
1558 static Pool ThePool;
1564 if (
DagInit *
I = ThePool.FindNodeOrInsertPos(ID, IP))
1568 ThePool.InsertNode(I, IP);
1575 const std::vector<std::pair<Init*, std::string> > &args) {
1576 typedef std::pair<Init*, std::string> PairType;
1578 std::vector<Init *> Args;
1579 std::vector<std::string> Names;
1581 for (std::vector<PairType>::const_iterator i = args.begin(),
1585 Args.push_back(i->first);
1586 Names.push_back(i->second);
1597 std::vector<Init*> NewArgs;
1598 for (
unsigned i = 0, e = Args.size(); i != e; ++i)
1599 NewArgs.push_back(Args[i]->resolveReferences(R, RV));
1603 if (Args != NewArgs || Op != Val)
1606 return const_cast<DagInit *
>(
this);
1612 if (!ValName.empty())
1613 Result +=
":" + ValName;
1615 Result +=
" " + Args[0]->getAsString();
1616 if (!ArgNames[0].empty()) Result +=
":$" + ArgNames[0];
1617 for (
unsigned i = 1, e = Args.size(); i != e; ++i) {
1618 Result +=
", " + Args[i]->getAsString();
1619 if (!ArgNames[i].empty()) Result +=
":$" + ArgNames[i];
1622 return Result +
")";
1633 assert(
Value &&
"Cannot create unset value for current type!");
1639 assert(
Value &&
"Cannot create unset value for current type!");
1644 assert(NameString &&
"RecordVal name is not a string!");
1657 if (PrintSem) OS <<
";\n";
1660 unsigned Record::LastID = 0;
1662 void Record::init() {
1671 void Record::checkName() {
1674 assert(TypedName &&
"Record name is not typed!");
1676 if (!isa<StringRecTy>(Type))
1688 assert(NameString &&
"Record name is not a string!");
1695 TrackedRecords.
addDef(
this);
1723 for (
unsigned i = 0, e = Values.size(); i != e; ++i) {
1724 if (RV == &Values[i])
1727 if (Values[i].setValue(V->resolveReferences(*
this, RV)))
1730 +
"' after resolving references"
1739 if (NewName != OldName) {
1751 if (!TArgs.empty()) {
1753 for (
unsigned i = 0, e = TArgs.size(); i != e; ++i) {
1756 assert(RV &&
"Template argument record not found??");
1757 RV->
print(OS,
false);
1766 for (
unsigned i = 0, e = SC.size(); i != e; ++i)
1767 OS <<
" " << SC[i]->getNameInitAsString();
1771 const std::vector<RecordVal> &Vals = R.
getValues();
1772 for (
unsigned i = 0, e = Vals.size(); i != e; ++i)
1775 for (
unsigned i = 0, e = Vals.size(); i != e; ++i)
1789 "' does not have a field named `" + FieldName.
str() +
"'!\n");
1802 "' does not have a field named `" + FieldName.
str() +
"'!\n");
1805 return SI->getValue();
1807 FieldName.
str() +
"' does not have a string initializer!");
1818 "' does not have a field named `" + FieldName.
str() +
"'!\n");
1823 FieldName.
str() +
"' does not have a BitsInit initializer!");
1834 "' does not have a field named `" + FieldName.
str() +
"'!\n");
1839 FieldName.
str() +
"' does not have a list initializer!");
1846 std::vector<Record*>
1849 std::vector<Record*> Defs;
1850 for (
unsigned i = 0; i < List->
getSize(); i++) {
1852 Defs.push_back(DI->getDef());
1855 FieldName.
str() +
"' list is not entirely DefInit!");
1869 "' does not have a field named `" + FieldName.
str() +
"'!\n");
1872 return II->getValue();
1874 FieldName.
str() +
"' does not have an int initializer!");
1881 std::vector<int64_t>
1884 std::vector<int64_t> Ints;
1885 for (
unsigned i = 0; i < List->
getSize(); i++) {
1887 Ints.push_back(II->getValue());
1890 FieldName.
str() +
"' does not have a list of ints initializer!");
1900 std::vector<std::string>
1903 std::vector<std::string> Strings;
1904 for (
unsigned i = 0; i < List->
getSize(); i++) {
1906 Strings.push_back(II->getValue());
1909 FieldName.
str() +
"' does not have a list of strings initializer!");
1923 "' does not have a field named `" + FieldName.
str() +
"'!\n");
1926 return DI->getDef();
1928 FieldName.
str() +
"' does not have a def initializer!");
1939 "' does not have a field named `" + FieldName.
str() +
"'!\n");
1942 return BI->getValue();
1944 FieldName.
str() +
"' does not have a bit initializer!");
1951 "' does not have a field named `" + FieldName.
str() +
"'!\n");
1959 return BI->getValue();
1961 FieldName.
str() +
"' does not have a bit initializer!");
1972 "' does not have a field named `" + FieldName.
str() +
"'!\n");
1977 FieldName.
str() +
"' does not have a dag initializer!");
1982 errs() <<
"Record:\n";
1985 errs() <<
"Defs:\n";
1986 for (RecordVector::const_iterator r =
DefPrototypes.begin(),
1998 OS <<
"------------- Classes -----------------\n";
1999 const std::map<std::string, Record*> &Classes = RK.
getClasses();
2000 for (std::map<std::string, Record*>::const_iterator
I = Classes.begin(),
2001 E = Classes.end();
I != E; ++
I)
2002 OS <<
"class " << *
I->second;
2004 OS <<
"------------- Defs -----------------\n";
2005 const std::map<std::string, Record*> &Defs = RK.
getDefs();
2006 for (std::map<std::string, Record*>::const_iterator
I = Defs.begin(),
2007 E = Defs.end();
I != E; ++
I)
2008 OS <<
"def " << *
I->second;
2016 std::vector<Record*>
2020 PrintFatalError(
"ERROR: Couldn't find the `" + ClassName +
"' class!\n");
2022 std::vector<Record*> Defs;
2023 for (std::map<std::string, Record*>::const_iterator
I =
getDefs().
begin(),
2025 if (
I->second->isSubClassOf(Class))
2026 Defs.push_back(
I->second);
2034 Init *
Name,
const std::string &Scoper) {
2042 Type)->Fold(&CurRec, CurMultiClass),
2046 if (CurMultiClass && Scoper !=
"::") {
2052 Type)->Fold(&CurRec, CurMultiClass),
2053 NewName->
Fold(&CurRec, CurMultiClass),
2057 return NewName->
Fold(&CurRec, CurMultiClass);
2063 const std::string &
Name,
2064 const std::string &Scoper) {
static BinOpInit * get(BinaryOp opc, Init *lhs, Init *rhs, RecTy *Type)
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
void AddPointer(const void *Ptr)
void print(raw_ostream &OS) const
COFF::RelocationTypeX86 Type
const_iterator end(StringRef path)
Get end iterator over path.
RecTyKind
Subclass discriminator (for dyn_cast<> et al.)
virtual bool isComplete() const
const std::string & getValue() const
void Profile(FoldingSetNodeID &ID) const
unsigned getNumBits() const
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
unsigned getNumArgs() const
virtual Init * getOperand(int i) const
bool getValueAsBit(StringRef FieldName) const
const std::string & getArgName(unsigned Num) const
virtual Init * getBit(unsigned Bit) const
friend hash_code hash_value(const TableGenStringKey &Value)
virtual Init * getBit(unsigned Bit) const
Record * getElementAsRecord(unsigned i) const
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
virtual RecTy * getFieldType(const std::string &FieldName) const
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
std::string getNameInitAsString() const
static UnOpInit * get(UnaryOp opc, Init *lhs, RecTy *Type)
Init * getValueInit(StringRef FieldName) const
const std::string & str() const
const std::vector< Init * > & getTemplateArgs() const
virtual bool baseClassOf(const RecTy *) const
virtual Init * getFieldInit(Record &R, const RecordVal *RV, const std::string &FieldName) const
std::string str() const
str - Get the contents as an std::string.
void Profile(FoldingSetNodeID &ID) const
const_iterator begin(StringRef path)
Get begin iterator over path.
virtual Init * Fold(Record *CurRec, MultiClass *CurMultiClass) const
BinaryOp getOpcode() const
Record * getValueAsDef(StringRef FieldName) const
Init * getElement(unsigned i) const
virtual Init * Fold(Record *CurRec, MultiClass *CurMultiClass) const
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
static TableGenStringKey getEmptyKey()
virtual Init * resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) const
virtual RecTy * getFieldType(const std::string &FieldName) const
std::string getValueAsString(StringRef FieldName) const
Init * getOperator() const
virtual std::string getAsUnquotedString() const
LoopInfoBase< BlockT, LoopT > * LI
void print(raw_ostream &OS) const
print - Print out this value.
const std::string & getName() const
static IntInit * get(int64_t V)
virtual Init * convertValue(UnsetInit *UI)
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
virtual int getNumOperands() const =0
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
static BitsRecTy * get(unsigned Sz)
virtual Init * resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) const =0
static void ProfileBitsInit(FoldingSetNodeID &ID, ArrayRef< Init * > Range)
#define llvm_unreachable(msg)
static StringRecTy * get()
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
void AddInteger(signed I)
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
Record * getClass(const std::string &Name) const
static Init * ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type, Record *CurRec, MultiClass *CurMultiClass)
virtual bool baseClassOf(const RecTy *) const
ID
LLVM Calling Convention Representation.
void print(raw_ostream &OS, bool PrintSem=true) const
const std::map< std::string, Record * > & getClasses() const
BitsInit * getValueAsBitsInit(StringRef FieldName) const
RecordVal(Init *N, RecTy *T, unsigned P)
virtual Init * convertValue(UnsetInit *UI)
ListInit * getValueAsListInit(StringRef FieldName) const
virtual OpInit * clone(std::vector< Init * > &Operands) const =0
const std::string getNameInitAsString() const
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
Init * getArg(unsigned Num) const
void Profile(FoldingSetNodeID &ID) const
static std::string utostr(uint64_t X, bool isNeg=false)
hash_code hash_value(const APFloat &Arg)
virtual std::string getAsString() const
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
virtual unsigned getBitNum() const
const std::string & getName() const
virtual Init * getBit(unsigned Bit) const =0
DagInit * getValueAsDag(StringRef FieldName) const
size_t size() const
size - Get the array size.
std::vector< std::string > getValueAsListOfStrings(StringRef FieldName) const
virtual std::string getAsString() const
virtual bool baseClassOf(const RecTy *) const
virtual Init * convertInitListSlice(const std::vector< unsigned > &Elements) const
static BitsInit * get(ArrayRef< Init * > Range)
void resolveReferencesTo(const RecordVal *RV)
virtual Init * convertInitializerTo(RecTy *Ty) const =0
static unsigned getHashValue(const TableGenStringKey &Val)
virtual unsigned getBitNum() const
virtual RecTy * getFieldType(const std::string &FieldName) const
Record * getDef(const std::string &Name) const
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
static VarInit * get(const std::string &VN, RecTy *T)
std::vector< Record * > getAllDerivedDefinitions(const std::string &ClassName) const
virtual Init * convertValue(UnsetInit *UI)
virtual bool baseClassOf(const RecTy *) const
virtual Init * getBit(unsigned Bit) const
RecordVector DefPrototypes
TypedInit * getVariable() const
virtual Init * getBit(unsigned Bit) const
virtual Init * convertInitializerBitRange(const std::vector< unsigned > &Bits) const
const RecordVal * getValue(const Init *Name) const
virtual Init * convertValue(UnsetInit *UI)
virtual bool typeIsConvertibleTo(const RecTy *RHS) const =0
std::vector< int64_t > getValueAsListOfInts(StringRef FieldName) const
static TableGenStringKey getTombstoneKey()
RecTyKind getRecTyKind() const
static BitInit * get(bool V)
TableGenStringKey(const std::string &str)
static FieldInit * get(Init *R, const std::string &FN)
static bool canFitInBitfield(int64_t Value, unsigned NumBits)
const std::vector< Record * > & getSuperClasses() const
DefInit * getDefInit()
get the corresponding DefInit.
static std::string itostr(int64_t X)
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
std::vector< Record * > getValueAsListOfDefs(StringRef FieldName) const
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
Init * QualifyName(Record &CurRec, MultiClass *CurMultiClass, Init *Name, const std::string &Scoper)
const Init * getNameInit() const
int64_t getValueAsInt(StringRef FieldName) const
virtual Init * convertInitializerBitRange(const std::vector< unsigned > &Bits) const
virtual Init * Fold(Record *CurRec, MultiClass *CurMultiClass) const =0
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
virtual std::string getAsString() const
getAsString - Convert this value to a string form.
virtual Init * Fold(Record *CurRec, MultiClass *CurMultiClass) const
static Init * EvaluateOperation(OpInit *RHSo, Init *LHS, Init *Arg, RecTy *Type, Record *CurRec, MultiClass *CurMultiClass)
ArrayRef< SMLoc > getLoc() const
static bool isEqual(const TableGenStringKey &LHS, const TableGenStringKey &RHS)
virtual Init * getFieldInit(Record &R, const RecordVal *RV, const std::string &FieldName) const
static VarBitInit * get(TypedInit *T, unsigned B)
static StringInit * get(StringRef)
static RecordRecTy * get(Record *R)
Init * getNameInit() const
static DefInit * get(Record *)
const std::vector< RecordVal > & getValues() const
virtual Init * resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) const
TableGenStringKey(const char *str)
unsigned getElementNum() const
virtual Init * convertValue(UnsetInit *UI)
static void ProfileListInit(FoldingSetNodeID &ID, ArrayRef< Init * > Range, RecTy *EltTy)
bool isTemplateArg(Init *Name) const
virtual Init * convertInitListSlice(const std::vector< unsigned > &Elements) const
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
An opaque object representing a hash code.
static Init * fixBitInit(const RecordVal *RV, Init *Before, Init *After)
LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const std::string &Msg)
RecTy * getElementType() const
RecordKeeper & getRecords() const
static DagInit * get(Init *V, const std::string &VN, ArrayRef< Init * > ArgRange, ArrayRef< std::string > NameRange)
static MachineInstr * getDef(unsigned Reg, const MachineRegisterInfo *MRI)
unsigned getNumBits() const
virtual Init * getBitVar() const
void removeDef(const std::string &Name)
virtual Init * resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) const
virtual Init * convertValue(UnsetInit *UI)
std::string getName(ID id, ArrayRef< Type * > Tys=None)
bool isSubClassOf(const Record *R) const
virtual Init * getFieldInit(Record &R, const RecordVal *RV, const std::string &FieldName) const
void addValue(const RecordVal &RV)
static TernOpInit * get(TernaryOp opc, Init *lhs, Init *mhs, Init *rhs, RecTy *Type)
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
static VarListElementInit * get(TypedInit *T, unsigned E)
virtual Init * resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) const
RecTy * resolveTypes(RecTy *T1, RecTy *T2)
virtual Init * convertValue(UnsetInit *UI)
static ListInit * get(ArrayRef< Init * > Range, RecTy *EltTy)
const std::map< std::string, Record * > & getDefs() const
void removeClass(const std::string &Name)
void AddString(StringRef String)
UnaryOp getOpcode() const
virtual Init * resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) const
reverse_iterator rend(StringRef path)
Get reverse end iterator over path.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
Record * getRecord() const
bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
const std::string & getName() const
virtual Init * getBit(unsigned Bit) const
Init * getNameInit() const
LLVM Value Representation.
virtual Init * resolveReferences(Record &R, const RecordVal *RV) const
virtual std::string getAsString() const =0
getAsString - Convert this value to a string form.
static void ProfileDagInit(FoldingSetNodeID &ID, Init *V, const std::string &VN, ArrayRef< Init * > ArgRange, ArrayRef< std::string > NameRange)
virtual Init * getOperand(int i) const =0
TernaryOp getOpcode() const
unsigned getPrefix() const
virtual Init * convertValue(UnsetInit *UI)
virtual bool baseClassOf(const RecTy *) const
virtual std::string getAsString() const =0
ListRecTy * getListTy()
getListTy - Returns the type representing list<this>.
virtual bool baseClassOf(const RecTy *) const
virtual Init * convertInitializerBitRange(const std::vector< unsigned > &Bits) const
virtual std::string getAsString() const