]> granicus.if.org Git - clang/commit
Refactor handling of signext/zeroext in ABIArgInfo
authorAlex Bradbury <asb@lowrisc.org>
Fri, 12 Jan 2018 20:08:16 +0000 (20:08 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Fri, 12 Jan 2018 20:08:16 +0000 (20:08 +0000)
commit1a586d3591b8da8a47212f276e5fe79f9a905e42
tree4f0cc7fe9d7885abdd6f1a51edc821ae6219e9fa
parenta65cfe004d978946eadb1a76655574190ef6f9f2
Refactor handling of signext/zeroext in ABIArgInfo

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 sign-extend unsigned 32-bit
integer return types. A future patch might modify
MipsABIInfo::classifyReturnType to use MipsABIInfo::extendType.

Differential Revision: https://reviews.llvm.org/D41999

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322396 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/CodeGen/CGFunctionInfo.h
lib/CodeGen/ABIInfo.h
lib/CodeGen/CGCall.cpp
lib/CodeGen/TargetInfo.cpp