diff options
author | Duncan Sands <baldrick@free.fr> | 2008-11-24 14:53:14 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-11-24 14:53:14 +0000 |
commit | 25cf2275ff7de3de3bc0e508abaf457413d74725 (patch) | |
tree | 9cedfc835e90686a918a93c805e119b187702bed /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
parent | 19ea77f09d7226d4515b67e72be2f7b4dfee36dd (diff) |
If the type legalizer actually legalized anything
(this doesn't happen that often, since most code
does not use illegal types) then follow it by a
DAG combiner run that is allowed to generate
illegal operations but not illegal types. I didn't
modify the target combiner code to distinguish like
this between illegal operations and illegal types,
so it will not produce illegal operations as well
as not producing illegal types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 079e95f25b..3d2fb34626 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -88,6 +88,10 @@ ViewDAGCombine2("view-dag-combine2-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the second " "dag combine pass")); static cl::opt<bool> +ViewDAGCombineLT("view-dag-combine-lt-dags", cl::Hidden, + cl::desc("Pop up a window to show dags before the post legalize types" + " dag combine pass")); +static cl::opt<bool> ViewISelDAGs("view-isel-dags", cl::Hidden, cl::desc("Pop up a window to show isel dags as they are selected")); static cl::opt<bool> @@ -100,6 +104,7 @@ ViewSUnitDAGs("view-sunit-dags", cl::Hidden, static const bool ViewDAGCombine1 = false, ViewLegalizeTypesDAGs = false, ViewLegalizeDAGs = false, ViewDAGCombine2 = false, + ViewDAGCombineLT = false, ViewISelDAGs = false, ViewSchedDAGs = false, ViewSUnitDAGs = false; #endif @@ -556,7 +561,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() { GroupName = "Instruction Selection and Scheduling"; std::string BlockName; if (ViewDAGCombine1 || ViewLegalizeTypesDAGs || ViewLegalizeDAGs || - ViewDAGCombine2 || ViewISelDAGs || ViewSchedDAGs || ViewSUnitDAGs) + ViewDAGCombine2 || ViewDAGCombineLT || ViewISelDAGs || ViewSchedDAGs || + ViewSUnitDAGs) BlockName = CurDAG->getMachineFunction().getFunction()->getName() + ':' + BB->getBasicBlock()->getName(); @@ -568,9 +574,9 @@ void SelectionDAGISel::CodeGenAndEmitDAG() { // Run the DAG combiner in pre-legalize mode. if (TimePassesIsEnabled) { NamedRegionTimer T("DAG Combining 1", GroupName); - CurDAG->Combine(false, *AA, Fast); + CurDAG->Combine(Unrestricted, *AA, Fast); } else { - CurDAG->Combine(false, *AA, Fast); + CurDAG->Combine(Unrestricted, *AA, Fast); } DOUT << "Optimized lowered selection DAG:\n"; @@ -582,17 +588,32 @@ void SelectionDAGISel::CodeGenAndEmitDAG() { if (ViewLegalizeTypesDAGs) CurDAG->viewGraph("legalize-types input for " + BlockName); + bool Changed; if (TimePassesIsEnabled) { NamedRegionTimer T("Type Legalization", GroupName); - CurDAG->LegalizeTypes(); + Changed = CurDAG->LegalizeTypes(); } else { - CurDAG->LegalizeTypes(); + Changed = CurDAG->LegalizeTypes(); } DOUT << "Type-legalized selection DAG:\n"; DEBUG(CurDAG->dump()); - // TODO: enable a dag combine pass here. + if (Changed) { + if (ViewDAGCombineLT) + CurDAG->viewGraph("dag-combine-lt input for " + BlockName); + + // Run the DAG combiner in post-type-legalize mode. + if (TimePassesIsEnabled) { + NamedRegionTimer T("DAG Combining after legalize types", GroupName); + CurDAG->Combine(NoIllegalTypes, *AA, Fast); + } else { + CurDAG->Combine(NoIllegalTypes, *AA, Fast); + } + + DOUT << "Optimized type-legalized selection DAG:\n"; + DEBUG(CurDAG->dump()); + } } if (ViewLegalizeDAGs) CurDAG->viewGraph("legalize input for " + BlockName); @@ -612,9 +633,9 @@ void SelectionDAGISel::CodeGenAndEmitDAG() { // Run the DAG combiner in post-legalize mode. if (TimePassesIsEnabled) { NamedRegionTimer T("DAG Combining 2", GroupName); - CurDAG->Combine(true, *AA, Fast); + CurDAG->Combine(NoIllegalOperations, *AA, Fast); } else { - CurDAG->Combine(true, *AA, Fast); + CurDAG->Combine(NoIllegalOperations, *AA, Fast); } DOUT << "Optimized legalized selection DAG:\n"; |