mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-03 00:47:07 +00:00
[RegisterBankInfo] Add print and dump method to the InstructionMapping
helper class. llvm-svn: 265747
This commit is contained in:
parent
980ab75040
commit
d8b8e21c6f
@ -151,6 +151,12 @@ public:
|
||||
/// Verifiy that this mapping makes sense for \p MI.
|
||||
/// \pre \p MI must be connected to a MachineFunction.
|
||||
void verify(const MachineInstr &MI) const;
|
||||
|
||||
/// Print this on dbgs() stream.
|
||||
void dump() const;
|
||||
|
||||
/// Print this on \p OS;
|
||||
void print(raw_ostream &OS) const;
|
||||
};
|
||||
|
||||
/// Convenient type to represent the alternatives for mapping an
|
||||
@ -397,6 +403,13 @@ operator<<(raw_ostream &OS, const RegisterBankInfo::ValueMapping &ValMapping) {
|
||||
ValMapping.print(OS);
|
||||
return OS;
|
||||
}
|
||||
|
||||
inline raw_ostream &
|
||||
operator<<(raw_ostream &OS,
|
||||
const RegisterBankInfo::InstructionMapping &InstrMapping) {
|
||||
InstrMapping.print(OS);
|
||||
return OS;
|
||||
}
|
||||
} // End namespace llvm.
|
||||
|
||||
#endif
|
||||
|
@ -447,3 +447,19 @@ void RegisterBankInfo::InstructionMapping::verify(
|
||||
MOMapping.verify(RegSize);
|
||||
}
|
||||
}
|
||||
|
||||
void RegisterBankInfo::InstructionMapping::dump() const {
|
||||
print(dbgs());
|
||||
dbgs() << '\n';
|
||||
}
|
||||
|
||||
void RegisterBankInfo::InstructionMapping::print(raw_ostream &OS) const {
|
||||
OS << "ID: " << getID() << " Cost: " << getCost() << " Mapping: ";
|
||||
|
||||
for (unsigned OpIdx = 0; OpIdx != NumOperands; ++OpIdx) {
|
||||
const ValueMapping &ValMapping = getOperandMapping(OpIdx);
|
||||
if (OpIdx)
|
||||
OS << ", ";
|
||||
OS << "{ Idx: " << OpIdx << " Map: " << ValMapping << '}';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user