}
bool BitRecTy::typeIsConvertibleTo(const RecTy *RHS) const{
- if(RecTy::typeIsConvertibleTo(RHS) || RHS->getRecTyKind() == IntRecTyKind)
+ if (RecTy::typeIsConvertibleTo(RHS) || RHS->getRecTyKind() == IntRecTyKind)
return true;
- if(const BitsRecTy *BitsTy = dyn_cast<BitsRecTy>(RHS))
+ if (const BitsRecTy *BitsTy = dyn_cast<BitsRecTy>(RHS))
return BitsTy->getNumBits() == 1;
return false;
}
PrintFatalError(CurRec->getLoc(),
"Undefined reference:'" + Name + "'\n");
}
+
+ if (isa<IntRecTy>(getType())) {
+ if (BitsInit *BI = dyn_cast<BitsInit>(LHS)) {
+ if (Init *NewInit = BI->convertInitializerTo(IntRecTy::get()))
+ return NewInit;
+ break;
+ }
+ }
}
break;
}
return ForeachHelper(LHS, Arg, RHSo, Type, CurRec, CurMultiClass);
std::vector<Init *> NewOperands;
- for (int i = 0; i < RHSo->getNumOperands(); ++i) {
+ for (unsigned i = 0; i < RHSo->getNumOperands(); ++i) {
if (auto *RHSoo = dyn_cast<OpInit>(RHSo->getOperand(i))) {
if (Init *Result = EvaluateOperation(RHSoo, LHS, Arg,
Type, CurRec, CurMultiClass))
for (Init *&Item : NewList) {
NewOperands.clear();
- for(int i = 0; i < RHSo->getNumOperands(); ++i) {
+ for(unsigned i = 0; i < RHSo->getNumOperands(); ++i) {
// First, replace the foreach variable with the list item
if (LHS->getAsString() == RHSo->getOperand(i)->getAsString())
NewOperands.push_back(Item);
}
DefInit *Record::getDefInit() {
- static DenseMap<Record *, std::unique_ptr<DefInit>> ThePool;
- if (TheInit)
- return TheInit;
-
- std::unique_ptr<DefInit> &I = ThePool[this];
- if (!I) I.reset(new DefInit(this, new RecordRecTy(this)));
- return I.get();
+ if (!TheInit)
+ TheInit.reset(new DefInit(this, new RecordRecTy(this)));
+ return TheInit.get();
}
const std::string &Record::getName() const {
}
OS << " {";
- const std::vector<Record*> &SC = R.getSuperClasses();
+ ArrayRef<Record *> SC = R.getSuperClasses();
if (!SC.empty()) {
OS << "\t//";
for (const Record *Super : SC)
RecTy *Type = cast<TypedInit>(Name)->getType();
BinOpInit *NewName =
- BinOpInit::get(BinOpInit::STRCONCAT,
- BinOpInit::get(BinOpInit::STRCONCAT,
- CurRec.getNameInit(),
- StringInit::get(Scoper),
- Type)->Fold(&CurRec, CurMultiClass),
- Name,
- Type);
+ BinOpInit::get(BinOpInit::STRCONCAT,
+ BinOpInit::get(BinOpInit::STRCONCAT,
+ CurRec.getNameInit(),
+ StringInit::get(Scoper),
+ Type)->Fold(&CurRec, CurMultiClass),
+ Name,
+ Type);
if (CurMultiClass && Scoper != "::") {
NewName =
- BinOpInit::get(BinOpInit::STRCONCAT,
- BinOpInit::get(BinOpInit::STRCONCAT,
- CurMultiClass->Rec.getNameInit(),
- StringInit::get("::"),
- Type)->Fold(&CurRec, CurMultiClass),
- NewName->Fold(&CurRec, CurMultiClass),
- Type);
+ BinOpInit::get(BinOpInit::STRCONCAT,
+ BinOpInit::get(BinOpInit::STRCONCAT,
+ CurMultiClass->Rec.getNameInit(),
+ StringInit::get("::"),
+ Type)->Fold(&CurRec, CurMultiClass),
+ NewName->Fold(&CurRec, CurMultiClass),
+ Type);
}
return NewName->Fold(&CurRec, CurMultiClass);