Instruction Selection
The SelectionDAG at this phase is optimized and legalized. However, the instructions are still not in machine code form. These instructions need to be mapped to architecture-specific instructions in the SelectionDAG itself. The TableGen class helps select target-specific instructions.
The CodeGenAndEmitDAG() function calls the DoInstructionSelection() function that visits each DAG node and calls the Select() function for each node. The Select() function is the main hook targets implement to select a node. The Select() function is a virtual method to be implemented by the targets.
For consideration, assume our target architecture is X86. The X86DAGToDAGISel::Select() function intercepts some nodes for manual matching, but delegates ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access