aboutsummaryrefslogtreecommitdiff
path: root/gcc/sanopt.c
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde@tbsaunde.org>2015-09-20 00:52:59 +0000
committerTrevor Saunders <tbsaunde@gcc.gnu.org>2015-09-20 00:52:59 +0000
commit355fe0884b8097c32e859f0df57c83bde0c6bd26 (patch)
treeaadb7908b4b80ecaf7e744ca1ae42a59a12b07ea /gcc/sanopt.c
parente4f2a3e4588bbc3691b452d8a2c520e8196b0ef3 (diff)
downloadgcc-355fe0884b8097c32e859f0df57c83bde0c6bd26.zip
gcc-355fe0884b8097c32e859f0df57c83bde0c6bd26.tar.gz
gcc-355fe0884b8097c32e859f0df57c83bde0c6bd26.tar.bz2
switch from gimple to gimple*
This renames the gimple_statement_base struct to gimple removes the typedef of gimple_statement_base * to gimple, and then adjusts all of the places that use the type. gcc/ChangeLog: 2015-09-19 Trevor Saunders <tbsaunde@tbsaunde.org> * coretypes.h (gimple): Change typedef to be a forward declaration. * gimple.h (gimple_statement_base): rename to gimple. * (all functions and types using gimple): Adjust. * *.[ch]: Likewise. gcc/cp/ChangeLog: 2015-09-19 Trevor Saunders <tbsaunde@tbsaunde.org> * cp-gimplify.c (gimplify_must_not_throw_expr): Adjust. From-SVN: r227941
Diffstat (limited to 'gcc/sanopt.c')
-rw-r--r--gcc/sanopt.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/gcc/sanopt.c b/gcc/sanopt.c
index 269c11d..1ef556b 100644
--- a/gcc/sanopt.c
+++ b/gcc/sanopt.c
@@ -81,7 +81,7 @@ maybe_get_single_definition (tree t)
{
if (TREE_CODE (t) == SSA_NAME)
{
- gimple g = SSA_NAME_DEF_STMT (t);
+ gimple *g = SSA_NAME_DEF_STMT (t);
if (gimple_assign_single_p (g))
return gimple_assign_rhs1 (g);
}
@@ -151,16 +151,16 @@ struct sanopt_ctx
{
/* This map maps a pointer (the first argument of UBSAN_NULL) to
a vector of UBSAN_NULL call statements that check this pointer. */
- hash_map<tree, auto_vec<gimple> > null_check_map;
+ hash_map<tree, auto_vec<gimple *> > null_check_map;
/* This map maps a pointer (the second argument of ASAN_CHECK) to
a vector of ASAN_CHECK call statements that check the access. */
- hash_map<tree_operand_hash, auto_vec<gimple> > asan_check_map;
+ hash_map<tree_operand_hash, auto_vec<gimple *> > asan_check_map;
/* This map maps a tree triplet (the first, second and fourth argument
of UBSAN_VPTR) to a vector of UBSAN_VPTR call statements that check
that virtual table pointer. */
- hash_map<sanopt_tree_triplet_hash, auto_vec<gimple> > vptr_check_map;
+ hash_map<sanopt_tree_triplet_hash, auto_vec<gimple *> > vptr_check_map;
/* Number of IFN_ASAN_CHECK statements. */
int asan_num_accesses;
@@ -214,7 +214,7 @@ imm_dom_path_with_freeing_call (basic_block bb, basic_block dom)
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (e->src); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple *stmt = gsi_stmt (gsi);
if (is_gimple_call (stmt) && !nonfreeing_call_p (stmt))
{
@@ -265,12 +265,12 @@ imm_dom_path_with_freeing_call (basic_block bb, basic_block dom)
/* Get the first dominating check from the list of stored checks.
Non-dominating checks are silently dropped. */
-static gimple
-maybe_get_dominating_check (auto_vec<gimple> &v)
+static gimple *
+maybe_get_dominating_check (auto_vec<gimple *> &v)
{
for (; !v.is_empty (); v.pop ())
{
- gimple g = v.last ();
+ gimple *g = v.last ();
sanopt_info *si = (sanopt_info *) gimple_bb (g)->aux;
if (!si->visited_p)
/* At this point we shouldn't have any statements
@@ -283,7 +283,7 @@ maybe_get_dominating_check (auto_vec<gimple> &v)
/* Optimize away redundant UBSAN_NULL calls. */
static bool
-maybe_optimize_ubsan_null_ifn (struct sanopt_ctx *ctx, gimple stmt)
+maybe_optimize_ubsan_null_ifn (struct sanopt_ctx *ctx, gimple *stmt)
{
gcc_assert (gimple_call_num_args (stmt) == 3);
tree ptr = gimple_call_arg (stmt, 0);
@@ -291,8 +291,8 @@ maybe_optimize_ubsan_null_ifn (struct sanopt_ctx *ctx, gimple stmt)
gcc_assert (TREE_CODE (cur_align) == INTEGER_CST);
bool remove = false;
- auto_vec<gimple> &v = ctx->null_check_map.get_or_insert (ptr);
- gimple g = maybe_get_dominating_check (v);
+ auto_vec<gimple *> &v = ctx->null_check_map.get_or_insert (ptr);
+ gimple *g = maybe_get_dominating_check (v);
if (!g)
{
/* For this PTR we don't have any UBSAN_NULL stmts recorded, so there's
@@ -339,7 +339,7 @@ maybe_optimize_ubsan_null_ifn (struct sanopt_ctx *ctx, gimple stmt)
when we can actually optimize. */
static bool
-maybe_optimize_ubsan_vptr_ifn (struct sanopt_ctx *ctx, gimple stmt)
+maybe_optimize_ubsan_vptr_ifn (struct sanopt_ctx *ctx, gimple *stmt)
{
gcc_assert (gimple_call_num_args (stmt) == 5);
sanopt_tree_triplet triplet;
@@ -347,8 +347,8 @@ maybe_optimize_ubsan_vptr_ifn (struct sanopt_ctx *ctx, gimple stmt)
triplet.t2 = gimple_call_arg (stmt, 1);
triplet.t3 = gimple_call_arg (stmt, 3);
- auto_vec<gimple> &v = ctx->vptr_check_map.get_or_insert (triplet);
- gimple g = maybe_get_dominating_check (v);
+ auto_vec<gimple *> &v = ctx->vptr_check_map.get_or_insert (triplet);
+ gimple *g = maybe_get_dominating_check (v);
if (!g)
{
/* For this PTR we don't have any UBSAN_VPTR stmts recorded, so there's
@@ -364,11 +364,11 @@ maybe_optimize_ubsan_vptr_ifn (struct sanopt_ctx *ctx, gimple stmt)
if preceded by checks in V. */
static bool
-can_remove_asan_check (auto_vec<gimple> &v, tree len, basic_block bb)
+can_remove_asan_check (auto_vec<gimple *> &v, tree len, basic_block bb)
{
unsigned int i;
- gimple g;
- gimple to_pop = NULL;
+ gimple *g;
+ gimple *to_pop = NULL;
bool remove = false;
basic_block last_bb = bb;
bool cleanup = false;
@@ -443,7 +443,7 @@ can_remove_asan_check (auto_vec<gimple> &v, tree len, basic_block bb)
/* Optimize away redundant ASAN_CHECK calls. */
static bool
-maybe_optimize_asan_check_ifn (struct sanopt_ctx *ctx, gimple stmt)
+maybe_optimize_asan_check_ifn (struct sanopt_ctx *ctx, gimple *stmt)
{
gcc_assert (gimple_call_num_args (stmt) == 4);
tree ptr = gimple_call_arg (stmt, 1);
@@ -458,10 +458,10 @@ maybe_optimize_asan_check_ifn (struct sanopt_ctx *ctx, gimple stmt)
gimple_set_uid (stmt, info->freeing_call_events);
- auto_vec<gimple> *ptr_checks = &ctx->asan_check_map.get_or_insert (ptr);
+ auto_vec<gimple *> *ptr_checks = &ctx->asan_check_map.get_or_insert (ptr);
tree base_addr = maybe_get_single_definition (ptr);
- auto_vec<gimple> *base_checks = NULL;
+ auto_vec<gimple *> *base_checks = NULL;
if (base_addr)
{
base_checks = &ctx->asan_check_map.get_or_insert (base_addr);
@@ -469,8 +469,8 @@ maybe_optimize_asan_check_ifn (struct sanopt_ctx *ctx, gimple stmt)
ptr_checks = ctx->asan_check_map.get (ptr);
}
- gimple g = maybe_get_dominating_check (*ptr_checks);
- gimple g2 = NULL;
+ gimple *g = maybe_get_dominating_check (*ptr_checks);
+ gimple *g2 = NULL;
if (base_checks)
/* Try with base address as well. */
@@ -525,7 +525,7 @@ sanopt_optimize_walker (basic_block bb, struct sanopt_ctx *ctx)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
- gimple stmt = gsi_stmt (gsi);
+ gimple *stmt = gsi_stmt (gsi);
bool remove = false;
if (!is_gimple_call (stmt))
@@ -667,7 +667,7 @@ pass_sanopt::execute (function *fun)
FOR_EACH_BB_FN (bb, fun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple *stmt = gsi_stmt (gsi);
if (is_gimple_call (stmt) && gimple_call_internal_p (stmt)
&& gimple_call_internal_fn (stmt) == IFN_ASAN_CHECK)
++asan_num_accesses;
@@ -682,7 +682,7 @@ pass_sanopt::execute (function *fun)
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
- gimple stmt = gsi_stmt (gsi);
+ gimple *stmt = gsi_stmt (gsi);
bool no_next = false;
if (!is_gimple_call (stmt))