[Mono-dev] Questions about the linear IR
massi at ximian.com
Thu Jul 31 03:13:09 EDT 2008
On Thu, 2008-07-31 at 01:23 +0200, Zoltan Varga wrote:
> With the linear IR, most things are easy, and only a few things are
> hard, like optimizations which transform multiple operations into one,
> like transforming a load+operation+store into an operating taking a
> memory operand on x86.
But I would add another thing: with the old representation that kind
of transformations were easy only if the "expression" you wanted to
transform was represented as a tree.
If, for some reason, the operation was "linearized", using local
variables as intermediate results instead of the tree nodes, then the
optimization simply did not take place.
Or the jit developer had to code twice: once for the tree case and
once for the "linear" case.
It all boils down to this: in a tree based representation, tree nodes
are values, that ultimately need to be stored somewhere.
But also local variables (assigned at the tree roots) contain values.
So, if you have an optimization pass that deals with values, you must
handle both locals and tree nodes, so your data structures get quirky
and you end up with double codepaths for the same logic all over the
I had a prototype for global value numbering and full alias analysis for
the old jit (my work on HSSA before doing inlining), but the code was
terrible because of this.
More information about the Mono-devel-list