bool *);
static tree handle_no_instrument_function_attribute (tree *, tree,
tree, int, bool *);
+static tree handle_no_profile_instrument_function_attribute (tree *, tree,
+ tree, int, bool *);
static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *);
static tree handle_no_limit_stack_attribute (tree *, tree, tree, int,
{ "no_instrument_function", 0, 0, true, false, false,
handle_no_instrument_function_attribute,
false },
+ { "no_profile_instrument_function", 0, 0, true, false, false,
+ handle_no_profile_instrument_function_attribute,
+ false },
{ "malloc", 0, 0, true, false, false,
handle_malloc_attribute, false },
{ "returns_twice", 0, 0, true, false, false,
return NULL_TREE;
}
+/* Handle a "no_profile_instrument_function" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_no_profile_instrument_function_attribute (tree *node, tree name, tree,
+ int, bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "malloc" attribute; arguments as in
struct attribute_spec.handler. */
generated at entry and exit of most user-compiled functions.
Functions with this attribute are not so instrumented.
+@item no_profile_instrument_function
+@cindex @code{no_profile_instrument_function} function attribute
+The @code{no_profile_instrument_function} attribute on functions is used
+to inform the compiler that it should not process any profile feedback based
+optimization code instrumentation.
+
@item no_reorder
@cindex @code{no_reorder} function attribute
Do not reorder functions or variables marked @code{no_reorder}
--- /dev/null
+/* { dg-options "-O2 -fprofile-generate -fdump-tree-optimized" } */
+
+__attribute__ ((no_profile_instrument_function))
+int foo()
+{
+ return 0;
+}
+
+__attribute__ ((no_profile_instrument_function))
+int bar()
+{
+ return 1;
+}
+
+int main ()
+{
+ return foo ();
+}
+
+/* { dg-final { scan-tree-dump-times "__gcov0\\.main.* = PROF_edge_counter" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "__gcov_indirect_call_profiler_v2" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__gcov_time_profiler" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__gcov_init" 1 "optimized" } } */