diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-09-05 00:57:45 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-09-05 00:57:45 +0000 |
commit | 3a9a3e112ac02f8a261293cbe605db2e5d8732d3 (patch) | |
tree | 621f5da691905087929eb9287cfbe85b5311604d /lib/CodeGen/CodeGenModule.cpp | |
parent | fc0898a6529f3d6bc9a4effdb3202aee13170fe3 (diff) |
Set sext/zext on function result.
- <rdar://problem/6156739>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 4c12011c4b..373027bbff 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -207,14 +207,21 @@ SetFunctionAttributesFromTypes(const Decl *FD, FuncAttrs |= llvm::ParamAttr::NoReturn; llvm::SmallVector<llvm::ParamAttrsWithIndex, 8> ParamAttrList; - if (FuncAttrs) - ParamAttrList.push_back(llvm::ParamAttrsWithIndex::get(0, FuncAttrs)); // Note that there is parallel code in CodeGenFunction::EmitCallExpr - bool AggregateReturn = CodeGenFunction::hasAggregateLLVMType(ArgTypes[0]); - if (AggregateReturn) + unsigned increment = 1; + if (CodeGenFunction::hasAggregateLLVMType(ArgTypes[0])) { ParamAttrList.push_back( llvm::ParamAttrsWithIndex::get(1, llvm::ParamAttr::StructRet)); - unsigned increment = AggregateReturn ? 2 : 1; + ++increment; + } else if (ArgTypes[0]->isPromotableIntegerType()) { + if (ArgTypes[0]->isSignedIntegerType()) { + FuncAttrs |= llvm::ParamAttr::SExt; + } else if (ArgTypes[0]->isUnsignedIntegerType()) { + FuncAttrs |= llvm::ParamAttr::ZExt; + } + } + if (FuncAttrs) + ParamAttrList.push_back(llvm::ParamAttrsWithIndex::get(0, FuncAttrs)); for (llvm::SmallVector<QualType, 8>::const_iterator i = ArgTypes.begin() + 1, e = ArgTypes.end(); i != e; ++i, ++increment) { QualType ParamType = *i; |