aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2015-08-04 10:10:28 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2015-08-04 10:10:28 +0000
commitd78006d9504c41f96a476457754563c2aa100b7a (patch)
treecd17af4eb62c44430d0aeab907ce122744503788 /gcc
parent361fb3ee79f07fcff6c34acd1ccde520f4935c7e (diff)
downloadgcc-d78006d9504c41f96a476457754563c2aa100b7a.zip
gcc-d78006d9504c41f96a476457754563c2aa100b7a.tar.gz
gcc-d78006d9504c41f96a476457754563c2aa100b7a.tar.bz2
[AArch64][7/14] Implement TARGET_SET_CURRENT_FUNCTION
* config/aarch64/aarch64.h (SWITCHABLE_TARGET): Define. * config/aarch64/aarch64.c: Include target-globals.h (aarch64_previous_fndecl): New variable. (aarch64_set_current_function): New function. (TARGET_SET_CURRENT_FUNCTION): Define. From-SVN: r226559
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/aarch64/aarch64.c56
-rw-r--r--gcc/config/aarch64/aarch64.h3
3 files changed, 67 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 985d7df..cb019c9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2015-08-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+ * config/aarch64/aarch64.h (SWITCHABLE_TARGET): Define.
+ * config/aarch64/aarch64.c: Include target-globals.h
+ (aarch64_previous_fndecl): New variable.
+ (aarch64_set_current_function): New function.
+ (TARGET_SET_CURRENT_FUNCTION): Define.
+
+2015-08-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
* config/aarch64/aarch64.opt (explicit_tune_core): New TargetVariable.
(explicit_arch): Likewise.
(x_aarch64_isa_flags): Likewise.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index caf50ea..d0d62e7 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -73,6 +73,7 @@
#include "tm-constrs.h"
#include "sched-int.h"
#include "cortex-a57-fma-steering.h"
+#include "target-globals.h"
/* This file should be included last. */
#include "target-def.h"
@@ -7910,6 +7911,58 @@ aarch64_option_print (FILE *file, int indent, struct cl_target_option *ptr)
aarch64_print_extension (file, isa_flags);
}
+static GTY(()) tree aarch64_previous_fndecl;
+
+/* Implement TARGET_SET_CURRENT_FUNCTION. Unpack the codegen decisions
+ like tuning and ISA features from the DECL_FUNCTION_SPECIFIC_TARGET
+ of the function, if such exists. This function may be called multiple
+ times on a single function so use aarch64_previous_fndecl to avoid
+ setting up identical state. */
+
+static void
+aarch64_set_current_function (tree fndecl)
+{
+ tree old_tree = (aarch64_previous_fndecl
+ ? DECL_FUNCTION_SPECIFIC_TARGET (aarch64_previous_fndecl)
+ : NULL_TREE);
+
+ tree new_tree = (fndecl
+ ? DECL_FUNCTION_SPECIFIC_TARGET (fndecl)
+ : NULL_TREE);
+
+
+ if (fndecl && fndecl != aarch64_previous_fndecl)
+ {
+ aarch64_previous_fndecl = fndecl;
+ if (old_tree == new_tree)
+ ;
+
+ else if (new_tree && new_tree != target_option_default_node)
+ {
+ cl_target_option_restore (&global_options,
+ TREE_TARGET_OPTION (new_tree));
+ if (TREE_TARGET_GLOBALS (new_tree))
+ restore_target_globals (TREE_TARGET_GLOBALS (new_tree));
+ else
+ TREE_TARGET_GLOBALS (new_tree)
+ = save_target_globals_default_opts ();
+ }
+
+ else if (old_tree && old_tree != target_option_default_node)
+ {
+ new_tree = target_option_current_node;
+ cl_target_option_restore (&global_options,
+ TREE_TARGET_OPTION (new_tree));
+ if (TREE_TARGET_GLOBALS (new_tree))
+ restore_target_globals (TREE_TARGET_GLOBALS (new_tree));
+ else if (new_tree == target_option_default_node)
+ restore_target_globals (&default_target_globals);
+ else
+ TREE_TARGET_GLOBALS (new_tree)
+ = save_target_globals_default_opts ();
+ }
+ }
+}
/* Return true if SYMBOL_REF X binds locally. */
@@ -12425,6 +12478,9 @@ aarch64_promoted_type (const_tree t)
#undef TARGET_OPTION_PRINT
#define TARGET_OPTION_PRINT aarch64_option_print
+#undef TARGET_SET_CURRENT_FUNCTION
+#define TARGET_SET_CURRENT_FUNCTION aarch64_set_current_function
+
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE aarch64_pass_by_reference
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 9333bdc..41f50fe 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -919,6 +919,9 @@ do { \
#define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) \
(FP_REGNUM_P (REGNO) && GET_MODE_SIZE (MODE) > 8)
+#undef SWITCHABLE_TARGET
+#define SWITCHABLE_TARGET 1
+
/* Check TLS Descriptors mechanism is selected. */
#define TARGET_TLS_DESC (aarch64_tls_dialect == TLS_DESCRIPTORS)