From 9a2ae85e6726c2bf9495cd72c4fbf95f305524f5 Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Thu, 7 Apr 2016 23:31:58 +0000 Subject: [RegisterBankInfo] Add print and dump method to the InstructionMapping helper class. llvm-svn: 265747 --- llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp index 262459f00c0..f3bf1690ac8 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp @@ -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 << '}'; + } +} -- cgit v1.2.3