mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-02 21:31:41 +00:00
Tighten up assertion checking
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4939 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
698e9ce568
commit
ade0de9123
@ -89,14 +89,21 @@ static void setValue(const std::string &ValName,
|
||||
|
||||
BitsInit *NewVal = new BitsInit(CurVal->getNumBits());
|
||||
|
||||
for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
|
||||
NewVal->setBit(i, CurVal->getBit(i));
|
||||
|
||||
// Loop over bits, assigning values as appopriate...
|
||||
// Loop over bits, assigning values as appropriate...
|
||||
for (unsigned i = 0, e = BitList->size(); i != e; ++i) {
|
||||
unsigned Bit = (*BitList)[i];
|
||||
if (NewVal->getBit(i)) {
|
||||
err() << "Cannot set bit #" << i << " of value '" << ValName
|
||||
<< "' more than once!\n";
|
||||
abort();
|
||||
}
|
||||
NewVal->setBit(Bit, BInit->getBit(i));
|
||||
}
|
||||
|
||||
for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
|
||||
if (NewVal->getBit(i) == 0)
|
||||
NewVal->setBit(i, CurVal->getBit(i));
|
||||
|
||||
V = NewVal;
|
||||
}
|
||||
|
||||
|
@ -211,12 +211,14 @@ Init *BitsInit::resolveReferences(Record &R) {
|
||||
|
||||
for (unsigned i = 0, e = Bits.size(); i != e; ++i) {
|
||||
Init *B;
|
||||
New->setBit(i, getBit(i));
|
||||
Init *CurBit = getBit(i);
|
||||
|
||||
do {
|
||||
B = New->getBit(i);
|
||||
New->setBit(i, B->resolveReferences(R));
|
||||
Changed |= B != New->getBit(i);
|
||||
} while (B != New->getBit(i));
|
||||
B = CurBit;
|
||||
CurBit = CurBit->resolveReferences(R);
|
||||
Changed |= B != CurBit;
|
||||
} while (B != CurBit);
|
||||
New->setBit(i, CurBit);
|
||||
}
|
||||
|
||||
if (Changed)
|
||||
|
@ -245,6 +245,7 @@ public:
|
||||
}
|
||||
void setBit(unsigned Bit, Init *V) {
|
||||
assert(Bit < Bits.size() && "Bit index out of range!");
|
||||
assert(Bits[Bit] == 0 && "Bit already set!");
|
||||
Bits[Bit] = V;
|
||||
}
|
||||
|
||||
|
@ -89,14 +89,21 @@ static void setValue(const std::string &ValName,
|
||||
|
||||
BitsInit *NewVal = new BitsInit(CurVal->getNumBits());
|
||||
|
||||
for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
|
||||
NewVal->setBit(i, CurVal->getBit(i));
|
||||
|
||||
// Loop over bits, assigning values as appopriate...
|
||||
// Loop over bits, assigning values as appropriate...
|
||||
for (unsigned i = 0, e = BitList->size(); i != e; ++i) {
|
||||
unsigned Bit = (*BitList)[i];
|
||||
if (NewVal->getBit(i)) {
|
||||
err() << "Cannot set bit #" << i << " of value '" << ValName
|
||||
<< "' more than once!\n";
|
||||
abort();
|
||||
}
|
||||
NewVal->setBit(Bit, BInit->getBit(i));
|
||||
}
|
||||
|
||||
for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
|
||||
if (NewVal->getBit(i) == 0)
|
||||
NewVal->setBit(i, CurVal->getBit(i));
|
||||
|
||||
V = NewVal;
|
||||
}
|
||||
|
||||
|
@ -211,12 +211,14 @@ Init *BitsInit::resolveReferences(Record &R) {
|
||||
|
||||
for (unsigned i = 0, e = Bits.size(); i != e; ++i) {
|
||||
Init *B;
|
||||
New->setBit(i, getBit(i));
|
||||
Init *CurBit = getBit(i);
|
||||
|
||||
do {
|
||||
B = New->getBit(i);
|
||||
New->setBit(i, B->resolveReferences(R));
|
||||
Changed |= B != New->getBit(i);
|
||||
} while (B != New->getBit(i));
|
||||
B = CurBit;
|
||||
CurBit = CurBit->resolveReferences(R);
|
||||
Changed |= B != CurBit;
|
||||
} while (B != CurBit);
|
||||
New->setBit(i, CurBit);
|
||||
}
|
||||
|
||||
if (Changed)
|
||||
|
@ -245,6 +245,7 @@ public:
|
||||
}
|
||||
void setBit(unsigned Bit, Init *V) {
|
||||
assert(Bit < Bits.size() && "Bit index out of range!");
|
||||
assert(Bits[Bit] == 0 && "Bit already set!");
|
||||
Bits[Bit] = V;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user