[llvm-commits] [llvm-gcc-4.0] r43294 - /llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
Dale Johannesen
dalej at apple.com
Wed Oct 24 09:40:18 PDT 2007
Author: johannes
Date: Wed Oct 24 11:40:18 2007
New Revision: 43294
URL: http://llvm.org/viewvc/llvm-project?rev=43294&view=rev
Log:
Mark the sret bit correctly for functions defined
with empty parameter list (treated as "K&R" style
internally, although it's equally valid and
semantically identical in ANSI for definitions.)
gcc.c-torture/execute/20020920-1.c
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=43294&r1=43293&r2=43294&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Wed Oct 24 11:40:18 2007
@@ -947,6 +947,12 @@
ABIConverter.HandleReturnType(ReturnType);
+ // If this is a struct-return function, the dest loc is passed in as a
+ // pointer. Mark that pointer as structret.
+ ParamAttrsVector Attrs;
+ if (ABIConverter.isStructReturn())
+ Attrs.push_back(ParamAttrsWithIndex::get(ArgTys.size(),
+ ParamAttr::StructRet));
if (static_chain)
// Pass the static chain as the first parameter.
ABIConverter.HandleArgument(TREE_TYPE(static_chain));
@@ -954,7 +960,11 @@
for (; Args && TREE_TYPE(Args) != void_type_node; Args = TREE_CHAIN(Args))
ABIConverter.HandleArgument(TREE_TYPE(Args));
- return GetFunctionType(RetTy, ArgTys, false, 0);
+ ParamAttrsList *PAL = 0;
+ if (!Attrs.empty())
+ PAL = ParamAttrsList::get(Attrs);
+
+ return GetFunctionType(RetTy, ArgTys, false, PAL);
}
const FunctionType *TypeConverter::ConvertFunctionType(tree type,
More information about the llvm-commits
mailing list