Debugging the selectors
As you saw throughout this chapter, selectors are complicated pieces of machinery and it is common that they do not behave the way you would expect.
In this section, we will give you some guidelines to help you debug issues that are specific to the selectors.
For starters, everything that you learned so far for debugging LLVM still applies. You need to use the debug-only
command-line option and the dump
methods to help you inspect the IR.
Let us start with tips that are specific to SDISel.
Debugging SDISel
When debugging the SDISel issue, you can use the dumpr
method of the SDNode
instance. This method allows printing the children of a node and the children of its children and so on until the specified depth (and argument of this method) is reached. (Note that such a method also exists on the MachineInstr
instances but requires you to provide a MachineRegisterInfo
instance.) Moreover, when using the dump
or dumpr
method on an SDNode
instance...