[LLVMdev] Thoughts about the llvm architecture
baldrick at free.fr
Fri Sep 3 05:00:58 PDT 2010
>> Legalize and DAG combine already handle these cases. Why would we want to duplicate the code?
legalization is a target specific process, thus it is done as part of code
> But what is the output of legalize and DAG combine? Is it llvm-ir again?
No, the input is a "Selection DAG", a data structure previously generated from
the LLVM IR. The output is also a SDag.
> For example it seems that ligalization takes place after instcombine,
> but I would think it
> should happen before instcombine.
DAG combine is the selection DAG equivalent of instcombine, and runs after
To summarize: target independent transforms occur on the LLVM IR. Target
specific transforms occur when generating code for the target processor,
and work on completely different data structures.
More information about the llvm-dev