[LLVMdev] want to intercept array dereferences

Jeremy Lakeman Jeremy.Lakeman at gmail.com
Tue Apr 7 23:56:39 PDT 2015


You might be able to match the GEP + load pair and replace with a call.
But, it would depend entirely on how the llvm instructions were generated
and what optimisations have been run.

On Wed, Apr 8, 2015 at 3:54 PM, Gry Gunvor <gry.gunvor at gmail.com> wrote:

> If I understand correctly, LLVM is a *typed* assembly language.  Could
> I just look for a pointer type plus an integer type followed by a
> dereference?  That would catch both a[n] and *(a+n).
> Gry
>
>
> On Tue, Apr 7, 2015 at 10:46 PM, Bruce Hoult <bruce at hoult.org> wrote:
> > Far too late. That would need to be in Clang.
> >
> > On Wed, Apr 8, 2015 at 5:36 PM, Gry Gunvor <gry.gunvor at gmail.com> wrote:
> >>
> >> Normally for int n unknown at static time, "a[n]" and "*(a+n)" results
> >> in an add and then a dereference.  I want instead for it to compile to
> >> a system call that takes two arguments, a and n.  Where should I
> >> intercept this in LLVM?
> >>
> >> Gry
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >
> >
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150408/558f730b/attachment.html>


More information about the llvm-dev mailing list