Understanding the DAG representation
As already mentioned, SDISel uses a DAG representation where each node is an operation and each directed edge a dependency. The dependencies can be one of the following:
- Data dependency: The source node reads a value that is produced by the destination node. This is the most prevalent type of dependency and is used to represent the regular use-def chains (see Chapter 4 if you need a refresher on this concept). This may sound confusing because the representation of the data dependency is flipped in the SDISel representation. Indeed, the direction of the dependency is not the usual def-use chain; it is the use-def chain. You will learn how to print this graph in Chapter 17, which will make it easy to visualize it.
- Scheduling dependency: The source node must happen before the destination node when the DAG gets linearized as a basic block. This type of dependency is typically used to enforce some ordering between instructions; for...