Writing an instruction selector
LLVM uses the SelectionDAG
representation to represent the LLVM IR in a low-level data-dependence DAG for instruction selection. Various simplifications and target-specific optimizations can be applied to the SelectionDAG
representation. This representation is target-independent. It is a significant, simple, and powerful representation used to implement IR lowering to target instructions.
How to do it…
The following code shows a brief skeleton of the SelectionDAG
class, its data members, and various methods used to set/retrieve useful information from this class. The SelectionDAG
class is defined as follows:
class SelectionDAG { const TargetMachine &TM; const TargetLowering &TLI; const TargetSelectionDAGInfo &TSI; ...
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.