diff options
author | Chris Lattner <sabre@nondot.org> | 2005-01-16 02:23:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-01-16 02:23:22 +0000 |
commit | 4e550ebb38bc2ed6d95f0ded4d9ebb705a1011fa (patch) | |
tree | f440c5733c685d81f4d042081ae1dc4c45e982cf /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 209f58503377534d445914764d47faa4924ffa21 (diff) | |
download | bcm5719-llvm-4e550ebb38bc2ed6d95f0ded4d9ebb705a1011fa.tar.gz bcm5719-llvm-4e550ebb38bc2ed6d95f0ded4d9ebb705a1011fa.zip |
Add assertions.
llvm-svn: 19596
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index d3d44a82e08..a8e383060f0 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -543,6 +543,37 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, SDOperand N1, SDOperand N2) { +#ifndef NDEBUG + switch (Opcode) { + case ISD::AND: + case ISD::OR: + case ISD::XOR: + case ISD::UDIV: + case ISD::UREM: + assert(MVT::isInteger(VT) && "This operator does not apply to FP types!"); + // fall through + case ISD::ADD: + case ISD::SUB: + case ISD::MUL: + case ISD::SDIV: + case ISD::SREM: + assert(N1.getValueType() == N2.getValueType() && + N1.getValueType() == VT && "Binary operator types must match!"); + break; + + case ISD::SHL: + case ISD::SRA: + case ISD::SRL: + assert(VT == N1.getValueType() && + "Shift operators return type must be the same as their first arg"); + assert(MVT::isInteger(VT) && MVT::isInteger(N2.getValueType()) && + "Shifts only work on integers"); + assert(VT >= MVT::i8 && "Shift amount cannot be a MVT::i1"); + break; + default: break; + } +#endif + ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1.Val); ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N2.Val); if (N1C) { |