aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-09-24 21:14:51 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-09-24 19:14:51 +0000
commit46a4da10f5b00da1091d9641836f0550ce9a5120 (patch)
tree3586ff30f00807c4e59b1bf02ac5e21a1cdad147 /gcc/tree.c
parente1b793e7c10393b112937ce3e7de4db903052618 (diff)
downloadgcc-46a4da10f5b00da1091d9641836f0550ce9a5120.zip
gcc-46a4da10f5b00da1091d9641836f0550ce9a5120.tar.gz
gcc-46a4da10f5b00da1091d9641836f0550ce9a5120.tar.bz2
extend.texi: (attribute leaf): Document.
* doc/extend.texi: (attribute leaf): Document. * tree.c (local_define_builtin): Handle ECF_LEAF. (build_common_builtin_nodes): Set ECF_LEAF where needed. * tree.h (ECF_LEAF): New. * ipa-reference.c (propagate_bits): For leaf calls propagate ever overwrittable and unavailable functions. (ipa_init): Put all_module_statics into optimization_summary_obstack. (copy_global_bitmap): Do not copy all_module_statics. (read_write_all_from_decl): Use cgraph_node argument; handle ECF_LEAF. (propagate): Handle overwritable and unavailable leaf functions; initialize global info for overwritable and unavailable leaf functions; do not free all module statics. (ipa_reference_get_not_read_global, ipa_reference_get_not_written_global): leaf calls don't clobber local statics. * calls.c (flags_from_decl_or_type): Handle leaf. * tree-cfg.c (stmt_can_make_abnormal_goto): Leaf functions can't do abnormal gotos. * c-common.c (handle_leaf_attribute): New function. (struct attribute_spec c_common_att): Add leaf. * gcc.dg/tree-ssa/leaf.c: New testcase. From-SVN: r164606
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 8423416..738fa9c 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -9224,6 +9224,9 @@ local_define_builtin (const char *name, tree type, enum built_in_function code,
TREE_NOTHROW (decl) = 1;
if (ecf_flags & ECF_MALLOC)
DECL_IS_MALLOC (decl) = 1;
+ if (ecf_flags & ECF_LEAF)
+ DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("leaf"),
+ NULL, DECL_ATTRIBUTES (decl));
built_in_decls[code] = decl;
implicit_built_in_decls[code] = decl;
@@ -9247,10 +9250,10 @@ build_common_builtin_nodes (void)
if (built_in_decls[BUILT_IN_MEMCPY] == NULL)
local_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY,
- "memcpy", ECF_NOTHROW);
+ "memcpy", ECF_NOTHROW | ECF_LEAF);
if (built_in_decls[BUILT_IN_MEMMOVE] == NULL)
local_define_builtin ("__builtin_memmove", ftype, BUILT_IN_MEMMOVE,
- "memmove", ECF_NOTHROW);
+ "memmove", ECF_NOTHROW | ECF_LEAF);
}
if (built_in_decls[BUILT_IN_MEMCMP] == NULL)
@@ -9259,7 +9262,7 @@ build_common_builtin_nodes (void)
const_ptr_type_node, size_type_node,
NULL_TREE);
local_define_builtin ("__builtin_memcmp", ftype, BUILT_IN_MEMCMP,
- "memcmp", ECF_PURE | ECF_NOTHROW);
+ "memcmp", ECF_PURE | ECF_NOTHROW | ECF_LEAF);
}
if (built_in_decls[BUILT_IN_MEMSET] == NULL)
@@ -9268,7 +9271,7 @@ build_common_builtin_nodes (void)
ptr_type_node, integer_type_node,
size_type_node, NULL_TREE);
local_define_builtin ("__builtin_memset", ftype, BUILT_IN_MEMSET,
- "memset", ECF_NOTHROW);
+ "memset", ECF_NOTHROW | ECF_LEAF);
}
if (built_in_decls[BUILT_IN_ALLOCA] == NULL)
@@ -9276,7 +9279,7 @@ build_common_builtin_nodes (void)
ftype = build_function_type_list (ptr_type_node,
size_type_node, NULL_TREE);
local_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA,
- "alloca", ECF_MALLOC | ECF_NOTHROW);
+ "alloca", ECF_MALLOC | ECF_NOTHROW | ECF_LEAF);
}
/* If we're checking the stack, `alloca' can throw. */
@@ -9288,7 +9291,7 @@ build_common_builtin_nodes (void)
ptr_type_node, NULL_TREE);
local_define_builtin ("__builtin_init_trampoline", ftype,
BUILT_IN_INIT_TRAMPOLINE,
- "__builtin_init_trampoline", ECF_NOTHROW);
+ "__builtin_init_trampoline", ECF_NOTHROW | ECF_LEAF);
ftype = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE);
local_define_builtin ("__builtin_adjust_trampoline", ftype,
@@ -9322,12 +9325,12 @@ build_common_builtin_nodes (void)
ftype = build_function_type_list (ptr_type_node, NULL_TREE);
local_define_builtin ("__builtin_stack_save", ftype, BUILT_IN_STACK_SAVE,
- "__builtin_stack_save", ECF_NOTHROW);
+ "__builtin_stack_save", ECF_NOTHROW | ECF_LEAF);
ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
local_define_builtin ("__builtin_stack_restore", ftype,
BUILT_IN_STACK_RESTORE,
- "__builtin_stack_restore", ECF_NOTHROW);
+ "__builtin_stack_restore", ECF_NOTHROW | ECF_LEAF);
ftype = build_function_type_list (void_type_node, NULL_TREE);
local_define_builtin ("__builtin_profile_func_enter", ftype,
@@ -9342,7 +9345,7 @@ build_common_builtin_nodes (void)
ftype = build_function_type_list (void_type_node, NULL_TREE);
local_define_builtin ("__builtin_cxa_end_cleanup", ftype,
BUILT_IN_CXA_END_CLEANUP,
- "__cxa_end_cleanup", ECF_NORETURN);
+ "__cxa_end_cleanup", ECF_NORETURN | ECF_LEAF);
}
ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
@@ -9361,12 +9364,12 @@ build_common_builtin_nodes (void)
ftype = build_function_type_list (ptr_type_node,
integer_type_node, NULL_TREE);
local_define_builtin ("__builtin_eh_pointer", ftype, BUILT_IN_EH_POINTER,
- "__builtin_eh_pointer", ECF_PURE | ECF_NOTHROW);
+ "__builtin_eh_pointer", ECF_PURE | ECF_NOTHROW | ECF_LEAF);
tmp = lang_hooks.types.type_for_mode (targetm.eh_return_filter_mode (), 0);
ftype = build_function_type_list (tmp, integer_type_node, NULL_TREE);
local_define_builtin ("__builtin_eh_filter", ftype, BUILT_IN_EH_FILTER,
- "__builtin_eh_filter", ECF_PURE | ECF_NOTHROW);
+ "__builtin_eh_filter", ECF_PURE | ECF_NOTHROW | ECF_LEAF);
ftype = build_function_type_list (void_type_node,
integer_type_node, integer_type_node,
@@ -9408,11 +9411,11 @@ build_common_builtin_nodes (void)
built_in_names[mcode] = concat ("__mul", mode_name_buf, "3", NULL);
local_define_builtin (built_in_names[mcode], ftype, mcode,
- built_in_names[mcode], ECF_CONST | ECF_NOTHROW);
+ built_in_names[mcode], ECF_CONST | ECF_NOTHROW | ECF_LEAF);
built_in_names[dcode] = concat ("__div", mode_name_buf, "3", NULL);
local_define_builtin (built_in_names[dcode], ftype, dcode,
- built_in_names[dcode], ECF_CONST | ECF_NOTHROW);
+ built_in_names[dcode], ECF_CONST | ECF_NOTHROW | ECF_LEAF);
}
}
}