aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-01-11 19:46:50 +0000
committerAnders Carlsson <andersca@mac.com>2009-01-11 19:46:50 +0000
commit2763b3af0a527c3a63cb058b90c22db0b7bcf558 (patch)
treefbd528e5ab8ebe32ce0f772e024e055af70002a7
parentc8c7b187adcd989e01a9fba1ebead6c2abd770c9 (diff)
Handle readwrite constraints correctly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62043 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGStmt.cpp3
-rw-r--r--test/CodeGen/asm.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 8d80a498b4..bee40e5c28 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -944,9 +944,10 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
const Expr *InputExpr = S.getOutputExpr(i);
llvm::Value *Arg = EmitAsmInput(S, Info, InputExpr, InOutConstraints);
+ InOutConstraints += llvm::utostr(Args.size());
+
InOutArgTypes.push_back(Arg->getType());
InOutArgs.push_back(Arg);
- InOutConstraints += OutputConstraint;
}
}
diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c
new file mode 100644
index 0000000000..d6fbf77408
--- /dev/null
+++ b/test/CodeGen/asm.c
@@ -0,0 +1,5 @@
+// RUN: clang %s -arch=i386 -verify -fsyntax-only
+void f(int len)
+{
+ __asm__ volatile("" :"=&r"(len), "+&r"(len));
+}