add a new -view-sched-dags option to view dags as they are sent to the scheduler.
authorChris Lattner <sabre@nondot.org>
Thu, 18 Aug 2005 20:11:49 +0000 (20:11 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 18 Aug 2005 20:11:49 +0000 (20:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22878 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/ScheduleDAG.cpp

index c4dba4144166f5516b0f7bbf0336413fce138987..bf77d4c7f7310193351527b23d3c7234d3cc6bc9 100644 (file)
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/Support/CommandLine.h"
 using namespace llvm;
 
+#ifndef _NDEBUG
+static cl::opt<bool>
+ViewDAGs("view-sched-dags", cl::Hidden,
+         cl::desc("Pop up a window to show sched dags as they are processed"));
+#else
+static const bool ViewDAGS = 0;
+#endif
+
 namespace {
   class SimpleSched {
     SelectionDAG &DAG;
@@ -112,5 +121,6 @@ unsigned SimpleSched::Emit(SDOperand Op) {
 /// Pick a safe ordering and emit instructions for each target node in the
 /// graph.
 void SelectionDAGISel::ScheduleAndEmitDAG(SelectionDAG &SD) {
+  if (ViewDAGs) SD.viewGraph();
   SimpleSched(SD, BB).Run();  
 }