<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Dear Eugene,<br>
<br>
I think the best way to do this is to generate inline assembly
code at the LLVM IR level that uses the memory-based addressing
mode that you want. Any other approach could break with
changes/enhancements to the LLVM code generator.<br>
<br>
The only other way to do this is to write an LLVM
MachineFunctionPass, but that is probably overkill for what you're
trying to do.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<br>
On 8/17/15 6:41 PM, Eugene Rozenfeld via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:BLUPR03MB18140F0EF1E8165741B331591790@BLUPR03MB181.namprd03.prod.outlook.com"
type="cite">
<meta http-equiv="Context-Type" content="text/html;
charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<div class="WordSection1">
<p class="MsoNormal">I’d like to generate an indirect call
instruction that will end up as a call via memory and not
register.</p>
<p class="MsoNormal">The address of the target is a constant.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">For example, something like</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">%25 = load i64, i64* @get_Now</p>
<p class="MsoNormal">%26 = inttoptr i64 %25 to i64 ()*</p>
<p class="MsoNormal">%27 = call i64 %26()</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">may end up as</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">mov rsi,qword ptr [00007FF658381070]</p>
<p class="MsoNormal">call rsi</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">or as</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">call qword ptr [00007FF658381070]</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">If I want to guarantee that the second form
is always used, how would I go about that?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">One possibility is to use patchpoints (<a
moz-do-not-send="true"
href="http://llvm.org/docs/StackMaps.html#id9">http://llvm.org/docs/StackMaps.html#id9</a>).
Are there any other alternatives?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Eugene</p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell">http://www.cs.rochester.edu/u/criswell</a></pre>
</body>
</html>