Basic: [asmSymbolicName] follows the same rule as numbers in asm inputs

Input constraints like "0" and "[foo]" should be treated the same when
it comes to their corresponding output constraint.

This fixes PR21850.

llvm-svn: 225605
This commit is contained in:
David Majnemer 2015-01-11 09:57:13 +00:00
parent e38b24a72b
commit 55164f901b
2 changed files with 11 additions and 0 deletions

View File

@ -583,6 +583,10 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
if (Info.hasTiedOperand() && Info.getTiedOperand() != Index)
return false;
// A number must refer to an output only operand.
if (OutputConstraints[Index].isReadWrite())
return false;
Info.setTiedOperand(Index, OutputConstraints[Index]);
break;
}

View File

@ -190,3 +190,10 @@ void fn4() {
: "=r"(l)
: "#m"(l)); // expected-error {{invalid input constraint '#m' in asm}}
}
void fn5() {
int l;
__asm__(""
: [g] "+r"(l)
: "[g]"(l)); // expected-error {{invalid input constraint '[g]' in asm}}
}