O'Reilly logo

Getting Started with LLVM Core Libraries by Rafael Auler, Bruno Cardoso Lopes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding the instruction selection phase

Instruction selection is the process of transforming the LLVM IR into the SelectionDAG nodes (SDNode) representing target instructions. The first step is to build the DAG out of LLVM IR instructions, creating a SelectionDAG object whose nodes carry IR operations. Next, these nodes go through the lowering, DAG combiner, and legalization phases, making it easier to match against target instructions. The instruction selection then performs a DAG-to-DAG conversion using node pattern matching and transforms the SelectionDAG nodes into nodes representing target instructions.

Note

The instruction selection pass is one of the most expensive ones employed in the backend. A study compiling the functions of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required