Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Kevin Modzelewski <kmod <at> dropbox.com>
Subject: Re: Inlining native functions during JIT compilation
Newsgroups: gmane.comp.compilers.llvm.devel
Date: Monday 6th January 2014 23:40:47 UTC (over 3 years ago)
If all your IR is in a single module, and you're willing to reoptimize the
entire module every time you want to do inlining, you can use the existing
machinery pretty easily.

But unless those are both true, the situation is more complicated: my
understanding is the inlining machinery (at least for non-builtins, not
sure how those work) assumes that 1) you're inlining functions from the
same module, and 2) you're optimizing an entire module at a time.  I ended
up writing a custom inlining FunctionPass: I initialize an
InlineCostAnalysis object (which ends up being quite hacky since it expects
to be part of a passmanager even though that's not what we want here), use
that to determine when to inline, call llvm::InlineFunction() when it says
I should, and then use a custom ValueMaterializer to remap references from
objects in the other module (ex global variables, function declarations,
etc) to the correct references in the current module.


On Mon, Jan 6, 2014 at 9:46 AM, Timothy Baldridge
wrote:

> Let's say I'm using LLVM to JIT compile a function. Inside that function
I
> make a call to a runtime method in a currently loaded library. Is there
any
> way to get LLVM to inline that function call?
>
> As an example, let's say my jitted function calls memcpy, can I get
> memcpy's body inlined somehow? Or can that only be done via lto and aot
> compilation?
>
> Thanks,
>
> Timothy Baldridge
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev@cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
 
CD: 4ms