Summary
In this chapter, you learned that the IR building phase has two goals: building the generic IR used in the related instruction selection framework and lowering the ABI – more specifically, the calling conventions – of your target.
You learned that you need to implement three different lowering paths that correspond to where in the input program the calling convention is lowered (at a function call, to read the formal arguments, and to prepare the returned values) and learned that you need to supply an additional target hook to inform the IR building phase of when to use the sret demotion technique.
Next, you saw how to describe your calling conventions using a TableGen backend, which allows you to share the location information of your arguments and results for all selectors.
Finally, you learned, with examples, how to use the code generated by this TableGen backend to implement the previously mentioned lowering functions in all the instruction selection...