add a -view-legalize-types-dags option, for viewing the dags going into legalize types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46672 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2008-02-03 02:05:04 +00:00
parent 4eecdeb3fa
commit a658baba78

View File

@ -16,9 +16,20 @@
#include "LegalizeTypes.h" #include "LegalizeTypes.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MathExtras.h" #include "llvm/Support/MathExtras.h"
using namespace llvm; 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 /// 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. /// top-down traversal of the dag, legalizing types as it goes.
void DAGTypeLegalizer::run() { 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 /// Note that this is an involved process that may invalidate pointers into
/// the graph. /// the graph.
void SelectionDAG::LegalizeTypes() { void SelectionDAG::LegalizeTypes() {
if (ViewLegalizeTypesDAGs) viewGraph();
DAGTypeLegalizer(*this).run(); DAGTypeLegalizer(*this).run();
} }