This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto] cp/*.c: Use build_function_type_list instead of build_function_type.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 8 Aug 2006 11:19:10 -0700
- Subject: [lto] cp/*.c: Use build_function_type_list instead of build_function_type.
Hi,
Tested on x86_64-pc-linux-gnu. Committed to the LTO branch as
obvious.
Kazu Hirata
2006-08-08 Kazu Hirata <kazu@codesourcery.com>
* call.c (build_java_interface_fn_ref): Use
build_function_type_list instead of build_function_type.
* decl.c (cxx_init_decl_processing, get_atexit_node,
start_cleanup_fn, expand_static_init): Likewise.
* decl2.c (start_objects,
start_static_storage_duration_function): Likewise.
* except.c (init_exception_processing, do_get_exception_ptr,
do_begin_catch, do_allocate_exception, build_throw): Likewise.
* rtti.c (throw_bad_cast, throw_bad_typeid,
build_dynamic_cast_1): Likewise.
Index: cp/call.c
===================================================================
--- cp/call.c (revision 116011)
+++ cp/call.c (working copy)
@@ -5044,15 +5044,14 @@ build_java_interface_fn_ref (tree fn, tr
if (!java_iface_lookup_fn)
{
- tree endlink = build_void_list_node ();
- tree t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, java_int_type_node,
- endlink)));
+ tree t = build_function_type_list (ptr_type_node,
+ ptr_type_node,
+ ptr_type_node,
+ java_int_type_node,
+ NULL_TREE);
java_iface_lookup_fn
= builtin_function ("_Jv_LookupInterfaceMethodIdx",
- build_function_type (ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
+ t, 0, NOT_BUILT_IN, NULL, NULL_TREE);
}
/* Look up the pointer to the runtime java.lang.Class object for `instance'.
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 116011)
+++ cp/decl.c (working copy)
@@ -3185,11 +3185,9 @@ cxx_init_decl_processing (void)
vtable_index_type = ptrdiff_type_node;
vtt_parm_type = build_pointer_type (const_ptr_type_node);
- void_ftype = build_function_type (void_type_node, void_list_node);
- void_ftype_ptr = build_function_type (void_type_node,
- tree_cons (NULL_TREE,
- ptr_type_node,
- void_list_node));
+ void_ftype = build_function_type_list (void_type_node, NULL_TREE);
+ void_ftype_ptr = build_function_type_list (void_type_node,
+ ptr_type_node, NULL_TREE);
void_ftype_ptr
= build_exception_variant (void_ftype_ptr, empty_except_spec);
@@ -3255,10 +3253,8 @@ cxx_init_decl_processing (void)
pop_namespace ();
ptr_ftype_sizetype
- = build_function_type (ptr_type_node,
- tree_cons (NULL_TREE,
- size_type_node,
- void_list_node));
+ = build_function_type_list (ptr_type_node,
+ size_type_node, NULL_TREE);
newtype = build_exception_variant
(ptr_ftype_sizetype, add_exception_specifier
(NULL_TREE, bad_alloc_type_node, -1));
@@ -5347,7 +5343,6 @@ static tree
get_atexit_node (void)
{
tree atexit_fndecl;
- tree arg_types;
tree fn_type;
tree fn_ptr_type;
const char *name;
@@ -5358,6 +5353,8 @@ get_atexit_node (void)
if (flag_use_cxa_atexit)
{
+ tree parm1, parm2;
+
/* The declaration for `__cxa_atexit' is:
int __cxa_atexit (void (*)(void *), void *, void *)
@@ -5368,23 +5365,25 @@ get_atexit_node (void)
use_aeabi_atexit = targetm.cxx.use_aeabi_atexit ();
/* First, build the pointer-to-function type for the first
argument. */
- arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- fn_type = build_function_type (void_type_node, arg_types);
+ fn_type = build_function_type_list (void_type_node,
+ ptr_type_node, NULL_TREE);
fn_ptr_type = build_pointer_type (fn_type);
/* Then, build the rest of the argument types. */
- arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
if (use_aeabi_atexit)
{
- arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types);
- arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
+ parm1 = ptr_type_node;
+ parm2 = fn_ptr_type;
}
else
{
- arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
- arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types);
+ parm1 = fn_ptr_type;
+ parm2 = ptr_type_node;
}
/* And the final __cxa_atexit type. */
- fn_type = build_function_type (integer_type_node, arg_types);
+ fn_type = build_function_type_list (integer_type_node,
+ parm1,
+ parm2,
+ ptr_type_node, NULL_TREE);
fn_ptr_type = build_pointer_type (fn_type);
if (use_aeabi_atexit)
name = "__aeabi_atexit";
@@ -5399,11 +5398,11 @@ get_atexit_node (void)
We build up the argument types and then then function type
itself. */
- fn_type = build_function_type (void_type_node, void_list_node);
+ fn_type = build_function_type_list (void_type_node, NULL_TREE);
fn_ptr_type = build_pointer_type (fn_type);
- arg_types = tree_cons (NULL_TREE, fn_ptr_type, void_list_node);
/* Build the final atexit type. */
- fn_type = build_function_type (integer_type_node, arg_types);
+ fn_type = build_function_type_list (integer_type_node,
+ fn_ptr_type, NULL_TREE);
name = "atexit";
}
@@ -5441,7 +5440,6 @@ static tree
start_cleanup_fn (void)
{
char name[32];
- tree parmtypes;
tree fntype;
tree fndecl;
@@ -5450,16 +5448,15 @@ start_cleanup_fn (void)
/* No need to mangle this. */
push_lang_context (lang_name_c);
- /* Build the parameter-types. */
- parmtypes = void_list_node;
/* Functions passed to __cxa_atexit take an additional parameter.
We'll just ignore it. After we implement the new calling
convention for destructors, we can eliminate the use of
additional cleanup functions entirely in the -fnew-abi case. */
if (flag_use_cxa_atexit)
- parmtypes = tree_cons (NULL_TREE, ptr_type_node, parmtypes);
- /* Build the function type itself. */
- fntype = build_function_type (void_type_node, parmtypes);
+ fntype = build_function_type_list (void_type_node,
+ ptr_type_node, NULL_TREE);
+ else
+ fntype = build_function_type_list (void_type_node, NULL_TREE);
/* Build the name of the function. */
sprintf (name, "__tcf_%d", start_cleanup_cnt++);
/* Build the function declaration. */
@@ -5646,11 +5643,13 @@ expand_static_init (tree decl, tree init
abort_fn = get_identifier ("__cxa_guard_abort");
if (!get_global_value_if_present (acquire_fn, &acquire_fn))
{
- tree argtypes = tree_cons (NULL_TREE, TREE_TYPE (guard_addr),
- void_list_node);
- tree vfntype = build_function_type (void_type_node, argtypes);
+ tree parmtypes = alloc_parm_types (2);
+ tree vfntype;
+ *(nth_parm_type_ptr (parmtypes, 0)) = TREE_TYPE (guard_addr);
+ *(nth_parm_type_ptr (parmtypes, 1)) = void_type_node;
+ vfntype = build_function_type (void_type_node, parmtypes);
acquire_fn = push_library_fn
- (acquire_fn, build_function_type (integer_type_node, argtypes));
+ (acquire_fn, build_function_type (integer_type_node, parmtypes));
release_fn = push_library_fn (release_fn, vfntype);
abort_fn = push_library_fn (abort_fn, vfntype);
}
Index: cp/decl2.c
===================================================================
--- cp/decl2.c (revision 116011)
+++ cp/decl2.c (working copy)
@@ -2122,8 +2122,8 @@ start_objects (int method_type, int init
fndecl = build_lang_decl (FUNCTION_DECL,
get_file_function_name_long (type),
- build_function_type (void_type_node,
- void_list_node));
+ build_function_type_list (void_type_node,
+ NULL_TREE));
start_preparsed_function (fndecl, /*attrs=*/NULL_TREE, SF_PRE_PARSED);
/* It can be a static function as long as collect2 does not have
@@ -2225,7 +2225,6 @@ static splay_tree priority_info_map;
static tree
start_static_storage_duration_function (unsigned count)
{
- tree parm_types;
tree type;
tree body;
char id[sizeof (SSDF_IDENTIFIER) + 1 /* '\0' */ + 32];
@@ -2235,10 +2234,9 @@ start_static_storage_duration_function (
sprintf (id, "%s_%u", SSDF_IDENTIFIER, count);
/* Create the parameters. */
- parm_types = void_list_node;
- parm_types = tree_cons (NULL_TREE, integer_type_node, parm_types);
- parm_types = tree_cons (NULL_TREE, integer_type_node, parm_types);
- type = build_function_type (void_type_node, parm_types);
+ type = build_function_type_list (void_type_node,
+ integer_type_node,
+ integer_type_node, NULL_TREE);
/* Create the FUNCTION_DECL itself. */
ssdf_decl = build_lang_decl (FUNCTION_DECL,
Index: cp/except.c
===================================================================
--- cp/except.c (revision 116011)
+++ cp/except.c (working copy)
@@ -65,15 +65,14 @@ init_exception_processing (void)
/* void std::terminate (); */
push_namespace (std_identifier);
- tmp = build_function_type (void_type_node, void_list_node);
+ tmp = build_function_type_list (void_type_node, NULL_TREE);
terminate_node = build_cp_library_fn_ptr ("terminate", tmp);
TREE_THIS_VOLATILE (terminate_node) = 1;
TREE_NOTHROW (terminate_node) = 1;
pop_namespace ();
/* void __cxa_call_unexpected(void *); */
- tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- tmp = build_function_type (void_type_node, tmp);
+ tmp = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
call_unexpected_node
= push_throw_library_fn (get_identifier ("__cxa_call_unexpected"), tmp);
@@ -170,8 +169,9 @@ do_get_exception_ptr (void)
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void* __cxa_get_exception_ptr (void *). */
- tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
+ tree tmp = build_function_type_list (ptr_type_node,
+ ptr_type_node, NULL_TREE);
+ fn = push_library_fn (fn, tmp);
}
return build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
@@ -190,8 +190,8 @@ do_begin_catch (void)
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void* __cxa_begin_catch (void *). */
- tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
+ tree tmp = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE);
+ fn = push_library_fn (fn, tmp);
}
return build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
@@ -532,8 +532,9 @@ do_allocate_exception (tree type)
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void *__cxa_allocate_exception(size_t). */
- tree tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
- fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
+ tree tmp = build_function_type_list (ptr_type_node,
+ size_type_node, NULL_TREE);
+ fn = push_library_fn (fn, tmp);
}
return build_function_call (fn, tree_cons (NULL_TREE, size_in_bytes (type),
@@ -623,8 +624,8 @@ build_throw (tree exp)
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void _Jv_Throw (void *). */
- tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- tmp = build_function_type (ptr_type_node, tmp);
+ tree tmp = build_function_type_list (ptr_type_node,
+ ptr_type_node, NULL_TREE);
fn = push_throw_library_fn (fn, tmp);
}
else if (really_overloaded_fn (fn))
@@ -648,9 +649,8 @@ build_throw (tree exp)
/* The CLEANUP_TYPE is the internal type of a destructor. */
if (!cleanup_type)
{
- tmp = void_list_node;
- tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
- tmp = build_function_type (void_type_node, tmp);
+ tmp = build_function_type_list (void_type_node,
+ ptr_type_node, NULL_TREE);
cleanup_type = build_pointer_type (tmp);
}
@@ -659,11 +659,10 @@ build_throw (tree exp)
{
/* Declare void __cxa_throw (void*, void*, void (*)(void*)). */
/* ??? Second argument is supposed to be "std::type_info*". */
- tmp = void_list_node;
- tmp = tree_cons (NULL_TREE, cleanup_type, tmp);
- tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
- tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
- tmp = build_function_type (void_type_node, tmp);
+ tmp = build_function_type_list (void_type_node,
+ ptr_type_node,
+ ptr_type_node,
+ cleanup_type, NULL_TREE);
fn = push_throw_library_fn (fn, tmp);
}
@@ -801,8 +800,8 @@ build_throw (tree exp)
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void __cxa_rethrow (void). */
- fn = push_throw_library_fn
- (fn, build_function_type (void_type_node, void_list_node));
+ tree tmp = build_function_type_list (void_type_node, NULL_TREE);;
+ fn = push_throw_library_fn (fn, tmp);
}
/* ??? Indicate that this function call allows exceptions of the type
Index: cp/rtti.c
===================================================================
--- cp/rtti.c (revision 116011)
+++ cp/rtti.c (working copy)
@@ -192,8 +192,10 @@ throw_bad_cast (void)
{
tree fn = get_identifier ("__cxa_bad_cast");
if (!get_global_value_if_present (fn, &fn))
- fn = push_throw_library_fn (fn, build_function_type (ptr_type_node,
- void_list_node));
+ {
+ tree tmp = build_function_type_list (ptr_type_node, NULL_TREE);
+ fn = push_throw_library_fn (fn, tmp);
+ }
return build_cxx_call (fn, NULL_TREE);
}
@@ -210,7 +212,7 @@ throw_bad_typeid (void)
tree t;
t = build_reference_type (const_type_info_type_node);
- t = build_function_type (t, void_list_node);
+ t = build_function_type_list (t, NULL_TREE);
fn = push_throw_library_fn (fn, t);
}
@@ -661,12 +663,12 @@ build_dynamic_cast_1 (tree type, tree ex
(build_qualified_type
(tinfo_ptr, TYPE_QUAL_CONST));
name = "__dynamic_cast";
- tmp = tree_cons
- (NULL_TREE, const_ptr_type_node, tree_cons
- (NULL_TREE, tinfo_ptr, tree_cons
- (NULL_TREE, tinfo_ptr, tree_cons
- (NULL_TREE, ptrdiff_type_node, void_list_node))));
- tmp = build_function_type (ptr_type_node, tmp);
+ tmp = build_function_type_list (ptr_type_node,
+ const_ptr_type_node,
+ tinfo_ptr,
+ tinfo_ptr,
+ ptrdiff_type_node,
+ NULL_TREE);
dcast_fn = build_library_fn_ptr (name, tmp);
DECL_IS_PURE (dcast_fn) = 1;
pop_nested_namespace (ns);