[cfe-commits] r169059 - in /cfe/trunk: lib/Basic/Targets.cpp test/CodeGen/arm-asm-warn.c

Bill Wendling isanbard at gmail.com
Fri Nov 30 15:46:56 PST 2012


Author: void
Date: Fri Nov 30 17:46:56 2012
New Revision: 169059

URL: http://llvm.org/viewvc/llvm-project?rev=169059&view=rev
Log:
Don't emit a warning with an input/output parameter. We assume the user knows what they're doing here.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/CodeGen/arm-asm-warn.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=169059&r1=169058&r2=169059&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Nov 30 17:46:56 2012
@@ -3365,6 +3365,7 @@
                                           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 @@
     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;

Modified: cfe/trunk/test/CodeGen/arm-asm-warn.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-asm-warn.c?rev=169059&r1=169058&r2=169059&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/arm-asm-warn.c (original)
+++ cfe/trunk/test/CodeGen/arm-asm-warn.c Fri Nov 30 17:46:56 2012
@@ -8,6 +8,10 @@
                    "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>





More information about the cfe-commits mailing list