1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[RegisterBankInfo] Add print and dump method to the ValueMapping helper

class.

llvm-svn: 265746
This commit is contained in:
Quentin Colombet 2016-04-07 23:25:43 +00:00
parent 488499a935
commit 980ab75040
2 changed files with 28 additions and 0 deletions

View File

@ -71,6 +71,12 @@ public:
/// Verify that this mapping makes sense for a value of \p ExpectedBitWidth.
void verify(unsigned ExpectedBitWidth) const;
/// Print this on dbgs() stream.
void dump() const;
/// Print this on \p OS;
void print(raw_ostream &OS) const;
};
/// Helper class that represents how the value of an instruction may be
@ -385,6 +391,12 @@ operator<<(raw_ostream &OS,
PartMapping.print(OS);
return OS;
}
inline raw_ostream &
operator<<(raw_ostream &OS, const RegisterBankInfo::ValueMapping &ValMapping) {
ValMapping.print(OS);
return OS;
}
} // End namespace llvm.
#endif

View File

@ -390,6 +390,22 @@ void RegisterBankInfo::ValueMapping::verify(unsigned ExpectedBitWidth) const {
assert(ValueMask.isAllOnesValue() && "Value is not fully mapped");
}
void RegisterBankInfo::ValueMapping::dump() const {
print(dbgs());
dbgs() << '\n';
}
void RegisterBankInfo::ValueMapping::print(raw_ostream &OS) const {
OS << "#BreakDown: " << BreakDown.size() << " ";
bool IsFirst = true;
for (const PartialMapping &PartMap : BreakDown) {
if (!IsFirst)
OS << ", ";
OS << '[' << PartMap << ']';
IsFirst = false;
}
}
void RegisterBankInfo::InstructionMapping::setOperandMapping(
unsigned OpIdx, unsigned MaskSize, const RegisterBank &RegBank) {
// Build the value mapping.