This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, MPX, 2/X] Pointers Checker [14/25] Function splitting
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 Nov 2013 14:22:08 +0400
- Subject: [PATCH, MPX, 2/X] Pointers Checker [14/25] Function splitting
- Authentication-results: sourceware.org; auth=none
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))