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/LegalizeTypes.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/LegalizeTypes.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypes.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp index 6876e9f94f..9502b27be1 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp @@ -20,8 +20,11 @@ using namespace llvm; /// 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() { +/// top-down traversal of the dag, legalizing types as it goes. Returns "true" +/// if it made any changes. +bool DAGTypeLegalizer::run() { + bool Changed = false; + // Create a dummy node (which is not added to allnodes), that adds a reference // to the root node, preventing it from being deleted, and tracking any // changes of the root. @@ -65,21 +68,27 @@ void DAGTypeLegalizer::run() { break; case PromoteInteger: PromoteIntegerResult(N, i); + Changed = true; goto NodeDone; case ExpandInteger: ExpandIntegerResult(N, i); + Changed = true; goto NodeDone; case SoftenFloat: SoftenFloatResult(N, i); + Changed = true; goto NodeDone; case ExpandFloat: ExpandFloatResult(N, i); + Changed = true; goto NodeDone; case ScalarizeVector: ScalarizeVectorResult(N, i); + Changed = true; goto NodeDone; case SplitVector: SplitVectorResult(N, i); + Changed = true; goto NodeDone; } } @@ -103,21 +112,27 @@ ScanOperands: continue; case PromoteInteger: NeedsRevisit = PromoteIntegerOperand(N, i); + Changed = true; break; case ExpandInteger: NeedsRevisit = ExpandIntegerOperand(N, i); + Changed = true; break; case SoftenFloat: NeedsRevisit = SoftenFloatOperand(N, i); + Changed = true; break; case ExpandFloat: NeedsRevisit = ExpandFloatOperand(N, i); + Changed = true; break; case ScalarizeVector: NeedsRevisit = ScalarizeVectorOperand(N, i); + Changed = true; break; case SplitVector: NeedsRevisit = SplitVectorOperand(N, i); + Changed = true; break; } break; @@ -216,6 +231,8 @@ NodeDone: } } #endif + + return Changed; } /// AnalyzeNewNode - The specified node is the root of a subtree of potentially @@ -727,10 +744,11 @@ void DAGTypeLegalizer::GetSplitDestVTs(MVT InVT, MVT &LoVT, MVT &HiVT) { //===----------------------------------------------------------------------===// /// LegalizeTypes - This transforms the SelectionDAG into a SelectionDAG that -/// only uses types natively supported by the target. +/// only uses types natively supported by the target. Returns "true" if it made +/// any changes. /// /// Note that this is an involved process that may invalidate pointers into /// the graph. -void SelectionDAG::LegalizeTypes() { - DAGTypeLegalizer(*this).run(); +bool SelectionDAG::LegalizeTypes() { + return DAGTypeLegalizer(*this).run(); } |