r183209 - Rephrase asm_mismatched_size_modifier diagnostic. <rdar://problem/14050339>

Bob Wilson bob.wilson at apple.com
Mon Jun 3 23:10:09 PDT 2013


Author: bwilson
Date: Tue Jun  4 01:10:09 2013
New Revision: 183209

URL: http://llvm.org/viewvc/llvm-project?rev=183209&view=rev
Log:
Rephrase asm_mismatched_size_modifier diagnostic. <rdar://problem/14050339>

The text of this diagnostic was unnecessarily specific to the current ARM
implementation of validateConstraintModifier, and it gave a potentially
confusing suggestion for fixing the problem. The ARM-specific issue is not
a big deal since that is the only target that currently does any checking of
asm operand modifiers, but until my change in 183172 it was still wrong for
output operands in the way that it referred to the value being truncated when
put into a register, since output operands are retrieved from the registers
instead of being put into them. The bigger problem is that its suggestion to
"use a modifier" is wrong and confusing in the case where a "q" modifier is
incorrectly used with an "r" constraint. In that case, the solution might
well be to remove the modifier or perhaps change the constraint. It's better
to just leave the diagnostic message more generic.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/test/CodeGen/arm-asm-diag.c
    cfe/trunk/test/CodeGen/arm-asm-warn.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=183209&r1=183208&r2=183209&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jun  4 01:10:09 2013
@@ -5496,8 +5496,8 @@ let CategoryName = "Inline Assembly Issu
     "accepted due to -fheinous-gnu-extensions, but clang may remove support "
     "for this in the future">;
   def warn_asm_mismatched_size_modifier : Warning<
-    "the value is truncated when put into register, "
-    "use a modifier to specify the size">,
+    "value size does not match register size specified by the constraint "
+    "and modifier">,
     InGroup<ASMOperandWidths>;
 }
 

Modified: cfe/trunk/test/CodeGen/arm-asm-diag.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-asm-diag.c?rev=183209&r1=183208&r2=183209&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/arm-asm-diag.c (original)
+++ cfe/trunk/test/CodeGen/arm-asm-diag.c Tue Jun  4 01:10:09 2013
@@ -9,10 +9,10 @@ typedef struct int64x2x4_t {
 int64x2x4_t t1(const long long a[]) {
   int64x2x4_t r;
   __asm__("vldm %[a], { %q[r0], %q[r1], %q[r2], %q[r3] }"
-          : [r0] "=r"(r.val[0]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}}
-            [r1] "=r"(r.val[1]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}}
-            [r2] "=r"(r.val[2]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}}
-            [r3] "=r"(r.val[3])  // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}}
+          : [r0] "=r"(r.val[0]), // expected-warning {{value size does not match register size specified by the constraint and modifier}}
+            [r1] "=r"(r.val[1]), // expected-warning {{value size does not match register size specified by the constraint and modifier}}
+            [r2] "=r"(r.val[2]), // expected-warning {{value size does not match register size specified by the constraint and modifier}}
+            [r3] "=r"(r.val[3])  // expected-warning {{value size does not match register size specified by the constraint and modifier}}
           : [a] "r"(a));
   return r;
 }

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=183209&r1=183208&r2=183209&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/arm-asm-warn.c (original)
+++ cfe/trunk/test/CodeGen/arm-asm-warn.c Tue Jun  4 01:10:09 2013
@@ -23,10 +23,10 @@ typedef struct int64x2x4_t {
 int64x2x4_t t2(const long long a[]) {
   int64x2x4_t r;
   __asm__("vldm %[a], { %q[r0], %q[r1], %q[r2], %q[r3] }"
-          : [r0] "=r"(r.val[0]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}}
-            [r1] "=r"(r.val[1]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}}
-            [r2] "=r"(r.val[2]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}}
-            [r3] "=r"(r.val[3])  // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}}
+          : [r0] "=r"(r.val[0]), // expected-warning {{value size does not match register size specified by the constraint and modifier}}
+            [r1] "=r"(r.val[1]), // expected-warning {{value size does not match register size specified by the constraint and modifier}}
+            [r2] "=r"(r.val[2]), // expected-warning {{value size does not match register size specified by the constraint and modifier}}
+            [r3] "=r"(r.val[3])  // expected-warning {{value size does not match register size specified by the constraint and modifier}}
           : [a] "r"(a));
   return r;
 }





More information about the cfe-commits mailing list