]> granicus.if.org Git - clang/commitdiff
Added '|' delimiter to separate inline asm multiple alternative constraints for Clang...
authorJohn Thompson <John.Thompson.JTSoftware@gmail.com>
Sat, 18 Sep 2010 01:15:13 +0000 (01:15 +0000)
committerJohn Thompson <John.Thompson.JTSoftware@gmail.com>
Sat, 18 Sep 2010 01:15:13 +0000 (01:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114253 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/TargetInfo.cpp
lib/CodeGen/CGStmt.cpp
test/CodeGen/asm-inout.c
test/Parser/asm-constraints-pr7869.c

index c7036bfd049daa5fcf0c88298f48f18c9d78e4e5..c7176413e0fc2e2301ffb149a9ecbe75ee3982a5 100644 (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.
index a70534d2ca3efc60ddf88fb0bae56e41d678e43e..e83bea6d586432ecb1fefcf0dd6b94690270671a 100644 (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";
index f04276693e2c1c1755b50babb46fe63a8652490a..5b0a5f7ef16adbe7297ae580e58159dca961a60d 100644 (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"
+               );
+}
index d6f1725f1a8448d574ccdce0c7c6e1afeb6f0543..db369911cf8c671fd245c3a61ede495f88b6fe4f 100644 (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;