[LLVMdev] Proposal for new Legalization framework
reed kotler
rkotler at mips.com
Thu Apr 25 05:16:01 PDT 2013
On 04/24/2013 07:39 PM, Chris Lattner wrote:
> On Apr 24, 2013, at 6:27 PM, Reed Kotler <rkotler at mips.com> wrote:
>> I would really push towards doing this in LLVM IR as the next step.
> What makes you say that?
>
Partly for the reasons Dan stated. For me, the IR is definitely way more
friendly too and not tangled
up in lots of undocumented obscurity as selection DAG is with tablegen
and many other idiosyncrasies of the backend design. Solving problems
with selection DAG, to me, is like playing dungeons and dragons. I feel
like I need to ask the wizard for a magic spell to capture a gnome. I
don't feel like I'm doing science. It's too much like a game with
thousands of rules to know.
I should be able to blow through many complex problems using the C++
helper classes but they are not obvious and I spend more time learning
all those obscure classes and digging through code to understand them
than in doing real work. With IR, my experience is exactly the opposite.
Someone that understands compilers and has experience with them should
not be getting tangled up in a web of complex C++ classes and
undocumented tools.
The C++ classes should be making things clearer and this is , for me,
definitely the case with IR and not with selection DAG.
I don't immediately see the need for yet another IR. It's already
pretty low level. Sure you could design another lower level one that is
further removed from C but I don't see that point.
You yourself like people to change things with small patches.
A good example of that recently was Bill Wendlings work on attributes.
He added a nice forward step in a reasonable time frame. Sure, one could
design from scratch a much more sophisticated way to handle attributes
but how to find the time to do that and fit it in with all of what is
already there is the rub. Many things in LLVM could be better if it were
possible to reset the clock. We have a lot of "technical debt" already
from people being in a hurry and not thinking things through nor taking
the time to clean up things that were not the best choice and to
document what is already there. Well, people also wanted to move forward
so it's not a criticism but a statement of what is and what became for
various reasons.
So I think the first step is to start to shrink the work done with
selection DAG as Dan has done with his
work on legalization. I think that all could go very quickly and
incrementally.
Dan already showed that with little work, many things can be done in IR.
I myself have been thinking along exactly the same lines for some time now.
As a practical matter; eliminating selection DAG can be done in a simple
evolutionary way by doing that same work with IR and judiciously adding
new features to IR as is demanded.
We would need to extend IR but it can be done in steps.
>> It's possible that what you are proposing is the right "long term" solution but I think it's not a good evolutionary approach; it's more revolutionary.
> Doing this in LLVM IR seems like a major step backwards. It gets us no closer to the ultimate goal, would add a ton of code, and would make the compiler more complex.
I don't see why it's a step backwards or why it would add tons of code
and make the compiler more complex. I see the exactly the opposite.
Why do you think that?
> -Chris
>
Reed
More information about the llvm-dev
mailing list