diff options
author | Ilya Enkovich <ilya.enkovich@intel.com> | 2015-04-08 10:44:59 +0000 |
---|---|---|
committer | Ilya Enkovich <ienkovich@gcc.gnu.org> | 2015-04-08 10:44:59 +0000 |
commit | 4f5a53cc319d8b88eaff3ee07ac0a89e5782d850 (patch) | |
tree | 3b12f9e0a29bd3d514d93f2c8bdb05d2c21c7962 /gcc/tree-chkp.c | |
parent | 113c69ff2d41091359ec37789974cc47f1169e05 (diff) | |
download | gcc-4f5a53cc319d8b88eaff3ee07ac0a89e5782d850.zip gcc-4f5a53cc319d8b88eaff3ee07ac0a89e5782d850.tar.gz gcc-4f5a53cc319d8b88eaff3ee07ac0a89e5782d850.tar.bz2 |
tree-chkp.h (chkp_insert_retbnd_call): New.
gcc/
* tree-chkp.h (chkp_insert_retbnd_call): New.
* tree-chkp.c (chkp_insert_retbnd_call): New.
* ipa-split.c (insert_bndret_call_after): Remove.
(split_function): Use chkp_insert_retbnd_call.
* cgraphunit.c (cgraph_node::expand_thunk): Build returned
bounds for instrumented functions.
gcc/testsuite/
* gcc/testsuite/gcc.target/i386/thunk-retbnd.c: New.
From-SVN: r221917
Diffstat (limited to 'gcc/tree-chkp.c')
-rw-r--r-- | gcc/tree-chkp.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index 03f75b3..541af29 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -500,6 +500,35 @@ chkp_expand_bounds_reset_for_mem (tree mem, tree ptr) expand_normal (bndstx); } +/* Build retbnd call for returned value RETVAL. + + If BNDVAL is not NULL then result is stored + in it. Otherwise a temporary is created to + hold returned value. + + GSI points to a position for a retbnd call + and is set to created stmt. + + Cgraph edge is created for a new call if + UPDATE_EDGE is 1. + + Obtained bounds are returned. */ +tree +chkp_insert_retbnd_call (tree bndval, tree retval, + gimple_stmt_iterator *gsi) +{ + gimple call; + + if (!bndval) + bndval = create_tmp_reg (pointer_bounds_type_node, "retbnd"); + + call = gimple_build_call (chkp_ret_bnd_fndecl, 1, retval); + gimple_call_set_lhs (call, bndval); + gsi_insert_after (gsi, call, GSI_CONTINUE_LINKING); + + return bndval; +} + /* Mark statement S to not be instrumented. */ static void chkp_mark_stmt (gimple s) |