From 4a5b1b7cdfea68335a50202078ab716ac751dabf Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 24 Sep 2007 13:31:25 +0000 Subject: [PATCH] 2007-09-24 Pranav Bhandarkar Ramana Radhakrishnan * tree-inline.h (eni_weights): Add field target_builtin_cost to reflect the cost per call to a target specific builtin. * tree-inline.c (estimate_num_insns_1): If it is a CALL_EXPR for * a call to a target specific builtin, then use target_builtin_call_cost. (init_inline_once): Initialize target_builtin_call_cost field. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128714 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/tree-inline.c | 9 ++++++++- gcc/tree-inline.h | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 15c68ae376c..81bdc4c8890 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2007-09-24 Pranav Bhandarkar + Ramana Radhakrishnan + + * tree-inline.h (eni_weights): Add field target_builtin_cost to + reflect the cost per call to a target specific builtin. + * tree-inline.c (estimate_num_insns_1): If it is a CALL_EXPR for a + call to a target specific builtin, then use target_builtin_call_cost. + (init_inline_once): Initialize target_builtin_call_cost field. + 2007-09-24 Kai Tietz PR middle-end/33472 diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 61a7f4e960a..9c459511b71 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2290,7 +2290,11 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data) { tree decl = get_callee_fndecl (x); - cost = d->weights->call_cost; + if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_MD) + cost = d->weights->target_builtin_call_cost; + else + cost = d->weights->call_cost; + if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL) switch (DECL_FUNCTION_CODE (decl)) { @@ -2391,11 +2395,13 @@ void init_inline_once (void) { eni_inlining_weights.call_cost = PARAM_VALUE (PARAM_INLINE_CALL_COST); + eni_inlining_weights.target_builtin_call_cost = 1; eni_inlining_weights.div_mod_cost = 10; eni_inlining_weights.switch_cost = 1; eni_inlining_weights.omp_cost = 40; eni_size_weights.call_cost = 1; + eni_size_weights.target_builtin_call_cost = 1; eni_size_weights.div_mod_cost = 1; eni_size_weights.switch_cost = 10; eni_size_weights.omp_cost = 40; @@ -2405,6 +2411,7 @@ init_inline_once (void) underestimating the cost does less harm than overestimating it, so we choose a rather small value here. */ eni_time_weights.call_cost = 10; + eni_time_weights.target_builtin_call_cost = 10; eni_time_weights.div_mod_cost = 10; eni_time_weights.switch_cost = 4; eni_time_weights.omp_cost = 40; diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h index 1fa360ad345..895a0afcbbd 100644 --- a/gcc/tree-inline.h +++ b/gcc/tree-inline.h @@ -103,6 +103,9 @@ typedef struct eni_weights_d /* Cost per call. */ unsigned call_cost; + /* Cost per call to a target specific builtin */ + unsigned target_builtin_call_cost; + /* Cost of "expensive" div and mod operations. */ unsigned div_mod_cost; -- 2.11.4.GIT