Add DAG printing for RMW stuff debugging
authorAnton Korobeynikov <asl@math.spbu.ru>
Wed, 21 Oct 2009 19:18:28 +0000 (19:18 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Wed, 21 Oct 2009 19:18:28 +0000 (19:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84776 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
test/CodeGen/MSP430/Inst16mm.ll
test/CodeGen/MSP430/Inst8mm.ll

index fb841ba006c6089c501ca1d6608517fd2ecfd4f1..550c46897c49ed0c0fd24266634af2f1f5fb2de4 100644 (file)
@@ -26,6 +26,7 @@
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/CodeGen/SelectionDAGISel.h"
 #include "llvm/Target/TargetLowering.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 
 using namespace llvm;
 
+#ifndef NDEBUG
+static cl::opt<bool>
+ViewRMWDAGs("view-msp430-rmw-dags", cl::Hidden,
+          cl::desc("Pop up a window to show isel dags after RMW preprocess"));
+#else
+static const bool ViewRMWDAGs = false;
+#endif
+
 STATISTIC(NumLoadMoved, "Number of loads moved below TokenFactor");
 
 /// MSP430DAGToDAGISel - MSP430 specific code to select MSP430 machine
@@ -288,8 +297,15 @@ void MSP430DAGToDAGISel::PreprocessForRMW() {
 /// InstructionSelect - This callback is invoked by
 /// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
 void MSP430DAGToDAGISel::InstructionSelect() {
+  std::string BlockName;
+  if (ViewRMWDAGs)
+    BlockName = MF->getFunction()->getNameStr() + ":" +
+                BB->getBasicBlock()->getNameStr();
+
   PreprocessForRMW();
 
+  if (ViewRMWDAGs) CurDAG->viewGraph("RMW preprocessed:" + BlockName);
+
   DEBUG(errs() << "Selection DAG after RMW preprocessing:\n");
   DEBUG(CurDAG->dump());
 
index 608dfc2a4c5408d4d61b5ab28593c541298135bf..5fefead14bd1f9b2fab02ac347e26a5f93f7a097 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: llc -march=msp430 < %s | FileCheck %s
-; XFAIL
+; XFAIL: *
 target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"
 target triple = "msp430-generic-generic"
 @foo = common global i16 0, align 2
index cc040a358735593d5ca633071f03533d1aac79bd..4b0607e670d9bb966bb6f174aaffec7af547199a 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: llc -march=msp430 < %s | FileCheck %s
-; XFAIL
+; XFAIL: *
 target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"
 target triple = "msp430-generic-generic"