diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2012-10-29 12:20:54 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2012-10-29 12:20:54 +0000 |
commit | 7bcc7ec745b03fc864bea0272879476e8c068950 (patch) | |
tree | f1846d10ff5f130e7751cd5db5659392910511d9 /clang | |
parent | 59f464661470a320a4c8a51258cf51758e3aac7e (diff) | |
download | bcm5719-llvm-7bcc7ec745b03fc864bea0272879476e8c068950.tar.gz bcm5719-llvm-7bcc7ec745b03fc864bea0272879476e8c068950.zip |
Handle '*' and '#' asm constraint modifiers.
llvm-svn: 166924
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Basic/TargetInfo.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGen/asm.c | 9 |
3 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp index b89b18b3aea..3257526289e 100644 --- a/clang/lib/Basic/TargetInfo.cpp +++ b/clang/lib/Basic/TargetInfo.cpp @@ -364,6 +364,8 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const { break; case '?': // Disparage slightly code. case '!': // Disparage severely. + case '#': // Ignore as constraint. + case '*': // Ignore for choosing register preferences. break; // Pass them. } @@ -483,6 +485,8 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints, break; case '?': // Disparage slightly code. case '!': // Disparage severely. + case '#': // Ignore as constraint. + case '*': // Ignore for choosing register preferences. break; // Pass them. } diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 5c1fea4472f..3548dbac6fc 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -1280,6 +1280,10 @@ SimplifyConstraint(const char *Constraint, const TargetInfo &Target, case '=': // Will see this and the following in mult-alt constraints. case '+': break; + case '#': // Ignore the rest of the constraint alternative. + while (Constraint[1] && Constraint[1] != ',') + Constraint++; + break; case ',': Result += "|"; break; diff --git a/clang/test/CodeGen/asm.c b/clang/test/CodeGen/asm.c index b0097368ec2..670c24405d3 100644 --- a/clang/test/CodeGen/asm.c +++ b/clang/test/CodeGen/asm.c @@ -230,3 +230,12 @@ void t27(void) { // CHECK-NOT: ia_nsdialect // CHECK: ret void } + +// Check handling of '*' and '#' constraint modifiers. +void t28(void) +{ + asm volatile ("/* %0 */" : : "i#*X,*r" (1)); +// CHECK: @t28 +// CHECK: call void asm sideeffect "/* $0 */", "i|r,~{dirflag},~{fpsr},~{flags}"(i32 1) +} + |