From 440f69c95aeadb6e4c920d81db50c44c17810d97 Mon Sep 17 00:00:00 2001 From: Francis Visoiu Mistrih Date: Fri, 8 Dec 2017 22:53:21 +0000 Subject: [CodeGen] Move printing MO_Immediate operands to MachineOperand::print Work towards the unification of MIR and debug output by refactoring the interfaces. Add support for operand subreg index as an immediate to debug printing and use ::print in the MIRPrinter. Differential Review: https://reviews.llvm.org/D40965 llvm-svn: 320209 --- llvm/lib/CodeGen/MachineOperand.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/CodeGen/MachineOperand.cpp') diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp index 0cbcb65a99a..8bd6a7a965b 100644 --- a/llvm/lib/CodeGen/MachineOperand.cpp +++ b/llvm/lib/CodeGen/MachineOperand.cpp @@ -345,6 +345,15 @@ static void tryToGetTargetInfo(const MachineOperand &MO, } } +void MachineOperand::printSubregIdx(raw_ostream &OS, uint64_t Index, + const TargetRegisterInfo *TRI) { + OS << "%subreg."; + if (TRI) + OS << TRI->getSubRegIndexName(Index); + else + OS << Index; +} + void MachineOperand::print(raw_ostream &OS, const TargetRegisterInfo *TRI, const TargetIntrinsicInfo *IntrinsicInfo) const { tryToGetTargetInfo(*this, TRI, IntrinsicInfo); -- cgit v1.2.3