mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-20 14:29:27 +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
@ -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
|
bundled into a single scheduling-unit node, and with immediate operands and
|
||||||
other nodes that aren't relevant for scheduling omitted.
|
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:
|
.. _Build initial DAG:
|
||||||
|
|
||||||
Initial SelectionDAG Construction
|
Initial SelectionDAG Construction
|
||||||
|
@ -183,6 +183,10 @@ UseMBPI("use-mbpi",
|
|||||||
cl::init(true), cl::Hidden);
|
cl::init(true), cl::Hidden);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#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>
|
static cl::opt<bool>
|
||||||
ViewDAGCombine1("view-dag-combine1-dags", cl::Hidden,
|
ViewDAGCombine1("view-dag-combine1-dags", cl::Hidden,
|
||||||
cl::desc("Pop up a window to show dags before the first "
|
cl::desc("Pop up a window to show dags before the first "
|
||||||
@ -652,6 +656,12 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
std::string BlockName;
|
std::string BlockName;
|
||||||
int BlockNumber = -1;
|
int BlockNumber = -1;
|
||||||
(void)BlockNumber;
|
(void)BlockNumber;
|
||||||
|
bool MatchFilterBB = false; (void)MatchFilterBB;
|
||||||
|
#ifndef NDEBUG
|
||||||
|
MatchFilterBB = (!FilterDAGBasicBlockName.empty() &&
|
||||||
|
FilterDAGBasicBlockName ==
|
||||||
|
FuncInfo->MBB->getBasicBlock()->getName().str());
|
||||||
|
#endif
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
if (ViewDAGCombine1 || ViewLegalizeTypesDAGs || ViewLegalizeDAGs ||
|
if (ViewDAGCombine1 || ViewLegalizeTypesDAGs || ViewLegalizeDAGs ||
|
||||||
ViewDAGCombine2 || ViewDAGCombineLT || ViewISelDAGs || ViewSchedDAGs ||
|
ViewDAGCombine2 || ViewDAGCombineLT || ViewISelDAGs || ViewSchedDAGs ||
|
||||||
@ -665,7 +675,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
DEBUG(dbgs() << "Initial selection DAG: BB#" << BlockNumber
|
DEBUG(dbgs() << "Initial selection DAG: BB#" << BlockNumber
|
||||||
<< " '" << BlockName << "'\n"; CurDAG->dump());
|
<< " '" << 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.
|
// 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
|
// Second step, hack on the DAG until it only uses operations and types that
|
||||||
// the target supports.
|
// the target supports.
|
||||||
if (ViewLegalizeTypesDAGs) CurDAG->viewGraph("legalize-types input for " +
|
if (ViewLegalizeTypesDAGs && MatchFilterBB)
|
||||||
BlockName);
|
CurDAG->viewGraph("legalize-types input for " + BlockName);
|
||||||
|
|
||||||
bool Changed;
|
bool Changed;
|
||||||
{
|
{
|
||||||
@ -693,7 +704,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
CurDAG->NewNodesMustHaveLegalTypes = true;
|
CurDAG->NewNodesMustHaveLegalTypes = true;
|
||||||
|
|
||||||
if (Changed) {
|
if (Changed) {
|
||||||
if (ViewDAGCombineLT)
|
if (ViewDAGCombineLT && MatchFilterBB)
|
||||||
CurDAG->viewGraph("dag-combine-lt input for " + BlockName);
|
CurDAG->viewGraph("dag-combine-lt input for " + BlockName);
|
||||||
|
|
||||||
// Run the DAG combiner in post-type-legalize mode.
|
// Run the DAG combiner in post-type-legalize mode.
|
||||||
@ -719,7 +730,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
CurDAG->LegalizeTypes();
|
CurDAG->LegalizeTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ViewDAGCombineLT)
|
if (ViewDAGCombineLT && MatchFilterBB)
|
||||||
CurDAG->viewGraph("dag-combine-lv input for " + BlockName);
|
CurDAG->viewGraph("dag-combine-lv input for " + BlockName);
|
||||||
|
|
||||||
// Run the DAG combiner in post-type-legalize mode.
|
// Run the DAG combiner in post-type-legalize mode.
|
||||||
@ -733,7 +744,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
<< BlockNumber << " '" << BlockName << "'\n"; CurDAG->dump());
|
<< 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);
|
NamedRegionTimer T("DAG Legalization", GroupName, TimePassesIsEnabled);
|
||||||
@ -743,7 +755,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
DEBUG(dbgs() << "Legalized selection DAG: BB#" << BlockNumber
|
DEBUG(dbgs() << "Legalized selection DAG: BB#" << BlockNumber
|
||||||
<< " '" << BlockName << "'\n"; CurDAG->dump());
|
<< " '" << 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.
|
// Run the DAG combiner in post-legalize mode.
|
||||||
{
|
{
|
||||||
@ -757,7 +770,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
if (OptLevel != CodeGenOpt::None)
|
if (OptLevel != CodeGenOpt::None)
|
||||||
ComputeLiveOutVRegInfo();
|
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
|
// Third, instruction select all of the operations to machine code, adding the
|
||||||
// code to the MachineBasicBlock.
|
// code to the MachineBasicBlock.
|
||||||
@ -769,7 +783,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
DEBUG(dbgs() << "Selected selection DAG: BB#" << BlockNumber
|
DEBUG(dbgs() << "Selected selection DAG: BB#" << BlockNumber
|
||||||
<< " '" << BlockName << "'\n"; CurDAG->dump());
|
<< " '" << BlockName << "'\n"; CurDAG->dump());
|
||||||
|
|
||||||
if (ViewSchedDAGs) CurDAG->viewGraph("scheduler input for " + BlockName);
|
if (ViewSchedDAGs && MatchFilterBB)
|
||||||
|
CurDAG->viewGraph("scheduler input for " + BlockName);
|
||||||
|
|
||||||
// Schedule machine code.
|
// Schedule machine code.
|
||||||
ScheduleDAGSDNodes *Scheduler = CreateScheduler();
|
ScheduleDAGSDNodes *Scheduler = CreateScheduler();
|
||||||
@ -779,7 +794,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
Scheduler->Run(CurDAG, FuncInfo->MBB);
|
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
|
// Emit machine code to BB. This can change 'BB' to the last block being
|
||||||
// inserted into.
|
// inserted into.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user