[PATCH] D44611: [CodeGen] Allow printing MachineMemOperands with less context in SDAGDumper

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 06:03:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL329908: [CodeGen] Allow printing MachineMemOperands with less context in SDAGDumper (authored by thegameg, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44611?vs=138866&id=142158#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44611

Files:
  llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp


Index: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
@@ -425,15 +425,28 @@
 
 // Print the MMO with more information from the SelectionDAG.
 static void printMemOperand(raw_ostream &OS, const MachineMemOperand &MMO,
-                            const SelectionDAG *G) {
-  const MachineFunction &MF = G->getMachineFunction();
-  const Function &F = MF.getFunction();
-  const MachineFrameInfo &MFI = MF.getFrameInfo();
-  const TargetInstrInfo *TII = G->getSubtarget().getInstrInfo();
-  ModuleSlotTracker MST(F.getParent());
-  MST.incorporateFunction(F);
+                            const MachineFunction *MF, const Module *M,
+                            const MachineFrameInfo *MFI,
+                            const TargetInstrInfo *TII, LLVMContext &Ctx) {
+  ModuleSlotTracker MST(M);
+  if (MF)
+    MST.incorporateFunction(MF->getFunction());
   SmallVector<StringRef, 0> SSNs;
-  MMO.print(OS, MST, SSNs, *G->getContext(), &MFI, TII);
+  MMO.print(OS, MST, SSNs, Ctx, MFI, TII);
+}
+
+static void printMemOperand(raw_ostream &OS, const MachineMemOperand &MMO,
+                            const SelectionDAG *G) {
+  if (G) {
+    const MachineFunction *MF = &G->getMachineFunction();
+    return printMemOperand(OS, MMO, MF, MF->getFunction().getParent(),
+                           &MF->getFrameInfo(), G->getSubtarget().getInstrInfo(),
+                           *G->getContext());
+  } else {
+    LLVMContext Ctx;
+    return printMemOperand(OS, MMO, /*MF=*/nullptr, /*M=*/nullptr,
+                           /*MFI=*/nullptr, /*TII=*/nullptr, Ctx);
+  }
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44611.142158.patch
Type: text/x-patch
Size: 1837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180412/a48a1861/attachment.bin>


More information about the llvm-commits mailing list