These 8 patches add support for return values and other stuff allowing compiling parts of shaders separately and concatenating their binaries to form a complete shader. This feature will be used by Mesa.
There is a hack for ISD::MERGE_VALUES which I'm not too proud of. For some reason, getCopyToReg(Constant) is translated to V_MOV, which is problematic if the output should be an SGPR.
It already works except for a bug in SIFoldOperands that sometimes generates completely wrong code if some return values occur. I still have to fix that.
Please review.
Will different shader types have different calling conventions? If so, it might make sense to create a separate CC_SI def for each shader type.