<div dir="ltr">You might be able to match the GEP + load pair and replace with a call. <div>But, it would depend entirely on how the llvm instructions were generated and what optimisations have been run.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 8, 2015 at 3:54 PM, Gry Gunvor <span dir="ltr"><<a href="mailto:gry.gunvor@gmail.com" target="_blank">gry.gunvor@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If I understand correctly, LLVM is a *typed* assembly language.  Could<br>
I just look for a pointer type plus an integer type followed by a<br>
dereference?  That would catch both a[n] and *(a+n).<br>
<span class="HOEnZb"><font color="#888888">Gry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On Tue, Apr 7, 2015 at 10:46 PM, Bruce Hoult <<a href="mailto:bruce@hoult.org">bruce@hoult.org</a>> wrote:<br>
> Far too late. That would need to be in Clang.<br>
><br>
> On Wed, Apr 8, 2015 at 5:36 PM, Gry Gunvor <<a href="mailto:gry.gunvor@gmail.com">gry.gunvor@gmail.com</a>> wrote:<br>
>><br>
>> Normally for int n unknown at static time, "a[n]" and "*(a+n)" results<br>
>> in an add and then a dereference.  I want instead for it to compile to<br>
>> a system call that takes two arguments, a and n.  Where should I<br>
>> intercept this in LLVM?<br>
>><br>
>> Gry<br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div>