Refactor handling of signext/zeroext in ABIArgInfo
ClosedPublic

Authored by asb on Fri, Jan 12, 10:21 AM.

Details

Summary

As @rjmccall suggested in D40023, we can get rid of ABIInfo::shouldSignExtUnsignedType (used to handle cases like the Mips calling convention where 32-bit integers are always sign extended regardless of the sign of the type) by adding a SignExt field to ABIArgInfo. In the common case, this new field is set automatically by ABIArgInfo::getExtend based on the sign of the type. For targets that want greater control, they can use ABIArgInfo::getSignExtend or ABIArgInfo::getZeroExtend when necessary. This change also cleans up logic in CGCall.cpp.

There is no functional change intended in this patch, and all tests pass unchanged. As noted in D40023, Mips might want to 32-bit integer return types. A future patch might modify MipsABIInfo::classifyReturnType to use MipsABIInfo::extendType.

Diff Detail

Repository
rC Clang
asb created this revision.Fri, Jan 12, 10:21 AM
rjmccall accepted this revision.Fri, Jan 12, 10:24 AM

Thanks, that looks great. I appreciate you doing this.

This revision is now accepted and ready to land.Fri, Jan 12, 10:24 AM
This revision was automatically updated to reflect the committed changes.