Added '|' delimiter to separate inline asm multiple alternative constraints for Clang side of support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114253 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
John Thompson 2010-09-18 01:15:13 +00:00
parent 01add59bc8
commit 2f474ea9ef
4 changed files with 17 additions and 9 deletions

View File

@ -295,9 +295,8 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
Info.setAllowsMemory();
break;
case ',': // multiple alternative constraint. Pass it.
Name++;
// Handle additional optional '=' or '+' modifiers.
if (*Name == '=' || *Name == '+')
if (Name[1] == '=' || Name[1] == '+')
Name++;
break;
case '?': // Disparage slightly code.

View File

@ -861,14 +861,11 @@ 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:
tmp = Target.convertConstraint(*Constraint);
if (Result.find(tmp) == std::string::npos) // Combine unique constraints
Result += tmp;
Result += Target.convertConstraint(*Constraint);
break;
// Ignore these
case '*':
@ -877,8 +874,8 @@ SimplifyConstraint(const char *Constraint, const TargetInfo &Target,
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.
case ',':
Result += "|";
break;
case 'g':
Result += "imr";

View File

@ -17,3 +17,15 @@ void test2() {
// CHECK: store i32 {{%[a-zA-Z0-9\.]+}}, i32* [[REGCALLRESULT]]
asm ("foobar" : "+r"(*foo()));
}
// PR7338
void test3(int *vout, int vin)
{
// CHECK: call void asm "opr $0,$1", "=*r|m|r,r|m|r,~{di},~{dirflag},~{fpsr},~{flags}"
asm(
"opr %[vout],%[vin]"
: [vout] "=r,=m,=r" (*vout)
: [vin] "r,m,r" (vin)
: "edi"
);
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 %s
int a, b, c, d, e, f, g, h, i, j, k, l;