Selecting instruction from the DAG

After legalization and DAG combination, the SelectionDAG representation is in the optimized phase. However, the instructions represented are still target-independent and need to be mapped on target-specific instructions. The instruction selection phase takes the target-independent DAG nodes as the input, matches patterns in them, and gives the output DAG nodes, which are target-specific.

The TableGen DAG instruction selector generator reads the instruction patterns from the .td file, and automatically builds parts of the pattern matching code.

How to do it…

SelectionDAGISel is the common base class used for pattern-matching instruction selectors that are based on SelectionDAG. It inherits the MachineFunctionPass ...

Get LLVM Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.