Finalizing the selection pipeline
After the instruction selection pipeline, the default machine pass pipeline features a pass, represented by the FinalizeISel class, which is responsible for tidying up the Machine IR for the remaining passes.
From a backend perspective, there are two things that you can customize in this finalization:
- You can morph instructions using a custom inserter. Custom inserters are target hooks that allow you to modify the instructions that you tagged as requiring a customer inserter. You typically use a custom inserter for pseudo instructions that you want to expand right after instruction selection in the pass pipeline.
- You can customize the
TargetLowering::finalizeLoweringmethod, which is the main method that prepares the currentMachineFunctioninstance for processing by the remaining passes. By default, this method just freezes the set of reserved registers. Reserved registers are physical registers that cannot be used by register...