Injecting passes
By default, the TargetPassConfig
class sets up a pass pipeline that resembles what we showed in Figure 13.1.
This default pipeline is set by the TargetPassConfig::addMachinePasses
method. While you can overload this method so that you have a completely customized Machine pass pipeline, we recommend that you stick with the default implementation.
Indeed, the hooks that are exposed by the TargetPassConfig
class allow you to inject passes within the default pass pipeline at distinct stages of the lowering process. If you depart from the default implementation of the TargetPassConfig::addMachinePasses
method, then these hooks won’t be called. Moreover, as mentioned in this chapter’s introduction, the default pass pipeline already uses a lot of generic optimizations, so it would be a waste of your time to figure out where in your pass pipeline you should add all these optimizations again.
Zooming into the hooks of the TargetPassConfig
class, this...