Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3709)

Issue 166075: [PATCH] New external2availableexternally pass (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 5 months ago by Jeffrey Yasskin
Modified:
14 years ago
Reviewers:
CC:
llvm-commits_cs.uiuc.edu
Base URL:
https://llvm.org/svn/llvm-project/llvm/trunk/
Visibility:
Public.

Description

When we have a runtime library, it's useful to expose that library to the optimizers, but it's bad to ask LLVM to actually codegen the library's code a second time. This pass name is uncomfortably long. I'd be happy to accept any suggestions for the name.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+141 lines, -0 lines) Patch
M docs/Passes.html View 2 chunks +14 lines, -0 lines 0 comments Download
M include/llvm/LinkAllPasses.h View 1 chunk +1 line, -0 lines 0 comments Download
M include/llvm/Transforms/IPO.h View 1 chunk +6 lines, -0 lines 0 comments Download
A lib/Transforms/IPO/External2Available.cpp View 1 chunk +66 lines, -0 lines 0 comments Download
A test/Transforms/External2Available/2009-12-05-AllExternals.ll View 1 chunk +51 lines, -0 lines 0 comments Download
A test/Transforms/External2Available/dg.exp View 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 8
Jeffrey Yasskin
Please take a look: http://codereview.appspot.com/download/issue166075_1.diff
14 years, 5 months ago (2009-12-05 22:57:23 UTC) #1
baldrick_free.fr
Hi, > When we have a runtime library, it's useful to expose that library to ...
14 years, 5 months ago (2009-12-06 08:35:56 UTC) #2
Jeffrey Yasskin
On Sun, Dec 6, 2009 at 12:35 AM, Duncan Sands <baldrick@free.fr> wrote: > Hi, > ...
14 years, 5 months ago (2009-12-06 10:32:07 UTC) #3
Jeffrey Yasskin (google)
Anyone have comments? On Sun, Dec 6, 2009 at 2:32 AM, Jeffrey Yasskin <jyasskin@gmail.com> wrote: ...
14 years, 5 months ago (2009-12-07 19:52:18 UTC) #4
eli.friedman_gmail.com
On Mon, Dec 7, 2009 at 11:52 AM, Jeffrey Yasskin <jyasskin@google.com> wrote: > Anyone have ...
14 years, 5 months ago (2009-12-07 20:15:36 UTC) #5
clattner_apple.com
On Dec 7, 2009, at 11:52 AM, Jeffrey Yasskin wrote: > Anyone have comments? Who ...
14 years, 5 months ago (2009-12-07 20:59:08 UTC) #6
Jeffrey Yasskin (google)
On Mon, Dec 7, 2009 at 12:59 PM, Chris Lattner <clattner@apple.com> wrote: > > On ...
14 years, 5 months ago (2009-12-07 21:06:19 UTC) #7
Jeffrey Yasskin (google)
14 years, 5 months ago (2009-12-08 00:14:54 UTC) #8
On Mon, Dec 7, 2009 at 1:06 PM, Jeffrey Yasskin <jyasskin@google.com> wrote:
> On Mon, Dec 7, 2009 at 12:59 PM, Chris Lattner <clattner@apple.com> wrote:
>>
>> On Dec 7, 2009, at 11:52 AM, Jeffrey Yasskin wrote:
>>
>>> Anyone have comments?
>>
>> Who are the expected clients of this?  It seems pretty special purpose to go
into mainline.
>
> People writing JITs are likely to use it to provide definitions of
> their runtime library functions. Static compilers could use it too if
> they ship with a compiled runtime but also want to be able to inline
> bits of the runtime into their output, without making those bits
> builtins.

That is, take the author of a new language.
1. They write a compiler, taking their language to IR.
2. They write a standard library, which they'll ship with their
compiler. To make compilation fast, they generate native code from the
library and install it with their compiler.
3. They notice that calls into their standard library could benefit
from inlining. There are two things they could do here:
  a. Don't install native code; instead install .bc files. Load those
into the module of each translation unit. This means that for stdlib
calls that aren't inlined, every compilation needs to generate code.
That's especially problematic for a JIT, but also wastes time for a
static compiler.
  b. Generate a .bc file with the library functions defined, but
marked available_externally. This lets the optimizers inline the
definitions, but non-inlined definitions just call out to the
pre-compiled native code.

3b is the tactic this pass is designed for. The language author uses it like:
1. Write the compiler.
2. Write the standard library.
3. Compile it to bitcode.
4. Generate a .o or .so from the bitcode, and install that with the
compiler. This gets linked with every output binary.
5. Run external2availableexternally over the bitcode file, to produce
a stdlib.bc. This gets loaded into the Module of every translation
unit to facilitate inlining.

Jeffrey
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b