Adding Ziv, the author of this patch.

From: Chandler Carruth [mailto:chandl...@google.com]
Sent: Thursday, December 29, 2016 11:57
To: Yatsina, Marina <marina.yats...@intel.com>; cfe-commits@lists.llvm.org
Subject: Re: r290539 - [inline-asm]No error for conflict between inputs\outputs 
and clobber list

On Mon, Dec 26, 2016 at 4:34 AM Marina Yatsina via cfe-commits 
<cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>> wrote:
Author: myatsina
Date: Mon Dec 26 06:23:42 2016
New Revision: 290539

URL: http://llvm.org/viewvc/llvm-project?rev=290539&view=rev
Log:
[inline-asm]No error for conflict between inputs\outputs and clobber list

According to extended asm syntax, a case where the clobber list includes a 
variable from the inputs or outputs should be an error - conflict.
for example:

const long double a = 0.0;
int main()
{

char b;
double t1 = a;
__asm__ ("fucompp": "=a" (b) : "u" (t1), "t" (t1) : "cc", "st", "st(1)");

return 0;
}

This should conflict with the output - t1 which is st, and st which is st 
aswell.
The patch fixes it.

Commit on behald of Ziv Izhar.

Differential Revision: https://reviews.llvm.org/D15075


Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/include/clang/Basic/TargetInfo.h
    cfe/trunk/lib/Basic/TargetInfo.cpp
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/lib/Headers/intrin.h
    cfe/trunk/lib/Sema/SemaStmtAsm.cpp
    cfe/trunk/test/Sema/asm.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=290539&r1=290538&r2=290539&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Dec 26 06:23:42 
2016
@@ -7069,6 +7069,10 @@ let CategoryName = "Inline Assembly Issu
     "constraint '%0' is already present here">;
 }

+  def error_inoutput_conflict_with_clobber : Error<
+    "asm-specifier for input or output variable conflicts with asm"
+    " clobber list">;

Clang generally works to avoid this kind of error message. All this does is say 
"there was a problem of this kind" without identifying any of the specifics. 
And for this error in particular I think this is of the utmost importance. 
Developers are not going to understand what went wrong here.

I would suggest at a minimum to enhance this to explain:

1) What operands and clobbers conflict, preferably with source ranges 
underlining them.

2) Why they conflict (for example the fact that "D" means the di register 
group, of which "%rdi" is a member)

Beyond that, I wonder if you could add a note suggesting to remove the clobber 
if the input (or output) operand is sufficient.

You can make this note explain carefully the case where something would need to 
be added to the inputs or outputs instead, but I think it at least makes sense 
to clarify that this will be a common fix and what to look out for that might 
make it an incorrect fix.
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to