summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-02-25 16:21:21 +0000
committerDuncan Sands <baldrick@free.fr>2008-02-25 16:21:21 +0000
commit896c519d195dd40db492a5b4941301f0fd12a70b (patch)
treec2d1d922210a737806c8580371a24ac4067d4779 /llvm/lib
parent589a9fb6dcfc7b9aa492af7a60f7b2882dd8fed6 (diff)
downloadbcm5719-llvm-896c519d195dd40db492a5b4941301f0fd12a70b.tar.gz
bcm5719-llvm-896c519d195dd40db492a5b4941301f0fd12a70b.zip
In debug builds check that the key property holds: all
result and operand types are legal. llvm-svn: 47546
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
index 3d419552826..7497ba2c8de 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -173,18 +173,36 @@ NodeDone:
#ifndef NDEBUG
for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
E = DAG.allnodes_end(); I != E; ++I) {
- if (I->getNodeId() == Processed)
- continue;
- cerr << "Unprocessed node: ";
- I->dump(&DAG); cerr << "\n";
-
- if (I->getNodeId() == NewNode)
- cerr << "New node not 'noticed'?\n";
- else if (I->getNodeId() > 0)
- cerr << "Operand not processed?\n";
- else if (I->getNodeId() == ReadyToProcess)
- cerr << "Not added to worklist?\n";
- abort();
+ bool Failed = false;
+
+ // Check that all result types are legal.
+ for (unsigned i = 0, NumVals = I->getNumValues(); i < NumVals; ++i)
+ if (!isTypeLegal(I->getValueType(i))) {
+ cerr << "Result type " << i << " illegal!\n";
+ Failed = true;
+ }
+
+ // Check that all operand types are legal.
+ for (unsigned i = 0, NumOps = I->getNumOperands(); i < NumOps; ++i)
+ if (!isTypeLegal(I->getOperand(i).getValueType())) {
+ cerr << "Operand type " << i << " illegal!\n";
+ Failed = true;
+ }
+
+ if (I->getNodeId() != Processed) {
+ if (I->getNodeId() == NewNode)
+ cerr << "New node not 'noticed'?\n";
+ else if (I->getNodeId() > 0)
+ cerr << "Operand not processed?\n";
+ else if (I->getNodeId() == ReadyToProcess)
+ cerr << "Not added to worklist?\n";
+ Failed = true;
+ }
+
+ if (Failed) {
+ I->dump(&DAG); cerr << "\n";
+ abort();
+ }
}
#endif
}
OpenPOWER on IntegriCloud