diff mbox

[12/12] always define ENABLE_OFFLOADING

Message ID 1447087669-14039-13-git-send-email-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org Nov. 9, 2015, 4:47 p.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/cp/ChangeLog:

2015-11-09  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* parser.c (cp_parser_omp_declare_target): Adjust.

gcc/ChangeLog:

2015-11-09  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* configure: Regenerate.
	* configure.ac: Always define ENABLE_OFFLOADING.
	* cgraph.c (cgraph_node::create): Adjust.
	* gcc.c (process_command): Likewise.
	* omp-low.c (create_omp_child_function): Likewise.
	(expand_omp_target): Likewise.
	* varpool.c (varpool_node::get_create): Likewise.

gcc/c/ChangeLog:

2015-11-09  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* c-parser.c (c_parser_omp_declare_target): Adjust.
---
 gcc/c/c-parser.c | 13 +++++++------
 gcc/cgraph.c     |  5 ++---
 gcc/configure    |  8 ++++++--
 gcc/configure.ac |  3 +++
 gcc/cp/parser.c  | 13 +++++++------
 gcc/gcc.c        |  2 --
 gcc/omp-low.c    | 16 +++++++---------
 gcc/varpool.c    | 13 +++++++------
 8 files changed, 39 insertions(+), 34 deletions(-)

Comments

Bernd Schmidt Nov. 9, 2015, 6:41 p.m. UTC | #1
On 11/09/2015 05:47 PM, tbsaunde+gcc@tbsaunde.org wrote:
> -#ifdef ENABLE_OFFLOADING
>     /* If the user didn't specify any, default to all configured offload
>        targets.  */
>     if (offload_targets == NULL)
>       handle_foffload_option (OFFLOAD_TARGETS);
> -#endif

This one I would keep guarded with an if.

Otherwise ok modulo stage 1 end.


Bernd
diff mbox

Patch

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 23d0107..d7633be 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -15891,14 +15891,15 @@  c_parser_omp_declare_target (c_parser *parser)
 	  if (node != NULL)
 	    {
 	      node->offloadable = 1;
-#ifdef ENABLE_OFFLOADING
-	      g->have_offload = true;
-	      if (is_a <varpool_node *> (node))
+	      if (ENABLE_OFFLOADING)
 		{
-		  vec_safe_push (offload_vars, t);
-		  node->force_output = 1;
+		  g->have_offload = true;
+		  if (is_a <varpool_node *> (node))
+		    {
+		      vec_safe_push (offload_vars, t);
+		      node->force_output = 1;
+		    }
 		}
-#endif
 	    }
 	}
     }
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 7839c72..b1228a2 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -499,9 +499,8 @@  cgraph_node::create (tree decl)
       && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
     {
       node->offloadable = 1;
-#ifdef ENABLE_OFFLOADING
-      g->have_offload = true;
-#endif
+      if (ENABLE_OFFLOADING)
+	g->have_offload = true;
     }
 
   node->register_symbol ();
diff --git a/gcc/configure b/gcc/configure
index 14d828c..c18c1fe 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -7715,6 +7715,10 @@  if test x"$offload_targets" != x; then
 
 $as_echo "#define ENABLE_OFFLOADING 1" >>confdefs.h
 
+else
+
+$as_echo "#define ENABLE_OFFLOADING 0" >>confdefs.h
+
 fi
 
 
@@ -18402,7 +18406,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18405 "configure"
+#line 18409 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18508,7 +18512,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18511 "configure"
+#line 18515 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 626eea2..d0cece5 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -951,6 +951,9 @@  AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
 if test x"$offload_targets" != x; then
   AC_DEFINE(ENABLE_OFFLOADING, 1,
     [Define this to enable support for offloading.])
+else
+  AC_DEFINE(ENABLE_OFFLOADING, 0,
+    [Define this to enable support for offloading.])
 fi
 
 AC_ARG_WITH(multilib-list,
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d1f4970..b747563 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -34995,14 +34995,15 @@  cp_parser_omp_declare_target (cp_parser *parser, cp_token *pragma_tok)
 	  if (node != NULL)
 	    {
 	      node->offloadable = 1;
-#ifdef ENABLE_OFFLOADING
-	      g->have_offload = true;
-	      if (is_a <varpool_node *> (node))
+	      if (ENABLE_OFFLOADING)
 		{
-		  vec_safe_push (offload_vars, t);
-		  node->force_output = 1;
+		  g->have_offload = true;
+		  if (is_a <varpool_node *> (node))
+		    {
+		      vec_safe_push (offload_vars, t);
+		      node->force_output = 1;
+		    }
 		}
-#endif
 	    }
 	}
     }
diff --git a/gcc/gcc.c b/gcc/gcc.c
index bdd64a6..979c539 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4382,12 +4382,10 @@  process_command (unsigned int decoded_options_count,
 			   CL_DRIVER, &handlers, global_dc);
     }
 
-#ifdef ENABLE_OFFLOADING
   /* If the user didn't specify any, default to all configured offload
      targets.  */
   if (offload_targets == NULL)
     handle_foffload_option (OFFLOAD_TARGETS);
-#endif
 
   if (output_file
       && strcmp (output_file, "-") != 0
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 45d1927..d58c98b 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2436,9 +2436,9 @@  create_omp_child_function (omp_context *ctx, bool task_copy)
 	if (is_gimple_omp_offloaded (octx->stmt))
 	  {
 	    cgraph_node::get_create (decl)->offloadable = 1;
-#ifdef ENABLE_OFFLOADING
-	    g->have_offload = true;
-#endif
+	    if (ENABLE_OFFLOADING)
+	      g->have_offload = true;
+
 	    break;
 	  }
     }
@@ -12591,10 +12591,9 @@  expand_omp_target (struct omp_region *region)
       node->parallelized_function = 1;
       cgraph_node::add_new_function (child_fn, true);
 
-#ifdef ENABLE_OFFLOADING
       /* Add the new function to the offload table.  */
-      vec_safe_push (offload_funcs, child_fn);
-#endif
+      if (ENABLE_OFFLOADING)
+	vec_safe_push (offload_funcs, child_fn);
 
       bool need_asm = DECL_ASSEMBLER_NAME_SET_P (current_function_decl)
 		      && !DECL_ASSEMBLER_NAME_SET_P (child_fn);
@@ -12606,11 +12605,10 @@  expand_omp_target (struct omp_region *region)
 	assign_assembler_name_if_neeeded (child_fn);
       cgraph_edge::rebuild_edges ();
 
-#ifdef ENABLE_OFFLOADING
       /* Prevent IPA from removing child_fn as unreachable, since there are no
 	 refs from the parent function to child_fn in offload LTO mode.  */
-      cgraph_node::get (child_fn)->mark_force_output ();
-#endif
+      if (ENABLE_OFFLOADING)
+	cgraph_node::get (child_fn)->mark_force_output ();
 
       /* Some EH regions might become dead, see PR34608.  If
 	 pass_cleanup_cfg isn't the first pass to happen with the
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 478f365..36f19a6 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -153,12 +153,13 @@  varpool_node::get_create (tree decl)
       && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
     {
       node->offloadable = 1;
-#ifdef ENABLE_OFFLOADING
-      g->have_offload = true;
-      if (!in_lto_p)
-	vec_safe_push (offload_vars, decl);
-      node->force_output = 1;
-#endif
+      if (ENABLE_OFFLOADING)
+	{
+	  g->have_offload = true;
+	  if (!in_lto_p)
+	    vec_safe_push (offload_vars, decl);
+	  node->force_output = 1;
+	}
     }
 
   node->register_symbol ();