From e85b06d65f695c576df1e529ee37cb15e6902401 Mon Sep 17 00:00:00 2001 From: Francis Visoiu Mistrih Date: Wed, 14 Mar 2018 21:52:13 +0000 Subject: [CodeGen] Use MIR syntax for MachineMemOperand printing Get rid of the "; mem:" suffix and use the one we use in MIR: ":: (load 2)". rdar://38163529 Differential Revision: https://reviews.llvm.org/D42377 llvm-svn: 327580 --- llvm/lib/CodeGen/MachineInstr.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'llvm/lib/CodeGen/MachineInstr.cpp') diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 3fbf50df18b..8f5e8e964ae 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1441,25 +1441,33 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST, } } - bool HaveSemi = false; if (!memoperands_empty()) { - if (!HaveSemi) { - OS << ";"; - HaveSemi = true; + SmallVector SSNs; + const LLVMContext *Context = nullptr; + std::unique_ptr CtxPtr; + const MachineFrameInfo *MFI = nullptr; + if (const MachineFunction *MF = getMFIfAvailable(*this)) { + MFI = &MF->getFrameInfo(); + Context = &MF->getFunction().getContext(); + } else { + CtxPtr = llvm::make_unique(); + Context = CtxPtr.get(); } - OS << " mem:"; - for (mmo_iterator i = memoperands_begin(), e = memoperands_end(); - i != e; ++i) { - (*i)->print(OS, MST); - if (std::next(i) != e) - OS << " "; + OS << " :: "; + bool NeedComma = false; + for (const MachineMemOperand *Op : memoperands()) { + if (NeedComma) + OS << ", "; + Op->print(OS, MST, SSNs, *Context, MFI, TII); + NeedComma = true; } } if (SkipDebugLoc) return; + bool HaveSemi = false; // Print debug location information. if (isDebugValue() && getOperand(e - 2).isMetadata()) { if (!HaveSemi) -- cgit v1.2.3