add a -view-legalize-types-dags option, for viewing the dags going into legalize...
authorChris Lattner <sabre@nondot.org>
Sun, 3 Feb 2008 02:05:04 +0000 (02:05 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 3 Feb 2008 02:05:04 +0000 (02:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46672 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeTypes.cpp

index 70d07ebf428ed0f6ec05b7ca8c4347a321387fd2..b614085e30ccb794f500c62374d864a8944be44c 100644 (file)
 #include "LegalizeTypes.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MathExtras.h"
 using namespace llvm;
 
+#ifndef NDEBUG
+static cl::opt<bool>
+ViewLegalizeTypesDAGs("view-legalize-types-dags", cl::Hidden,
+                cl::desc("Pop up a window to show dags before legalize types"));
+#else
+static const bool ViewLegalizeTypesDAGs = 0;
+#endif
+
+
+
 /// run - This is the main entry point for the type legalizer.  This does a
 /// top-down traversal of the dag, legalizing types as it goes.
 void DAGTypeLegalizer::run() {
@@ -438,5 +449,7 @@ void DAGTypeLegalizer::SplitOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi) {
 /// Note that this is an involved process that may invalidate pointers into
 /// the graph.
 void SelectionDAG::LegalizeTypes() {
+  if (ViewLegalizeTypesDAGs) viewGraph();
+  
   DAGTypeLegalizer(*this).run();
 }