
A Simple Graph-Based Intermediate Representation (1995) [pdf] - luu
http://paperhub.s3.amazonaws.com/24842c95fb1bc5d7c5da2ec735e106f0.pdf
======
pizlonator
This is such an influential paper.

However, I don’t recommend using this IR style (aka sea of nodes) because:

\- The original CFG and the original ordering of operations contains useful
data. You want an IR that preserves that at least up to the point where some
pass proves that a better order exists.

\- Lots of optimizations can be made cheaper to run by using basic blocks, so
it’s good to have an IR in which control flow nodes are basic blocks. Load
elimination is an example.

\- IRs need to be intuitive to the people who work on the compiler. Sea of
nodes is more challenging to think about than SSA over CFG.

\- There does not exist a program transform or analysis that is uniquely
enabled by sea of nodes. Those program transforms that are made easier by sea
of nodes are pretty easy to write in SSA over CFG as well.

~~~
throwaway17_17
I don’t completely disagree with you, but I would point out the paper ‘A
Higher-Order Graph-Based Intermediate Representation’ by Roland LeBia, et al
from the U of Saarland Compiler Lab. That paper, which describes the groups
Thorin IR, does show some advantage to the sea of nodes based approach
(although the representation may not be classified as purely SoN). The
advantages seem particularly compelling for mixed functional/imperative source
languages, which was essentially their goal.

~~~
hwj
The name of the author is "Leißa". (The fourth letter is a sharp s).

~~~
throwaway17_17
Apologies, I was aware, but am posting from iOS and couldn’t find the
character.

~~~
gugagore
fyi, if you long-press the "s" on your keyboard, it should come up as an
option!

------
halayli
[https://mlir.llvm.org/](https://mlir.llvm.org/)

Take a look at mlir. It's a very novel and powerful abstraction that can be
used and applied in very creative ways to solve problems that require
translation from source syntax to some target(s) (machine, api, a mix).

tensorflow is the biggest user of mlir so far. The project recently moved to
llvm repo to be used by other llvm sub projects and because it's the natural
place for it to live.

for example, c/c++ -> mlir -> llvm ir can allow many optimizations that cannot
be possibly done at llvm ir level given that it would have lost a lot of
context from its original source(the language syntax).

~~~
pizlonator
Meh. Seems over engineered and too general. Maybe it’ll be cool for ML.
Probably best left ignored for anything else.

The whole thing about using it for C++ optimizations... I’ll believe it when I
see a statistically significant speedup. Until then it’s vapor.

~~~
halayli
you don't need to limit yourself to c/c++. It can be used for various other
reasons.

As for c/c++ specifically, you can optimize much better and safer if you have
1 or more intermediate dialects prior to llvm's IR. You don't need to believe
it. This is compiler 101.

~~~
pizlonator
Of course you can optimize better if you have the _right_ intermediate
dialects.

I’m saying that MLIR is unproven for that purpose outside of the ML space.

------
cedex12
On a related note: What's a good introduction to compiler design ? Has the
dragon book been superseded by something yet? Ideally you'd be able to write a
decent compiler for your own language after going through it.

~~~
CalChris
The 2nd edition of the Dragon Book is _quite_ good. I don't think it's been
surpassed. For myself, I prefer it with respect to compilers much more than I
prefer Computer Architecture A Quantitative Approach with respect to computer
architecture.

~~~
cedex12
Second edition, as in the first "Compilers: Principles, Techniques, and
Tools", or the second ?

~~~
CalChris
Second.

[https://www.amazon.com/Compilers-Principles-Techniques-
Tools...](https://www.amazon.com/Compilers-Principles-Techniques-
Tools-2nd/dp/0321486811)

------
wyldfire
It would be good if title included the publication year: 1995.

~~~
UncleOxidant
Ah, thanks. I have no idea why academic papers don't have the date right under
the title. That's what's nice about papers on arxiv, the date is right there
on the left margin of the first page.

~~~
IanCal
Academic papers don't really have a publication date when they first become
available - the date typically used is the one when the issue it's bundled in
is released. That's one complication, and one of the many oddities of
publishing metadata (that's what I deal with).

~~~
sophacles
Papers are always so careful to point to grant info (when applicable), so it
always bothered me that they didn't have any dates in them. I've been a
proponent of including a footnote or something that includes the research
period, or date of first authorship, or something. I didn't gain much traction
when I was in academia with this, since various publications have pretty
strict formatting rules. You may be in a position to push on that idea though!

~~~
IanCal
I've seen a lot of discussion on publication dates, drafts, acceptance,
preprints, publication, revisions, etc. However this is the first time I've
seen someone mention the research period. It's a fascinating idea. If you want
to push this, perhaps an avenue might be to talk to crossref. While they're
not the only DOI registration agency, they cover most western content and are
good with their APIs. They regularly have events and meetups, and have always
been good for a chat.
[https://www.crossref.org/events/](https://www.crossref.org/events/)

They're a (relatively) central point for this kind of metadata.

> You may be in a position to push on that idea though!

Ah, unfortunately probably not, I'm very much on the receiving end of the
data.

> Papers are always so careful to point to grant info (when applicable),

There's a lot here - surprisingly common for this not to be the case! Funders
definitely want this though.

