<div dir="ltr">Hi Thomas,<div><br></div><div>That syntax is expressing a ConstantExpr of type BitCast.</div><div><br></div><div>I echo Jeremy's comment that the textual IR isn't meant to be parsed by non-LLVM tools - you'd have much better stability using bitcode instead, which has a backwards-compatibility guarantee.</div><div><br></div><div>Cheers,</div><div><br></div><div>James</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 13 Jul 2015 at 13:35 Jeremy Lakeman <<a href="mailto:Jeremy.Lakeman@gmail.com">Jeremy.Lakeman@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Textual LLVM IR is not guaranteed to be stable between versions. Even LLVM's parser is not guaranteed to be backwards compatible.<br><br></div>There was/is a move afoot to remove types from pointers, so explicit bitcasts are no longer required or used. Instead each instruction that uses a pointer will also take a type parameter for that pointer.<br><br></div>Casts that don't change the value, don't result in machine instructions anyway.<br><br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 13, 2015 at 9:16 PM, Thomas Ströder <span dir="ltr"><<a href="mailto:stroeder@informatik.rwth-aachen.de" target="_blank">stroeder@informatik.rwth-aachen.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear all,<br>
<br>
I just stumbled over the following instruction in the LLVM IR of a C<br>
program compiled with clang:<br>
<br>
%26 = call i32 (...)* bitcast (i32 (i32, i32, i32, i32, i32)*<br>
@KeWaitForSingleObject to i32 (...)*)(i32 %23, i32 %24, i32 %25, i32 0,<br>
i32 0)<br>
<br>
Since our LLVM Parser choked on this instruction, I tried to check the<br>
documentation, but did not find anything about such nested bitcasts<br>
within calls. What is the exact syntax and semantics (while I can guess<br>
the latter, especially the former is interesting for me when building a<br>
parser for LLVM IR) for such instructions and/or where is this<br>
documented? In particular, the parantheses around the arguments of the<br>
bitcast are confusing me.<br>
<br>
Alternatively, is there a way to tell clang not to inline such bitcasts,<br>
but have them in a separate instruction before and use the result in the<br>
call?<br>
<br>
Best regards,<br>
<br>
  Thomas<br>
<span><font color="#888888"><br>
<br>
--<br>
Thomas Ströder        mailto:<a href="mailto:stroeder@informatik.rwth-aachen.de" target="_blank">stroeder@informatik.rwth-aachen.de</a><br>
LuFG Informatik 2     <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__verify.rwth-2Daachen.de_stroeder&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=6drm1kA9bTnON-PUHJYeus9Hrihu1CUkeWU81YdAJRU&s=D6tPQqOTGpv0s0KRdAiiNWkQ8M5n7NWhgEnD0xxxD84&e=" rel="noreferrer" target="_blank">http://verify.rwth-aachen.de/stroeder</a><br>
RWTH Aachen           phone: <a href="tel:%2B49%20241%2080-21241" value="+492418021241" target="_blank">+49 241 80-21241</a><br>
<br>
</font></span><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div>