[llvm-dev] Way to guarantee generated indirect call is via memory?
John Criswell via llvm-dev
llvm-dev at lists.llvm.org
Fri Aug 21 09:28:23 PDT 2015
Dear Eugene,
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.
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.
Regards,
John Criswell
On 8/17/15 6:41 PM, Eugene Rozenfeld via llvm-dev wrote:
>
> I’d like to generate an indirect call instruction that will end up as
> a call via memory and not register.
>
> The address of the target is a constant.
>
> For example, something like
>
> %25 = load i64, i64* @get_Now
>
> %26 = inttoptr i64 %25 to i64 ()*
>
> %27 = call i64 %26()
>
> may end up as
>
> mov rsi,qword ptr [00007FF658381070]
>
> call rsi
>
> or as
>
> call qword ptr [00007FF658381070]
>
> If I want to guarantee that the second form is always used, how would
> I go about that?
>
> One possibility is to use patchpoints
> (http://llvm.org/docs/StackMaps.html#id9). Are there any other
> alternatives?
>
> Eugene
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org http://llvm.cs.uiuc.edu
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150821/990b4f6c/attachment.html>
More information about the llvm-dev
mailing list