This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, MPX, 2/X] Pointers Checker [14/25] Function splitting


Hi,

Here is a patch to disable splitting when bounds transfer is required for splitted function.

Thanks,
Ilya
--
2013-11-13  Ilya Enkovich  <ilya.enkovich@intel.com>

	* ipa-split.c: Include tree-chkp.h.
	(consider_split): Do not split when splitted
	part needs bounds transfer.


diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index e55b3f5..1c3df61 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -101,6 +101,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-pretty-print.h"
 #include "ipa-inline.h"
 #include "cfgloop.h"
+#include "tree-chkp.h"
 
 /* Per basic block info.  */
 
@@ -378,6 +379,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
   int incoming_freq = 0;
   tree retval;
   bool back_edge = false;
+  bitmap_iterator bi;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     dump_split_point (dump_file, current);
@@ -486,6 +488,28 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
   if (!VOID_TYPE_P (TREE_TYPE (current_function_decl)))
     call_overhead += estimate_move_cost (TREE_TYPE (current_function_decl));
 
+  /* Currently bounds passing and return is not supported for
+     splitted functions.  */
+  EXECUTE_IF_SET_IN_BITMAP (current->ssa_names_to_pass, 0, i, bi)
+    {
+      if (POINTER_BOUNDS_P (ssa_name (i)))
+	{
+	  if (dump_file && (dump_flags & TDF_DETAILS))
+	    fprintf (dump_file,
+		     "  Refused: need to pass bounds\n");
+	  return;
+	}
+    }
+
+  if (chkp_function_instrumented_p (current_function_decl)
+      && chkp_type_has_pointer (TREE_TYPE (current_function_decl)))
+    {
+      if (dump_file && (dump_flags & TDF_DETAILS))
+	fprintf (dump_file,
+		 "  Refused: need to return bounds\n");
+      return;
+    }
+
   if (current->split_size <= call_overhead)
     {
       if (dump_file && (dump_flags & TDF_DETAILS))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]