[cfe-commits] r114253 - in /cfe/trunk: lib/Basic/TargetInfo.cpp lib/CodeGen/CGStmt.cpp test/CodeGen/asm-inout.c test/Parser/asm-constraints-pr7869.c
John Thompson
John.Thompson.JTSoftware at gmail.com
Fri Sep 17 18:15:13 PDT 2010
Author: jtsoftware
Date: Fri Sep 17 20:15:13 2010
New Revision: 114253
URL: http://llvm.org/viewvc/llvm-project?rev=114253&view=rev
Log:
Added '|' delimiter to separate inline asm multiple alternative constraints for Clang side of support.
Modified:
cfe/trunk/lib/Basic/TargetInfo.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/test/CodeGen/asm-inout.c
cfe/trunk/test/Parser/asm-constraints-pr7869.c
Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=114253&r1=114252&r2=114253&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Fri Sep 17 20:15:13 2010
@@ -295,9 +295,8 @@
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.
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=114253&r1=114252&r2=114253&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Fri Sep 17 20:15:13 2010
@@ -861,14 +861,11 @@
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 @@
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";
Modified: cfe/trunk/test/CodeGen/asm-inout.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asm-inout.c?rev=114253&r1=114252&r2=114253&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/asm-inout.c (original)
+++ cfe/trunk/test/CodeGen/asm-inout.c Fri Sep 17 20:15:13 2010
@@ -17,3 +17,15 @@
// 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"
+ );
+}
Modified: cfe/trunk/test/Parser/asm-constraints-pr7869.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/asm-constraints-pr7869.c?rev=114253&r1=114252&r2=114253&view=diff
==============================================================================
--- cfe/trunk/test/Parser/asm-constraints-pr7869.c (original)
+++ cfe/trunk/test/Parser/asm-constraints-pr7869.c Fri Sep 17 20:15:13 2010
@@ -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;
More information about the cfe-commits
mailing list