aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2009-03-28 12:08:16 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2009-03-28 11:08:16 +0000
commit61a05df17ccd6fd0801571dae07309ca5236d9ec (patch)
tree0557e52d0af921b06b93448b142c8e6390a24930 /gcc/ipa-inline.c
parent144e8aac3db919da759194f93628b91377afc4eb (diff)
downloadgcc-61a05df17ccd6fd0801571dae07309ca5236d9ec.zip
gcc-61a05df17ccd6fd0801571dae07309ca5236d9ec.tar.gz
gcc-61a05df17ccd6fd0801571dae07309ca5236d9ec.tar.bz2
Bring from lto-branch:
2008-09-03 Doug Kwan <dougkwan@google.com> * cgraphbuild.c (initialize_inline_failed): Use cgraph_inline_failed_t enums instead of reason strings. * cgraph.c (cgraph_create_edge): Same. (cgraph_inline_failed_string): New function. * cgraph.h (cgraph_inline_failed_t): New enum type. (cgraph_inline_failed_string): New prototype. (struct cgraph_edge): Change type of INLINED_FAILED from constant char pointer to cgraph_inline_failed_t. (cgraph_inline_p): Adjust prototype to use cgraph_inline_failed_t. (cgraph_default_inline_p): Ditto. * gcc/cgraphunit.c (cgraph_inline_p): Change type of parameter REASON to cgraph_inline_failed_t pointer. * cif-code.def: New file. * ipa-inline.c (cgraph_mark_inline_edge): Use an enum instead of a reason string. (cgraph_check_inline_limits): Change type of REASON to pointer to cgraph_inline_failed_t. Replace reason strings with enums. (cgraph_default_inline_p): Ditto. (cgraph_recursive_inlining_p): Ditto. (update_caller_keys): Change type of FAILED_REASON to cgraph_inline_failed_t. (cgraph_set_inline_failed): Change type of REASON to pointer to cgraph_inline_failed_t. Call cgraph_inline_failed_string to convert enums to strings for text output. (cgraph_decide_inlining_of_small_function): Change FAILED_REASON to be of type cgraph_inline_failed_t. Replace reason strings with enums. Call cgraph_inline_failed_string to covert enums to strings for text output. (cgraph_decide_inlining): Replace reason strings with enums. (cgraph_decide_inlining_incrementally): Change type of FAILED_REASON to cgraph_inline_failed_t type. Call cgraph_inline_failed_string for text output. * tree-inline.c (expand_call_inline): Change type of REASON to cgraph_inline_failed_t. Replace reason strings with enums. Call cgraph_inline_failed_string for text output. * Makefile.in (CGRAPH_H): Add cif-code.def to dependencies. (cgraph.o): Ditto. From-SVN: r145176
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c70
1 files changed, 39 insertions, 31 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index d725f21..94e4576 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -261,7 +261,7 @@ cgraph_mark_inline_edge (struct cgraph_edge *e, bool update_original,
cgraph_redirect_edge_callee (e, cgraph_node (e->callee->inline_decl));
gcc_assert (e->inline_failed);
- e->inline_failed = NULL;
+ e->inline_failed = CIF_OK;
if (!e->callee->global.inlined)
DECL_POSSIBLY_INLINED (e->callee->decl) = true;
@@ -361,7 +361,7 @@ cgraph_estimate_growth (struct cgraph_node *node)
static bool
cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what,
- const char **reason, bool one_only)
+ cgraph_inline_failed_t *reason, bool one_only)
{
int times = 0;
struct cgraph_edge *e;
@@ -396,7 +396,7 @@ cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what,
&& newsize > limit)
{
if (reason)
- *reason = N_("--param large-function-growth limit reached");
+ *reason = CIF_LARGE_FUNCTION_GROWTH_LIMIT;
return false;
}
@@ -411,7 +411,7 @@ cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what,
&& inlined_stack > PARAM_VALUE (PARAM_LARGE_STACK_FRAME))
{
if (reason)
- *reason = N_("--param large-stack-frame-growth limit reached");
+ *reason = CIF_LARGE_STACK_FRAME_GROWTH_LIMIT;
return false;
}
return true;
@@ -419,8 +419,8 @@ cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what,
/* Return true when function N is small enough to be inlined. */
-bool
-cgraph_default_inline_p (struct cgraph_node *n, const char **reason)
+static bool
+cgraph_default_inline_p (struct cgraph_node *n, cgraph_inline_failed_t *reason)
{
tree decl = n->decl;
@@ -429,14 +429,14 @@ cgraph_default_inline_p (struct cgraph_node *n, const char **reason)
if (!flag_inline_small_functions && !DECL_DECLARED_INLINE_P (decl))
{
if (reason)
- *reason = N_("function not inline candidate");
+ *reason = CIF_FUNCTION_NOT_INLINE_CANDIDATE;
return false;
}
if (!DECL_STRUCT_FUNCTION (decl)->cfg)
{
if (reason)
- *reason = N_("function body not available");
+ *reason = CIF_BODY_NOT_AVAILABLE;
return false;
}
@@ -445,7 +445,7 @@ cgraph_default_inline_p (struct cgraph_node *n, const char **reason)
if (n->global.insns >= MAX_INLINE_INSNS_SINGLE)
{
if (reason)
- *reason = N_("--param max-inline-insns-single limit reached");
+ *reason = CIF_MAX_INLINE_INSNS_SINGLE_LIMIT;
return false;
}
}
@@ -454,7 +454,7 @@ cgraph_default_inline_p (struct cgraph_node *n, const char **reason)
if (n->global.insns >= MAX_INLINE_INSNS_AUTO)
{
if (reason)
- *reason = N_("--param max-inline-insns-auto limit reached");
+ *reason = CIF_MAX_INLINE_INSNS_AUTO_LIMIT;
return false;
}
}
@@ -469,7 +469,7 @@ cgraph_default_inline_p (struct cgraph_node *n, const char **reason)
static bool
cgraph_recursive_inlining_p (struct cgraph_node *to,
struct cgraph_node *what,
- const char **reason)
+ cgraph_inline_failed_t *reason)
{
bool recursive;
if (to->global.inlined_to)
@@ -480,7 +480,7 @@ cgraph_recursive_inlining_p (struct cgraph_node *to,
not warn on it. */
if (recursive && reason)
*reason = (what->local.disregard_inline_limits
- ? N_("recursive inlining") : "");
+ ? CIF_RECURSIVE_INLINING : CIF_UNSPECIFIED);
return recursive;
}
@@ -566,7 +566,7 @@ update_caller_keys (fibheap_t heap, struct cgraph_node *node,
bitmap updated_nodes)
{
struct cgraph_edge *edge;
- const char *failed_reason;
+ cgraph_inline_failed_t failed_reason;
if (!node->local.inlinable || node->local.disregard_inline_limits
|| node->global.inlined_to)
@@ -790,12 +790,14 @@ cgraph_decide_recursive_inlining (struct cgraph_node *node,
/* Set inline_failed for all callers of given function to REASON. */
static void
-cgraph_set_inline_failed (struct cgraph_node *node, const char *reason)
+cgraph_set_inline_failed (struct cgraph_node *node,
+ cgraph_inline_failed_t reason)
{
struct cgraph_edge *e;
if (dump_file)
- fprintf (dump_file, "Inlining failed: %s\n", reason);
+ fprintf (dump_file, "Inlining failed: %s\n",
+ cgraph_inline_failed_string (reason));
for (e = node->callers; e; e = e->next_caller)
if (e->inline_failed)
e->inline_failed = reason;
@@ -840,7 +842,7 @@ cgraph_decide_inlining_of_small_functions (void)
{
struct cgraph_node *node;
struct cgraph_edge *edge;
- const char *failed_reason;
+ cgraph_inline_failed_t failed_reason;
fibheap_t heap = fibheap_new ();
bitmap updated_nodes = BITMAP_ALLOC (NULL);
int min_insns, max_insns;
@@ -887,7 +889,7 @@ cgraph_decide_inlining_of_small_functions (void)
struct cgraph_node *where;
int growth =
cgraph_estimate_size_after_inlining (1, edge->caller, edge->callee);
- const char *not_good = NULL;
+ cgraph_inline_failed_t not_good = CIF_OK;
growth -= edge->caller->global.insns;
@@ -939,7 +941,8 @@ cgraph_decide_inlining_of_small_functions (void)
if (where->global.inlined_to)
{
edge->inline_failed
- = (edge->callee->local.disregard_inline_limits ? N_("recursive inlining") : "");
+ = (edge->callee->local.disregard_inline_limits
+ ? CIF_RECURSIVE_INLINING : CIF_UNSPECIFIED);
if (dump_file)
fprintf (dump_file, " inline_failed:Recursive inlining performed only for function itself.\n");
continue;
@@ -947,12 +950,12 @@ cgraph_decide_inlining_of_small_functions (void)
}
if (!cgraph_maybe_hot_edge_p (edge))
- not_good = N_("call is unlikely and code size would grow");
+ not_good = CIF_UNLIKELY_CALL;
if (!flag_inline_functions
&& !DECL_DECLARED_INLINE_P (edge->callee->decl))
- not_good = N_("function not declared inline and code size would grow");
+ not_good = CIF_NOT_DECLARED_INLINED;
if (optimize_function_for_size_p (DECL_STRUCT_FUNCTION(edge->caller->decl)))
- not_good = N_("optimizing for size and code size would grow");
+ not_good = CIF_OPTIMIZING_FOR_SIZE;
if (not_good && growth > 0 && cgraph_estimate_growth (edge->callee) > 0)
{
if (!cgraph_recursive_inlining_p (edge->caller, edge->callee,
@@ -960,7 +963,8 @@ cgraph_decide_inlining_of_small_functions (void)
{
edge->inline_failed = not_good;
if (dump_file)
- fprintf (dump_file, " inline_failed:%s.\n", edge->inline_failed);
+ fprintf (dump_file, " inline_failed:%s.\n",
+ cgraph_inline_failed_string (edge->inline_failed));
}
continue;
}
@@ -970,16 +974,18 @@ cgraph_decide_inlining_of_small_functions (void)
&edge->inline_failed))
{
if (dump_file)
- fprintf (dump_file, " inline_failed:%s.\n", edge->inline_failed);
+ fprintf (dump_file, " inline_failed:%s.\n",
+ cgraph_inline_failed_string (edge->inline_failed));
}
continue;
}
if (!tree_can_inline_p (edge->caller->decl, edge->callee->decl))
{
gimple_call_set_cannot_inline (edge->call_stmt, true);
- edge->inline_failed = N_("target specific option mismatch");
+ edge->inline_failed = CIF_TARGET_OPTION_MISMATCH;
if (dump_file)
- fprintf (dump_file, " inline_failed:%s.\n", edge->inline_failed);
+ fprintf (dump_file, " inline_failed:%s.\n",
+ cgraph_inline_failed_string (edge->inline_failed));
continue;
}
if (cgraph_recursive_inlining_p (edge->caller, edge->callee,
@@ -1005,7 +1011,8 @@ cgraph_decide_inlining_of_small_functions (void)
{
if (dump_file)
fprintf (dump_file, " Not inlining into %s:%s.\n",
- cgraph_node_name (edge->caller), edge->inline_failed);
+ cgraph_node_name (edge->caller),
+ cgraph_inline_failed_string (edge->inline_failed));
continue;
}
callee = edge->callee;
@@ -1053,7 +1060,7 @@ cgraph_decide_inlining_of_small_functions (void)
if (!edge->callee->local.disregard_inline_limits && edge->inline_failed
&& !cgraph_recursive_inlining_p (edge->caller, edge->callee,
&edge->inline_failed))
- edge->inline_failed = N_("--param inline-unit-growth limit reached");
+ edge->inline_failed = CIF_INLINE_UNIT_GROWTH_LIMIT;
}
if (new_indirect_edges)
@@ -1163,7 +1170,7 @@ cgraph_decide_inlining (void)
reason why inline failed. */
for (e = node->callers; e; e = e->next_caller)
if (e->inline_failed)
- e->inline_failed = N_("recursive inlining");
+ e->inline_failed = CIF_RECURSIVE_INLINING;
if (dump_file)
fprintf (dump_file,
" Inlined for a net change of %+i insns.\n",
@@ -1289,7 +1296,7 @@ try_inline (struct cgraph_edge *e, enum inlining_mode mode, int depth)
cgraph_node_name (e->caller));
}
e->inline_failed = (e->callee->local.disregard_inline_limits
- ? N_("recursive inlining") : "");
+ ? CIF_RECURSIVE_INLINING : CIF_UNSPECIFIED);
return false;
}
}
@@ -1330,7 +1337,7 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
{
struct cgraph_edge *e;
bool inlined = false;
- const char *failed_reason;
+ cgraph_inline_failed_t failed_reason;
enum inlining_mode old_mode;
#ifdef ENABLE_CHECKING
@@ -1475,7 +1482,8 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
if (dump_file)
{
indent_to (dump_file, depth);
- fprintf (dump_file, "Not inlining: %s.\n", e->inline_failed);
+ fprintf (dump_file, "Not inlining: %s.\n",
+ cgraph_inline_failed_string (e->inline_failed));
}
continue;
}