aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2018-12-19 10:16:41 +0000
committerTom de Vries <vries@gcc.gnu.org>2018-12-19 10:16:41 +0000
commit43be05f54315b889662bb4f8c085cce301a03862 (patch)
tree7a393820a831d95da5b428b74fb288ac1d00c2c4
parent5a8d95cc43f3ff425fa58bf4025a8527320fb46c (diff)
downloadgcc-43be05f54315b889662bb4f8c085cce301a03862.zip
gcc-43be05f54315b889662bb4f8c085cce301a03862.tar.gz
gcc-43be05f54315b889662bb4f8c085cce301a03862.tar.bz2
[nvptx] Use TARGET_SET_CURRENT_FUNCTION
Implement TARGET_SET_CURRENT_FUNCTION for nvptx. This gives us a place to add initialization or reset actions that need to be executed on a per-function basis. Build and reg-tested on x86_64 with nvptx accelerator. 2018-12-19 Tom de Vries <tdevries@suse.de> * config/nvptx/nvptx.c (nvptx_previous_fndecl): Declare. (nvptx_set_current_function): New function. (TARGET_SET_CURRENT_FUNCTION): Define. From-SVN: r267256
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/nvptx/nvptx.c14
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 524ad19..82f381a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-19 Tom de Vries <tdevries@suse.de>
+
+ * config/nvptx/nvptx.c (nvptx_previous_fndecl): Declare.
+ (nvptx_set_current_function): New function.
+ (TARGET_SET_CURRENT_FUNCTION): Define.
+
2018-12-19 Shaokun Zhang <zhangshaokun@hisilicon.com>
* config/aarch64/aarch64-cores.def (tsv110): Fix architecture. This
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 74ca0f5..9f834d3 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -5980,6 +5980,17 @@ nvptx_can_change_mode_class (machine_mode, machine_mode, reg_class_t)
return false;
}
+static GTY(()) tree nvptx_previous_fndecl;
+
+static void
+nvptx_set_current_function (tree fndecl)
+{
+ if (!fndecl || fndecl == nvptx_previous_fndecl)
+ return;
+
+ nvptx_previous_fndecl = fndecl;
+}
+
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE nvptx_option_override
@@ -6116,6 +6127,9 @@ nvptx_can_change_mode_class (machine_mode, machine_mode, reg_class_t)
#undef TARGET_HAVE_SPECULATION_SAFE_VALUE
#define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
+#undef TARGET_SET_CURRENT_FUNCTION
+#define TARGET_SET_CURRENT_FUNCTION nvptx_set_current_function
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-nvptx.h"