mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 22:20:37 +00:00
SelectionDAG: add a -filter-view-dags option to llc
This option takes the name of the basic block you want to visualize with -view-*-dags Differential Revision: http://reviews.llvm.org/D6948 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225953 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cfe92407cd
commit
df6c8efd9d
@ -464,7 +464,7 @@ code:
|
||||
mov %EAX, %EDX
|
||||
sar %EDX, 31
|
||||
idiv %ECX
|
||||
ret
|
||||
ret
|
||||
|
||||
This approach is extremely general (if it can handle the X86 architecture, it
|
||||
can handle anything!) and allows all of the target specific knowledge about the
|
||||
@ -848,6 +848,10 @@ is based on the final SelectionDAG, with nodes that must be scheduled together
|
||||
bundled into a single scheduling-unit node, and with immediate operands and
|
||||
other nodes that aren't relevant for scheduling omitted.
|
||||
|
||||
The option ``-filter-view-dags`` allows to select the name of the basic block
|
||||
that you are interested to visualize and filters all the previous
|
||||
``view-*-dags`` options.
|
||||
|
||||
.. _Build initial DAG:
|
||||
|
||||
Initial SelectionDAG Construction
|
||||
|
@ -183,6 +183,10 @@ UseMBPI("use-mbpi",
|
||||
cl::init(true), cl::Hidden);
|
||||
|
||||
#ifndef NDEBUG
|
||||
static cl::opt<std::string>
|
||||
FilterDAGBasicBlockName("filter-view-dags", cl::Hidden,
|
||||
cl::desc("Only display the basic block whose name "
|
||||
"matches this for all view-*-dags options"));
|
||||
static cl::opt<bool>
|
||||
ViewDAGCombine1("view-dag-combine1-dags", cl::Hidden,
|
||||
cl::desc("Pop up a window to show dags before the first "
|
||||
@ -652,6 +656,12 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
std::string BlockName;
|
||||
int BlockNumber = -1;
|
||||
(void)BlockNumber;
|
||||
bool MatchFilterBB = false; (void)MatchFilterBB;
|
||||
#ifndef NDEBUG
|
||||
MatchFilterBB = (!FilterDAGBasicBlockName.empty() &&
|
||||
FilterDAGBasicBlockName ==
|
||||
FuncInfo->MBB->getBasicBlock()->getName().str());
|
||||
#endif
|
||||
#ifdef NDEBUG
|
||||
if (ViewDAGCombine1 || ViewLegalizeTypesDAGs || ViewLegalizeDAGs ||
|
||||
ViewDAGCombine2 || ViewDAGCombineLT || ViewISelDAGs || ViewSchedDAGs ||
|
||||
@ -665,7 +675,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
DEBUG(dbgs() << "Initial selection DAG: BB#" << BlockNumber
|
||||
<< " '" << BlockName << "'\n"; CurDAG->dump());
|
||||
|
||||
if (ViewDAGCombine1) CurDAG->viewGraph("dag-combine1 input for " + BlockName);
|
||||
if (ViewDAGCombine1 && MatchFilterBB)
|
||||
CurDAG->viewGraph("dag-combine1 input for " + BlockName);
|
||||
|
||||
// Run the DAG combiner in pre-legalize mode.
|
||||
{
|
||||
@ -678,8 +689,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
|
||||
// Second step, hack on the DAG until it only uses operations and types that
|
||||
// the target supports.
|
||||
if (ViewLegalizeTypesDAGs) CurDAG->viewGraph("legalize-types input for " +
|
||||
BlockName);
|
||||
if (ViewLegalizeTypesDAGs && MatchFilterBB)
|
||||
CurDAG->viewGraph("legalize-types input for " + BlockName);
|
||||
|
||||
bool Changed;
|
||||
{
|
||||
@ -693,7 +704,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
CurDAG->NewNodesMustHaveLegalTypes = true;
|
||||
|
||||
if (Changed) {
|
||||
if (ViewDAGCombineLT)
|
||||
if (ViewDAGCombineLT && MatchFilterBB)
|
||||
CurDAG->viewGraph("dag-combine-lt input for " + BlockName);
|
||||
|
||||
// Run the DAG combiner in post-type-legalize mode.
|
||||
@ -719,7 +730,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
CurDAG->LegalizeTypes();
|
||||
}
|
||||
|
||||
if (ViewDAGCombineLT)
|
||||
if (ViewDAGCombineLT && MatchFilterBB)
|
||||
CurDAG->viewGraph("dag-combine-lv input for " + BlockName);
|
||||
|
||||
// Run the DAG combiner in post-type-legalize mode.
|
||||
@ -733,7 +744,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
<< BlockNumber << " '" << BlockName << "'\n"; CurDAG->dump());
|
||||
}
|
||||
|
||||
if (ViewLegalizeDAGs) CurDAG->viewGraph("legalize input for " + BlockName);
|
||||
if (ViewLegalizeDAGs && MatchFilterBB)
|
||||
CurDAG->viewGraph("legalize input for " + BlockName);
|
||||
|
||||
{
|
||||
NamedRegionTimer T("DAG Legalization", GroupName, TimePassesIsEnabled);
|
||||
@ -743,7 +755,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
DEBUG(dbgs() << "Legalized selection DAG: BB#" << BlockNumber
|
||||
<< " '" << BlockName << "'\n"; CurDAG->dump());
|
||||
|
||||
if (ViewDAGCombine2) CurDAG->viewGraph("dag-combine2 input for " + BlockName);
|
||||
if (ViewDAGCombine2 && MatchFilterBB)
|
||||
CurDAG->viewGraph("dag-combine2 input for " + BlockName);
|
||||
|
||||
// Run the DAG combiner in post-legalize mode.
|
||||
{
|
||||
@ -757,7 +770,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
if (OptLevel != CodeGenOpt::None)
|
||||
ComputeLiveOutVRegInfo();
|
||||
|
||||
if (ViewISelDAGs) CurDAG->viewGraph("isel input for " + BlockName);
|
||||
if (ViewISelDAGs && MatchFilterBB)
|
||||
CurDAG->viewGraph("isel input for " + BlockName);
|
||||
|
||||
// Third, instruction select all of the operations to machine code, adding the
|
||||
// code to the MachineBasicBlock.
|
||||
@ -769,7 +783,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
DEBUG(dbgs() << "Selected selection DAG: BB#" << BlockNumber
|
||||
<< " '" << BlockName << "'\n"; CurDAG->dump());
|
||||
|
||||
if (ViewSchedDAGs) CurDAG->viewGraph("scheduler input for " + BlockName);
|
||||
if (ViewSchedDAGs && MatchFilterBB)
|
||||
CurDAG->viewGraph("scheduler input for " + BlockName);
|
||||
|
||||
// Schedule machine code.
|
||||
ScheduleDAGSDNodes *Scheduler = CreateScheduler();
|
||||
@ -779,7 +794,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
||||
Scheduler->Run(CurDAG, FuncInfo->MBB);
|
||||
}
|
||||
|
||||
if (ViewSUnitDAGs) Scheduler->viewGraph();
|
||||
if (ViewSUnitDAGs && MatchFilterBB) Scheduler->viewGraph();
|
||||
|
||||
// Emit machine code to BB. This can change 'BB' to the last block being
|
||||
// inserted into.
|
||||
|
Loading…
Reference in New Issue
Block a user