diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Basic/TargetInfo.cpp | 20 | ||||
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 10 |
2 files changed, 25 insertions, 5 deletions
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index 7fcf372a36..05db02a9fe 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -287,8 +287,17 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const { Info.setAllowsRegister(); Info.setAllowsMemory(); break; - case ',': // FIXME: Until we handle multiple alternative constraints, - return true; // ignore everything after the first comma. + case ',': // multiple alternative constraint. Pass it. + Name++; + // An output constraint must start with '=' or '+' + if (*Name != '=' && *Name != '+') + return false; + if (*Name == '+') + Info.setIsReadWrite(); + break; + case '?': // Disparage slightly code. + case '!': // Disparage severly. + break; // Pass them. } Name++; @@ -382,8 +391,11 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints, Info.setAllowsRegister(); Info.setAllowsMemory(); break; - case ',': // FIXME: Until we handle multiple alternative constraints, - return true; // ignore everything after the first comma. + case ',': // multiple alternative constraint. Ignore comma. + break; + case '?': // Disparage slightly code. + case '!': // Disparage severly. + break; // Pass them. } Name++; diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 3bbecfa59c..6dad8597a8 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -861,16 +861,24 @@ static std::string SimplifyConstraint(const char *Constraint, const TargetInfo &Target, llvm::SmallVectorImpl<TargetInfo::ConstraintInfo> *OutCons=0) { std::string Result; + std::string tmp; while (*Constraint) { switch (*Constraint) { default: - Result += Target.convertConstraint(*Constraint); + tmp = Target.convertConstraint(*Constraint); + if (Result.find(tmp) == std::string::npos) // Combine unique constraints + Result += tmp; break; // Ignore these case '*': case '?': case '!': + case '=': // Will see this and the following in mult-alt constraints. + case '+': + break; + case ',': // FIXME - Until the back-end properly supports + return Result; // multiple alternative constraints, we stop here. break; case 'g': Result += "imr"; |