enforce the proper range for the i386 N constraint.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35319 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-03-25 01:57:35 +00:00
parent 7cd5e07f3d
commit 188b9fe834

View File

@ -4544,16 +4544,17 @@ isOperandValidForConstraint(SDOperand Op, char Constraint, SelectionDAG &DAG) {
switch (Constraint) {
default: break;
case 'I':
if (isa<ConstantSDNode>(Op)) {
unsigned Value = cast<ConstantSDNode>(Op)->getValue();
if (Value <= 31)
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
if (C->getValue() <= 31)
return Op;
else
return SDOperand(0,0);
} else {
return SDOperand(0,0);
}
break;
return SDOperand(0,0);
case 'N':
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
if (C->getValue() <= 255)
return Op;
}
return SDOperand(0,0);
case 'i':
// Literal immediates are always ok.
if (isa<ConstantSDNode>(Op)) return Op;