[llvm] r329908 - [CodeGen] Allow printing MachineMemOperands with less context in SDAGDumper
Francis Visoiu Mistrih via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 12 05:59:50 PDT 2018
Author: thegameg
Date: Thu Apr 12 05:59:50 2018
New Revision: 329908
URL: http://llvm.org/viewvc/llvm-project?rev=329908&view=rev
Log:
[CodeGen] Allow printing MachineMemOperands with less context in SDAGDumper
Don't assume SelectionDAG is non-null as the targets can use it with a
null pointer.
Differential Revision: https://reviews.llvm.org/D44611
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp?rev=329908&r1=329907&r2=329908&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp Thu Apr 12 05:59:50 2018
@@ -425,15 +425,28 @@ static Printable PrintNodeId(const SDNod
// 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)
More information about the llvm-commits
mailing list