[TableGen] Make some variable names consistent with their type names and just generally consistent across all of the overloads.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237775 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2015-05-20 05:40:13 +00:00
parent ee25444b06
commit 43ec501d2c
2 changed files with 33 additions and 33 deletions

View File

@ -107,14 +107,14 @@ public: // These methods should only be called from subclasses of Init
virtual Init *convertValue( IntInit *II) { return nullptr; }
virtual Init *convertValue(StringInit *SI) { return nullptr; }
virtual Init *convertValue( ListInit *LI) { return nullptr; }
virtual Init *convertValue( UnOpInit *UI) {
return convertValue((TypedInit*)UI);
virtual Init *convertValue( UnOpInit *UO) {
return convertValue((TypedInit*)UO);
}
virtual Init *convertValue( BinOpInit *UI) {
return convertValue((TypedInit*)UI);
virtual Init *convertValue( BinOpInit *BO) {
return convertValue((TypedInit*)BO);
}
virtual Init *convertValue( TernOpInit *UI) {
return convertValue((TypedInit*)UI);
virtual Init *convertValue( TernOpInit *TO) {
return convertValue((TypedInit*)TO);
}
virtual Init *convertValue(VarBitInit *VB) { return nullptr; }
virtual Init *convertValue( DefInit *DI) { return nullptr; }
@ -240,7 +240,7 @@ public:
using RecTy::convertValue;
Init *convertValue( UnsetInit *UI) override { return (Init*)UI; }
Init *convertValue(StringInit *SI) override { return (Init*)SI; }
Init *convertValue( UnOpInit *BO) override;
Init *convertValue( UnOpInit *UO) override;
Init *convertValue( BinOpInit *BO) override;
Init *convertValue( TypedInit *TI) override;
@ -296,9 +296,9 @@ public:
using RecTy::convertValue;
Init *convertValue( UnsetInit *UI) override { return (Init*)UI; }
Init *convertValue( UnOpInit *BO) override;
Init *convertValue( UnOpInit *UO) override;
Init *convertValue( BinOpInit *BO) override;
Init *convertValue( DagInit *CI) override { return (Init*)CI; }
Init *convertValue( DagInit *DI) override { return (Init*)DI; }
Init *convertValue( TypedInit *TI) override;
std::string getAsString() const override { return "dag"; }
@ -328,7 +328,7 @@ public:
using RecTy::convertValue;
Init *convertValue( UnsetInit *UI) override { return (Init*)UI; }
Init *convertValue( DefInit *DI) override;
Init *convertValue( TypedInit *VI) override;
Init *convertValue( TypedInit *TI) override;
std::string getAsString() const override;

View File

@ -112,16 +112,16 @@ Init *BitRecTy::convertValue(IntInit *II) {
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()) ||
@ -163,9 +163,9 @@ Init *BitsRecTy::convertValue(UnsetInit *UI) {
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
@ -200,15 +200,15 @@ Init *BitsRecTy::convertValue(BitsInit *BI) {
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);
}
@ -247,16 +247,16 @@ bool IntRecTy::baseClassOf(const RecTy *RHS) const{
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) {
@ -320,13 +320,13 @@ Init *DagRecTy::convertValue(TypedInit *TI) {
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())
if (L != UO->getOperand())
return UnOpInit::get(UnOpInit::CAST, L, DagRecTy::get());
return BO;
return UO;
}
return nullptr;
}