aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/extend.texi
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/doc/extend.texi
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/doc/extend.texi')
-rw-r--r--gcc/doc/extend.texi25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index d737617a..7073c90 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2671,6 +2671,31 @@ SRAM. The function will be put into a specific section named
@code{.l1.text}. With @option{-mfdpic}, callers of such functions will use
an inlined PLT.
+@item leaf
+@cindex @code{leaf} function attribute
+Calls to external functions with this attribute must return to the current
+compilation unit only by return or by exception handling. In particular, leaf
+functions are not allowed to call callback function passed to it from current
+compilation unit or directly call functions exported by the unit or longjmp
+into the unit. Still leaf function might call functions from other complation
+units and thus they are not neccesarily leaf in the sense that they contains no
+function calls at all.
+
+The attribute is intended for library functions to improve dataflow analysis.
+Compiler takes the hint that any data not escaping current compilation unit can
+not be used or modified by the leaf function. For example, function @code{sin}
+is leaf, function @code{qsort} is not.
+
+Note that the leaf functions might invoke signals and signal handlers might be
+defined in the current compilation unit and use static variables. Only
+compliant way to write such a signal handler is to declare such variables
+@code{volatile}.
+
+The attribute has no effect on functions defined within current compilation
+unit. This is to allow easy merging of multiple compilation units into one,
+for example, by using the link time optimization. For this reason the
+attribute is not allowed on types to annotate indirect calls.
+
@item long_call/short_call
@cindex indirect calls on ARM
This attribute specifies how a particular function is called on