Summary
In this chapter, you learned how to implement the legalization phase of your instruction selection pipeline. You saw how both SDISel and GlobalISel use legalization actions to describe the transformations that need to happen to go from illegal to legal IR.
You learned that SDISel relies on the concept of legal type to guide the legalization decisions while GlobalISel drives all its legalization decisions through precise legalization actions.
Finally, you learned how to implement each of these legalization actions and, in particular, the most advanced one, the custom legalization for both these frameworks.
What you learned in this chapter is the basis of how to do legalization in LLVM. At this point, you know the APIs and the principles behind them, but writing these legalization strategies is the hard part. We are confident that with your now solid background, you will be able to navigate what is ahead of you. As always, use the existing backends as examples to...