summaryrefslogtreecommitdiffstats
path: root/clang/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
commit2d5f8b420153625115244d910f2fe597f733eb22 (patch)
treebb2782d1f3b0d82a6c26277606f3ee482b6a417d /clang/lib/Basic/TargetInfo.cpp
parentda1f5fc881ffe970bc3902f474f6b23dff43f7d8 (diff)
downloadbcm5719-llvm-2d5f8b420153625115244d910f2fe597f733eb22.tar.gz
bcm5719-llvm-2d5f8b420153625115244d910f2fe597f733eb22.zip
When setting a tied check if it's already tied. If it's tied to another constraint it's invalid. Fixes PR3905.
llvm-svn: 118146
Diffstat (limited to 'clang/lib/Basic/TargetInfo.cpp')
-rw-r--r--clang/lib/Basic/TargetInfo.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 947cbfc3f6d..1437a4ba015 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud