diff options
author | Michael Meissner <meissner@gcc.gnu.org> | 2008-07-23 10:28:06 +0000 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 2008-07-23 10:28:06 +0000 |
commit | ab442df7fb453434d80a779844fe1a10c0c802ab (patch) | |
tree | efd8e61a3d2ff9dcff5eb5bf03e25922191f7df5 /gcc/function.c | |
parent | 5295185c3150a8d31685dc44248aa058246bbe73 (diff) | |
download | gcc-ab442df7fb453434d80a779844fe1a10c0c802ab.zip gcc-ab442df7fb453434d80a779844fe1a10c0c802ab.tar.gz gcc-ab442df7fb453434d80a779844fe1a10c0c802ab.tar.bz2 |
Add ability to set target options (ix86 only) and optimization options on a function specific basis
From-SVN: r138075
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/function.c b/gcc/function.c index 8e8b907..fa2a84d 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -3731,13 +3731,30 @@ debug_find_var_in_block_tree (tree var, tree block) static bool in_dummy_function; -/* Invoke the target hook when setting cfun. */ +/* Invoke the target hook when setting cfun. Update the optimization options + if the function uses different options than the default. */ static void invoke_set_current_function_hook (tree fndecl) { if (!in_dummy_function) - targetm.set_current_function (fndecl); + { + tree opts = ((fndecl) + ? DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) + : optimization_default_node); + + if (!opts) + opts = optimization_default_node; + + /* Change optimization options if needed. */ + if (optimization_current_node != opts) + { + optimization_current_node = opts; + cl_optimization_restore (TREE_OPTIMIZATION (opts)); + } + + targetm.set_current_function (fndecl); + } } /* cfun should never be set directly; use this function. */ |