if (!Changed)
return const_cast<ListInit*>(this);
- return ListInit::get(Elements, Ty);
+ return ListInit::get(Elements, ElementType);
}
return nullptr;
return nullptr;
Vals.push_back(getElement(Element));
}
- return ListInit::get(Vals, getType());
+ return ListInit::get(Vals, getElementType());
}
Record *ListInit::getElementAsRecord(unsigned i) const {
}
if (Changed)
- return ListInit::get(Resolved, getType());
+ return ListInit::get(Resolved, getElementType());
return const_cast<ListInit *>(this);
}
assert(!LHSl->empty() && "Empty list in tail");
// Note the +1. We can't just pass the result of getValues()
// directly.
- return ListInit::get(LHSl->getValues().slice(1), LHSl->getType());
+ return ListInit::get(LHSl->getValues().slice(1), LHSl->getElementType());
}
break;
SmallVector<Init *, 8> Args;
Args.insert(Args.end(), LHSs->begin(), LHSs->end());
Args.insert(Args.end(), RHSs->begin(), RHSs->end());
- return ListInit::get(
- Args, cast<ListRecTy>(LHSs->getType())->getElementType());
+ return ListInit::get(Args, LHSs->getElementType());
}
break;
}
ProfileTernOpInit(ID, getOpcode(), getLHS(), getMHS(), getRHS(), getType());
}
-static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, Record *CurRec,
- MultiClass *CurMultiClass);
-
// Evaluates operation RHSo after replacing all operands matching LHS with Arg.
static Init *EvaluateOperation(OpInit *RHSo, Init *LHS, Init *Arg,
Record *CurRec, MultiClass *CurMultiClass) {
}
// Applies RHS to all elements of MHS, using LHS as a temp variable.
-static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, Record *CurRec,
- MultiClass *CurMultiClass) {
+static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
+ Record *CurRec, MultiClass *CurMultiClass) {
OpInit *RHSo = dyn_cast<OpInit>(RHS);
if (!RHSo)
StringInit *ArgName = MHSd->getArgName(i);
// If this is a dag, recurse
if (isa<DagInit>(Arg)) {
- if (Init *Result = ForeachHelper(LHS, Arg, RHSo, CurRec, CurMultiClass))
+ if (Init *Result =
+ ForeachHelper(LHS, Arg, RHSo, Type, CurRec, CurMultiClass))
Arg = Result;
} else if (Init *Result =
EvaluateOperation(RHSo, LHS, Arg, CurRec, CurMultiClass)) {
}
ListInit *MHSl = dyn_cast<ListInit>(MHS);
- if (MHSl) {
+ ListRecTy *ListType = dyn_cast<ListRecTy>(Type);
+ if (MHSl && ListType) {
SmallVector<Init *, 8> NewList(MHSl->begin(), MHSl->end());
for (Init *&Arg : NewList) {
if (Init *Result =
EvaluateOperation(RHSo, LHS, Arg, CurRec, CurMultiClass))
Arg = Result;
}
- return ListInit::get(NewList, MHSl->getType());
+ return ListInit::get(NewList, ListType->getElementType());
}
return nullptr;
}
}
case FOREACH: {
- if (Init *Result = ForeachHelper(LHS, MHS, RHS, CurRec, CurMultiClass))
+ if (Init *Result =
+ ForeachHelper(LHS, MHS, RHS, getType(), CurRec, CurMultiClass))
return Result;
break;
}
for (unsigned Element : Elements)
ListInits.push_back(VarListElementInit::get(const_cast<TypedInit *>(this),
Element));
- return ListInit::get(ListInits, T);
+ return ListInit::get(ListInits, T->getElementType());
}