return BitInit::get(Val != 0);
}
-Init *BitRecTy::convertValue(TypedInit *VI) {
- RecTy *Ty = VI->getType();
+Init *BitRecTy::convertValue(TypedInit *TI) {
+ RecTy *Ty = TI->getType();
if (isa<BitRecTy>(Ty))
- return VI; // Accept variable if it is already of bit type!
+ return TI; // Accept variable if it is already of bit type!
if (auto *BitsTy = dyn_cast<BitsRecTy>(Ty))
// Accept only bits<1> expression.
- return BitsTy->getNumBits() == 1 ? VI : nullptr;
+ return BitsTy->getNumBits() == 1 ? TI : nullptr;
// Ternary !if can be converted to bit, but only if both sides are
// convertible to a bit.
- if (TernOpInit *TOI = dyn_cast<TernOpInit>(VI)) {
+ if (TernOpInit *TOI = dyn_cast<TernOpInit>(TI)) {
if (TOI->getOpcode() != TernOpInit::TernaryOp::IF)
return nullptr;
if (!TOI->getMHS()->convertInitializerTo(BitRecTy::get()) ||
return BitsInit::get(NewBits);
}
-Init *BitsRecTy::convertValue(BitInit *UI) {
+Init *BitsRecTy::convertValue(BitInit *BI) {
if (Size != 1) return nullptr; // Can only convert single bit.
- return BitsInit::get(UI);
+ return BitsInit::get(BI);
}
/// canFitInBitfield - Return true if the number of bits is large enough to hold
return nullptr;
}
-Init *BitsRecTy::convertValue(TypedInit *VI) {
- if (Size == 1 && isa<BitRecTy>(VI->getType()))
- return BitsInit::get(VI);
+Init *BitsRecTy::convertValue(TypedInit *TI) {
+ if (Size == 1 && isa<BitRecTy>(TI->getType()))
+ return BitsInit::get(TI);
- if (VI->getType()->typeIsConvertibleTo(this)) {
+ if (TI->getType()->typeIsConvertibleTo(this)) {
SmallVector<Init *, 16> NewBits(Size);
for (unsigned i = 0; i != Size; ++i)
- NewBits[i] = VarBitInit::get(VI, i);
+ NewBits[i] = VarBitInit::get(TI, i);
return BitsInit::get(NewBits);
}
return kind==BitRecTyKind || kind==BitsRecTyKind || kind==IntRecTyKind;
}
-Init *StringRecTy::convertValue(UnOpInit *BO) {
- if (BO->getOpcode() == UnOpInit::CAST) {
- Init *L = BO->getOperand()->convertInitializerTo(this);
+Init *StringRecTy::convertValue(UnOpInit *UO) {
+ if (UO->getOpcode() == UnOpInit::CAST) {
+ Init *L = UO->getOperand()->convertInitializerTo(this);
if (!L) return nullptr;
- if (L != BO->getOperand())
+ if (L != UO->getOperand())
return UnOpInit::get(UnOpInit::CAST, L, StringRecTy::get());
- return BO;
+ return UO;
}
- return convertValue((TypedInit*)BO);
+ return convertValue((TypedInit*)UO);
}
Init *StringRecTy::convertValue(BinOpInit *BO) {
return nullptr;
}
-Init *DagRecTy::convertValue(UnOpInit *BO) {
- if (BO->getOpcode() == UnOpInit::CAST) {
- Init *L = BO->getOperand()->convertInitializerTo(this);
+Init *DagRecTy::convertValue(UnOpInit *UO) {
+ if (UO->getOpcode() == UnOpInit::CAST) {
+ Init *L = UO->getOperand()->convertInitializerTo(this);
if (!L) return nullptr;
- if (L != BO->getOperand())
- return UnOpInit::get(UnOpInit::CAST, L, new DagRecTy);
- return BO;
+ if (L != UO->getOperand())
+ return UnOpInit::get(UnOpInit::CAST, L, DagRecTy::get());
+ return UO;
}
return nullptr;
}
Init *R = BO->getRHS()->convertInitializerTo(this);
if (!L || !R) return nullptr;
if (L != BO->getLHS() || R != BO->getRHS())
- return BinOpInit::get(BinOpInit::CONCAT, L, R, new DagRecTy);
+ return BinOpInit::get(BinOpInit::CONCAT, L, R, DagRecTy::get());
return BO;
}
return nullptr;
}
case HEAD: {
if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
- assert(!LHSl->empty() && "Empty list in car");
+ assert(!LHSl->empty() && "Empty list in head");
return LHSl->getElement(0);
}
break;
}
case TAIL: {
if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
- assert(!LHSl->empty() && "Empty list in cdr");
+ 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());