aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/TargetInfo.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-11-03 02:54:51 +0000
committerAnders Carlsson <andersca@mac.com>2010-11-03 02:54:51 +0000
commit79ca1ee4b637c01458584bb571f1b309180c780d (patch)
tree7a8af4f17c412bc6ef43d7d0a0340076a64d3b92 /lib/Basic/TargetInfo.cpp
parent86eda39c8af47280273758debf0432933bdeee3c (diff)
When setting a tied check if it's already tied. If it's tied to another constraint it's invalid. Fixes PR3905.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118146 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/TargetInfo.cpp')
-rw-r--r--lib/Basic/TargetInfo.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index 947cbfc3f6..1437a4ba01 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -354,6 +354,11 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
if (OutputConstraints[i].isReadWrite())
return false;
+ // If the constraint is already tied, it must be tied to the
+ // same operand referenced to by the number.
+ if (Info.hasTiedOperand() && Info.getTiedOperand() != i)
+ return false;
+
// The constraint should have the same info as the respective
// output constraint.
Info.setTiedOperand(i, OutputConstraints[i]);
@@ -369,6 +374,11 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
if (!resolveSymbolicName(Name, OutputConstraints, NumOutputs, Index))
return false;
+ // If the constraint is already tied, it must be tied to the
+ // same operand referenced to by the number.
+ if (Info.hasTiedOperand() && Info.getTiedOperand() != Index)
+ return false;
+
Info.setTiedOperand(Index, OutputConstraints[Index]);
break;
}