aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-11-30 23:46:56 +0000
committerBill Wendling <isanbard@gmail.com>2012-11-30 23:46:56 +0000
commit6e6330c07a42ace74637d0ad7356a2fa20de81ec (patch)
treea0455818f5e4307dd595bbdd0fd7a3b20744df3c
parent5a98f1da0e6eb5c4776f513eacc7756eaf15dff3 (diff)
Don't emit a warning with an input/output parameter. We assume the user knows what they're doing here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169059 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Basic/Targets.cpp4
-rw-r--r--test/CodeGen/arm-asm-warn.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 3c076ca4f0..6a30ca8476 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -3365,6 +3365,7 @@ public:
const char Modifier,
unsigned Size) const {
bool isOutput = (Constraint[0] == '=');
+ bool isInOut = (Constraint[0] == '+');
// Strip off constraint modifiers.
while (Constraint[0] == '=' ||
@@ -3377,7 +3378,8 @@ public:
case 'r': {
switch (Modifier) {
default:
- return (isOutput && Size >= 32) || Size <= 32;
+ return isInOut || (isOutput && Size >= 32) ||
+ (!isOutput && !isInOut && Size <= 32);
case 'q':
// A register of size 32 cannot fit a vector type.
return false;
diff --git a/test/CodeGen/arm-asm-warn.c b/test/CodeGen/arm-asm-warn.c
index 38d5345cbd..9b52dd695a 100644
--- a/test/CodeGen/arm-asm-warn.c
+++ b/test/CodeGen/arm-asm-warn.c
@@ -8,6 +8,10 @@ void t1(int x, char y) {
"mrc p15, 0, %0, c9, c13, 2;"
: "=r" (x)
: "r" (bar())); // no warning
+ __asm__ volatile("foo %0, %1"
+ : "+r" (x),
+ "+r" (y)
+ :);
}
// <rdar://problem/12284092>