mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[RegisterBankInfo] Implement the verify method for the ValueMapping helper class.
The method checks that the value is fully defined accross the different partial mappings and that the partial mappings are compatible between each other. llvm-svn: 265556
This commit is contained in:
parent
06ae438693
commit
0029946844
@ -64,8 +64,8 @@ public:
|
|||||||
struct ValueMapping {
|
struct ValueMapping {
|
||||||
/// How the value is broken down between the different register banks.
|
/// How the value is broken down between the different register banks.
|
||||||
SmallVector<PartialMapping, 2> BreakDown;
|
SmallVector<PartialMapping, 2> BreakDown;
|
||||||
/// Verify that this mapping makes sense.
|
/// Verify that this mapping makes sense for a value of \p ExpectedBitWidth.
|
||||||
void verify() const;
|
void verify(unsigned ExpectedBitWidth) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Helper class that represents how the value of an instruction may be
|
/// Helper class that represents how the value of an instruction may be
|
||||||
|
@ -210,10 +210,22 @@ void RegisterBankInfo::PartialMapping::print(raw_ostream &OS) const {
|
|||||||
OS << "nullptr";
|
OS << "nullptr";
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterBankInfo::ValueMapping::verify() const {
|
void RegisterBankInfo::ValueMapping::verify(unsigned ExpectedBitWidth) const {
|
||||||
// Check that all the partial mapping have the same bitwidth.
|
assert(!BreakDown.empty() && "Value mapped nowhere?!");
|
||||||
// Check that the union of the partial mappings covers the whole value.
|
unsigned ValueBitWidth = BreakDown.back().Mask.getBitWidth();
|
||||||
// Check that each register bank is big enough to hold the partial value.
|
assert(ValueBitWidth == ExpectedBitWidth && "BitWidth does not match");
|
||||||
|
APInt ValueMask(ValueBitWidth, 0);
|
||||||
|
for (const RegisterBankInfo::PartialMapping &PartMap : BreakDown) {
|
||||||
|
// Check that all the partial mapping have the same bitwidth.
|
||||||
|
assert(PartMap.Mask.getBitWidth() == ValueBitWidth &&
|
||||||
|
"Value does not have the same size accross the partial mappings");
|
||||||
|
// Check that the union of the partial mappings covers the whole value.
|
||||||
|
ValueMask |= PartMap.Mask;
|
||||||
|
// Check that each register bank is big enough to hold the partial value:
|
||||||
|
// this check is done by PartialMapping::verify
|
||||||
|
PartMap.verify();
|
||||||
|
}
|
||||||
|
assert(ValueMask.isAllOnesValue() && "Value is not fully mapped");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterBankInfo::InstructionMapping::verify(
|
void RegisterBankInfo::InstructionMapping::verify(
|
||||||
|
Loading…
Reference in New Issue
Block a user