summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-09 07:54:02 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-09 07:54:02 +0000
commit9d3fa9375021ee8fbb9a5fddcb98fdf8750181ff (patch)
tree6f0f3cdaa7c97b4ffb3074c195483271e15c9cc5 /gcc/function.c
parent6c587dc6423cefea4a221acea7f2dcab52af0d19 (diff)
downloadlinaro-gcc-9d3fa9375021ee8fbb9a5fddcb98fdf8750181ff.tar.gz
linaro-gcc-9d3fa9375021ee8fbb9a5fddcb98fdf8750181ff.tar.bz2
linaro-gcc-9d3fa9375021ee8fbb9a5fddcb98fdf8750181ff.zip
gcc/
PR middle-end/56524 * tree.h (tree_optimization_option): Rename target_optabs to optabs. Add base_optabs. (TREE_OPTIMIZATION_OPTABS): Update after previous field change. (TREE_OPTIMIZATION_BASE_OPTABS): New macro. (save_optabs_if_changed): Replace with... (init_tree_optimization_optabs): ...this. * optabs.c (save_optabs_if_changed): Rename to... (init_tree_optimization_optabs): ...this. Take the optimization node as argument. Do nothing if the base optabs are already correct. Reuse the existing TREE_OPTIMIZATION_OPTABS memory if we need to recompute optabs. * function.h (function): Remove optabs field. * function.c (invoke_set_current_function_hook): Call init_tree_optimization_optabs. Use the result to initialize this_fn_optabs. gcc/c-family/ PR middle-end/56524 * c-common.c (handle_optimize_attribute): Don't call save_optabs_if_changed. gcc/testsuite/ PR middle-end/56524 * gcc.target/mips/pr56524.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196570 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 1b41cf2cb34..e673f21a57d 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4400,25 +4400,14 @@ invoke_set_current_function_hook (tree fndecl)
}
targetm.set_current_function (fndecl);
+ this_fn_optabs = this_target_optabs;
- if (opts == optimization_default_node)
- this_fn_optabs = this_target_optabs;
- else
+ if (opts != optimization_default_node)
{
- struct function *fn = DECL_STRUCT_FUNCTION (fndecl);
- if (fn->optabs == NULL)
- {
- if (this_target_optabs == &default_target_optabs)
- fn->optabs = TREE_OPTIMIZATION_OPTABS (opts);
- else
- {
- fn->optabs = (unsigned char *)
- ggc_alloc_atomic (sizeof (struct target_optabs));
- init_all_optabs ((struct target_optabs *) fn->optabs);
- }
- }
- this_fn_optabs = fn->optabs ? (struct target_optabs *) fn->optabs
- : this_target_optabs;
+ init_tree_optimization_optabs (opts);
+ if (TREE_OPTIMIZATION_OPTABS (opts))
+ this_fn_optabs = (struct target_optabs *)
+ TREE_OPTIMIZATION_OPTABS (opts);
}
}
}