2012-11-22 22:56:58 +01:00
|
|
|
/* GCC instrumentation plugin for ThreadSanitizer.
|
2017-01-01 13:07:43 +01:00
|
|
|
Copyright (C) 2011-2017 Free Software Foundation, Inc.
|
2012-11-22 22:56:58 +01:00
|
|
|
Contributed by Dmitry Vyukov <dvyukov@google.com>
|
|
|
|
|
|
|
|
This file is part of GCC.
|
|
|
|
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
2015-07-08 02:53:03 +02:00
|
|
|
#include "backend.h"
|
2015-10-29 14:57:32 +01:00
|
|
|
#include "rtl.h"
|
2012-11-22 22:56:58 +01:00
|
|
|
#include "tree.h"
|
2016-09-26 19:20:39 +02:00
|
|
|
#include "memmodel.h"
|
2015-07-08 02:53:03 +02:00
|
|
|
#include "gimple.h"
|
2015-10-29 14:57:32 +01:00
|
|
|
#include "tree-pass.h"
|
2015-07-08 02:53:03 +02:00
|
|
|
#include "ssa.h"
|
2015-10-29 14:57:32 +01:00
|
|
|
#include "cgraph.h"
|
2015-07-08 02:53:03 +02:00
|
|
|
#include "fold-const.h"
|
gimple-expr.h (create_tmp_var_name, [...]): Relocate prototypes from gimple.h.
2013-11-12 Andrew MacLeod <amacleod@redhat.com>
* gimple-expr.h (create_tmp_var_name, create_tmp_var_raw,
create_tmp_var, create_tmp_reg, mark_addressable, is_gimple_reg_rhs):
Relocate prototypes from gimple.h.
* gimplify.h: New File. Relocate some prototypes from gimple.h here.
(gimple_predicate, enum fallback, enum gimplify_status): Relocate
from gimple.h.
* gimple.h: Move some prototypes to gimplify.h.
(gimple_predicate, enum fallback, enum gimplify_status): Move to
gimplify.h.
(gimple_do_not_emit_location_p, gimple_set_do_not_emit_location):
Relocate from gimpify.c.
* gimple-expr.c (remove_suffix, tmp_var_id_num, create_tmp_var_name,
create_tmp_var_raw, create_tmp_var, create_tmp_reg, mark_addressable,
is_gimple_reg_rhs) Relocate from gimplify.c.
* gimplify.c (mark_addressable): Move to gimple-expr.c.
(gimple_seq_add_stmt_without_update): Move to gimple.c.
(remove_suffix, tmp_var_id_num, create_tmp_var_name, create_tmp_var_raw,
create_tmp_var, create_tmp_reg, is_gimple_reg_rhs): Move to
gimple-expr.c.
(should_carry_location_p): Move to gimple.c.
(gimple_do_not_emit_location_p, gimple_set_do_not_emit_location): Move
to gimple.h.
(annotate_one_with_location, annotate_all_with_location_after,
annotate_all_with_location): Move to gimple.c.
(compare_case_labels, sort_case_labels,
preprocess_case_label_vec_for_gimple): Move to gimple.c.
(rhs_predicate_for): Make static.
(gimplify_assign): Relocate from gimple.c.
* gimple.c (gimplify_assign): Move to gimplify.c.
(gimple_seq_add_stmt_without_update, should_carry_location_p,
annotate_one_with_location, annotate_all_with_location_after,
annotate_all_with_location, compare_case_labels, sort_case_labels,
preprocess_case_label_vec_for_gimple): Relocate from gimplify.c.
* tree.h (unshare_expr, unshare_expr_without_location,
mark_addressable): Move prototypes to gimplify.h.
* Makefile.in (GTFILES): gimple-expr.c now has the GTY tag for
tmp_var_id_num
* asan.c: Include gimplify.h rather than gimple.h.
* cfgloopmanip.c: Likewise.
* cgraphunit.c: Likewise.
* cilk-common.c: Likewise.
* dwarf2out.c: Dont include gimple.h.
* fold-const.c: Include gimplify.h rather than gimple.h.
* function.c: Likewise.
* gimple-fold.c: Likewise.
* gimple-ssa-strength-reduction.c: Likewise.
* graphite-clast-to-gimple.c: Likewise.
* graphite-sese-to-poly.c: Likewise.
* ipa-prop.c: Likewise.
* ipa-split.c: Likewise.
* ipa.c: Likewise.
* langhooks.c: Dont include gimple.h.
* loop-init.c: Include gimplify.h rather than gimple.h.
* omp-low.c: Likewise.
* sese.c: Likewise.
* stor-layout.c: Likewise.
* targhooks.c: Likewise.
* trans-mem.c: Likewise.
* tree-affine.c: Likewise.
* tree-cfg.c: Likewise.
* tree-cfgcleanup.c: Likewise.
* tree-complex.c: Likewise.
* tree-if-conv.c: Likewise.
* tree-inline.c: Likewise.
* tree-iterator.c: Likewise.
* tree-loop-distribution.c: Likewise.
* tree-nested.c: Likewise.
* tree-parloops.c: Likewise.
* tree-predcom.c: Likewise.
* tree-profile.c: Likewise.
* tree-scalar-evolution.c: Likewise.
* tree-sra.c: Likewise.
* tree-ssa-address.c: Likewise.
* tree-ssa-ccp.c: Likewise.
* tree-ssa-dce.c: Likewise.
* tree-ssa-forwprop.c: Likewise.
* tree-ssa-ifcombine.c: Likewise.
* tree-ssa-loop-im.c: Likewise.
* tree-ssa-loop-ivopts.c: Likewise.
* tree-ssa-loop-manip.c: Likewise.
* tree-ssa-loop-niter.c: Likewise.
* tree-ssa-loop-prefetch.c: Likewise.
* tree-ssa-loop-unswitch.c: Likewise.
* tree-ssa-math-opts.c: Likewise.
* tree-ssa-phiopt.c: Likewise.
* tree-ssa-phiprop.c: Likewise.
* tree-ssa-pre.c: Likewise.
* tree-ssa-propagate.c: Likewise.
* tree-ssa-reassoc.c: Likewise.
* tree-ssa-sccvn.c: Likewise.
* tree-ssa-strlen.c: Likewise.
* tree-ssa.c: Likewise.
* tree-switch-conversio: Likewise.n.c
* tree-tailcall.c: Likewise.
* tree-vect-data-refs.c: Likewise.
* tree-vect-generic.c: Likewise.
* tree-vect-loop-manip.c: Likewise.
* tree-vect-loop.c: Likewise.
* tree-vect-patterns.c: Likewise.
* tree-vect-stmts.c: Likewise.
* tsan.c: Likewise.
* value-prof.c: Likewise.
* config/aarch64/aarch64.c: Include gimplify.h instead of gimple.h.
* config/alpha/alpha.c: Likewise.
* config/darwin.c: Likewise.
* config/i386/i386.c: Likewise.
* config/ia64/ia64.c: Likewise.
* config/mep/mep.c: Likewise.
* config/mips/mips.c: Likewise.
* config/rs6000/rs6000.c: Likewise.
* config/s390/s390.c: Likewise.
* config/sh/sh.c: Likewise.
* config/sparc/sparc.c: Likewise.
* config/spu/spu.c: Likewise.
* config/stormy16/stormy16.c: Likewise.
* config/tilegx/tilegx.c: Likewise.
* config/tilepro/tilepro.c: Likewise.
* config/xtensa/xtensa.c: Likewise.
* ada/gcc-interface/trans.c: Include gimplify.h.
* c/c-typeck.c: Include gimplify.h.
* c-family/c-common.c: Include gimplify.h.
* c-family/c-gimplify.c: Likewise.
* c-family/cilk.c: Likewise.
* c-family/c-omp.c: Include gimple-expr.h instead of gimple.h.
* c-family/c-ubsan.c: Don't include gimple.h.
* cp/class.c: Include gimplify.h.
* cp/cp-gimplify.c: Likewise.
* cp/error.c: Likewise.
* cp/init.c: Likewise.
* cp/optimize.c: Likewise.
* cp/pt.c: Likewise.
* cp/semantics.c: Likewise.
* cp/tree.c: Likewise.
* cp/vtable-class-hierarchy.c: Likewise.
* cp/decl2.c: Don't include gimple.h.
* cp/except.c: Likewise.
* cp/method.c: Include pointer-set.h instead of gimple.h.
* fortran/f95-lang.c: Don't include gimple.h.
* fortran/trans-array.c: Include gimple-expr.h instead of gimple.h.
* fortran/trans.c: Likewise.
* fortran/trans-decl.c: Likewise.
* fortran/trans-expr.c: Include gimplify.h.
* fortran/trans-openmp.c: Likewise.
* go/go-lang.c: Include gimplify.h.
* java/java-gimplify.c: Include gimplify.h.
* objc/objc-act.c: Include gimplify.h.
From-SVN: r204717
2013-11-12 21:26:43 +01:00
|
|
|
#include "gimplify.h"
|
gimple-walk.h: New File.
* gimple-walk.h: New File. Relocate prototypes from gimple.h.
(struct walk_stmt_info): Relocate here from gimple.h.
* gimple-iterator.h: New File. Relocate prototypes from gimple.h.
(struct gimple_stmt_iterator_d): Relocate here from gimple.h.
(gsi_start_1, gsi_none, gsi_start_bb, gsi_last_1, gsi_last_bb,
gsi_end_p, gsi_one_before_end_p, gsi_next, gsi_prev, gsi_stmt,
gsi_after_labels, gsi_next_nondebug, gsi_prev_nondebug,
gsi_start_nondebug_bb, gsi_start_nondebug_after_labels_bb,
gsi_last_nondebug_bb, gsi_bb, gsi_seq): Relocate here from gimple.h.
* gimple.h (struct gimple_stmt_iterator_d): Move to gimple-iterator.h.
(gsi_start_1, gsi_none, gsi_start_bb, gsi_last_1, gsi_last_bb,
gsi_end_p, gsi_one_before_end_p, gsi_next, gsi_prev, gsi_stmt,
gsi_after_labels, gsi_next_nondebug, gsi_prev_nondebug,
gsi_start_nondebug_bb, gsi_start_nondebug_after_labels_bb,
gsi_last_nondebug_bb, gsi_bb, gsi_seq): Move to gimple-iterator.h.
(struct walk_stmt_info): Move to gimple-walk.h.
(gimple_seq_set_location): Move to gimple.c
* gimple-walk.c: New File.
(walk_gimple_seq_mod, walk_gimple_seq, walk_gimple_asm, walk_gimple_op,
walk_gimple_stmt, get_base_loadstore, walk_stmt_load_store_addr_ops,
walk_stmt_load_store_ops): Relocate here from gimple.c.
* gimple-iterator.c: Include gimple-iterator.h.
* gimple.c (walk_gimple_seq_mod, walk_gimple_seq, walk_gimple_asm,
walk_gimple_op, walk_gimple_stmt, get_base_loadstore,
walk_stmt_load_store_addr_ops, walk_stmt_load_store_ops): Move to
gimple-walk.c.
(gimple_seq_set_location): Relocate from gimple.h.
* tree-phinodes.h (set_phi_nodes): Move to tree-phinodes.c.
* tree-phinodes.c (set_phi_nodes): Relocate from tree-phinodes.h.
* gengtype.c (open_base_files): Add gimple-iterator.h to include list.
* Makefile.in (OBJS): Add gimple-walk.o
* asan.c: Update Include list as required for gimple-iterator.h and
gimple-walk.h.
* cfgexpand.c: Likewise.
* cfgloop.c: Likewise.
* cfgloopmanip.c: Likewise.
* cgraph.c: Likewise.
* cgraphbuild.c: Likewise.
* cgraphunit.c: Likewise.
* gimple-fold.c: Likewise.
* gimple-low.c: Likewise.
* gimple-pretty-print.c: Likewise.
* gimple-ssa-isolate-paths.c: Likewise.
* gimple-ssa-strength-reduction.c: Likewise.
* gimple-streamer-in.c: Likewise.
* gimple-streamer-out.c: Likewise.
* gimplify.c: Likewise.
* graphite-blocking.c: Likewise.
* graphite-clast-to-gimple.c: Likewise.
* graphite-dependences.c: Likewise.
* graphite-interchange.c: Likewise.
* graphite-optimize-isl.c: Likewise.
* graphite-poly.c: Likewise.
* graphite-scop-detection.c: Likewise.
* graphite-sese-to-poly.c: Likewise.
* graphite.c: Likewise.
* ipa-inline-analysis.c: Likewise.
* ipa-profile.c: Likewise.
* ipa-prop.c: Likewise.
* ipa-pure-const.c: Likewise.
* ipa-split.c: Likewise.
* lto-streamer-in.c: Likewise.
* lto-streamer-out.c: Likewise.
* omp-low.c: Likewise.
* predict.c: Likewise.
* profile.c: Likewise.
* sese.c: Likewise.
* tracer.c: Likewise.
* trans-mem.c: Likewise.
* tree-call-cdce.c: Likewise.
* tree-cfg.c: Likewise.
* tree-cfgcleanup.c: Likewise.
* tree-complex.c: Likewise.
* tree-data-ref.c: Likewise.
* tree-dfa.c: Likewise.
* tree-eh.c: Likewise.
* tree-emutls.c: Likewise.
* tree-if-conv.c: Likewise.
* tree-inline.c: Likewise.
* tree-into-ssa.c: Likewise.
* tree-loop-distribution.c: Likewise.
* tree-nested.c: Likewise.
* tree-nrv.c: Likewise.
* tree-object-size.c: Likewise.
* tree-outof-ssa.c: Likewise.
* tree-parloops.c: Likewise.
* tree-predcom.c: Likewise.
* tree-profile.c: Likewise.
* tree-scalar-evolution.c: Likewise.
* tree-sra.c: Likewise.
* tree-ssa-ccp.c: Likewise.
* tree-ssa-coalesce.c: Likewise.
* tree-ssa-copy.c: Likewise.
* tree-ssa-copyrename.c: Likewise.
* tree-ssa-dce.c: Likewise.
* tree-ssa-dom.c: Likewise.
* tree-ssa-dse.c: Likewise.
* tree-ssa-forwprop.c: Likewise.
* tree-ssa-ifcombine.c: Likewise.
* tree-ssa-live.c: Likewise.
* tree-ssa-loop-ch.c: Likewise.
* tree-ssa-loop-im.c: Likewise.
* tree-ssa-loop-ivcanon.c: Likewise.
* tree-ssa-loop-ivopts.c: Likewise.
* tree-ssa-loop-manip.c: Likewise.
* tree-ssa-loop-niter.c: Likewise.
* tree-ssa-loop-prefetch.c: Likewise.
* tree-ssa-loop.c: Likewise.
* tree-ssa-math-opts.c: Likewise.
* tree-ssa-phiopt.c: Likewise.
* tree-ssa-phiprop.c: Likewise.
* tree-ssa-pre.c: Likewise.
* tree-ssa-propagate.c: Likewise.
* tree-ssa-reassoc.c: Likewise.
* tree-ssa-sink.c: Likewise.
* tree-ssa-strlen.c: Likewise.
* tree-ssa-structalias.c: Likewise.
* tree-ssa-tail-merge.c: Likewise.
* tree-ssa-ter.c: Likewise.
* tree-ssa-threadedge.c: Likewise.
* tree-ssa-threadupdate.c: Likewise.
* tree-ssa-uncprop.c: Likewise.
* tree-ssa-uninit.c: Likewise.
* tree-ssa.c: Likewise.
* tree-stdarg.c: Likewise.
* tree-switch-conversion.c: Likewise.
* tree-tailcall.c: Likewise.
* tree-vect-data-refs.c: Likewise.
* tree-vect-generic.c: Likewise.
* tree-vect-loop-manip.c: Likewise.
* tree-vect-loop.c: Likewise.
* tree-vect-patterns.c: Likewise.
* tree-vect-slp.c: Likewise.
* tree-vect-stmts.c: Likewise.
* tree-vectorizer.c: Likewise.
* tree-vrp.c: Likewise.
* tree.c: Likewise.
* tsan.c: Likewise.
* value-prof.c: Likewise.
* vtable-verify.c: Likewise.
* config/aarch64/aarch64-builtins.c: Include gimple-iterator.h.
* config/rs6000/rs6000.c: Include gimple-iterator.h and gimple-walk.h.
* testsuite/g++.dg/plugin/selfassign.c: Include gimple-iterator.h.
* testsuite/gcc.dg/plugin/selfassign.c: Likewise.
From-SVN: r204763
2013-11-14 00:54:17 +01:00
|
|
|
#include "gimple-iterator.h"
|
2015-01-12 17:47:11 +01:00
|
|
|
#include "gimplify-me.h"
|
2013-10-23 14:16:58 +02:00
|
|
|
#include "tree-cfg.h"
|
2012-11-22 22:56:58 +01:00
|
|
|
#include "tree-iterator.h"
|
2012-12-04 14:20:20 +01:00
|
|
|
#include "tree-ssa-propagate.h"
|
2015-01-12 17:47:11 +01:00
|
|
|
#include "tree-ssa-loop-ivopts.h"
|
2017-03-22 19:34:44 +01:00
|
|
|
#include "tree-eh.h"
|
2012-12-03 18:28:10 +01:00
|
|
|
#include "tsan.h"
|
|
|
|
#include "asan.h"
|
2015-01-02 23:16:59 +01:00
|
|
|
#include "builtins.h"
|
2016-09-14 11:01:49 +02:00
|
|
|
#include "target.h"
|
2012-11-22 22:56:58 +01:00
|
|
|
|
|
|
|
/* Number of instrumented memory accesses in the current function. */
|
|
|
|
|
|
|
|
/* Builds the following decl
|
|
|
|
void __tsan_read/writeX (void *addr); */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
get_memory_access_decl (bool is_write, unsigned size)
|
|
|
|
{
|
|
|
|
enum built_in_function fcode;
|
|
|
|
|
|
|
|
if (size <= 1)
|
2012-12-03 18:28:10 +01:00
|
|
|
fcode = is_write ? BUILT_IN_TSAN_WRITE1
|
|
|
|
: BUILT_IN_TSAN_READ1;
|
2012-11-22 22:56:58 +01:00
|
|
|
else if (size <= 3)
|
2012-12-03 18:28:10 +01:00
|
|
|
fcode = is_write ? BUILT_IN_TSAN_WRITE2
|
|
|
|
: BUILT_IN_TSAN_READ2;
|
2012-11-22 22:56:58 +01:00
|
|
|
else if (size <= 7)
|
2012-12-03 18:28:10 +01:00
|
|
|
fcode = is_write ? BUILT_IN_TSAN_WRITE4
|
|
|
|
: BUILT_IN_TSAN_READ4;
|
2012-11-22 22:56:58 +01:00
|
|
|
else if (size <= 15)
|
2012-12-03 18:28:10 +01:00
|
|
|
fcode = is_write ? BUILT_IN_TSAN_WRITE8
|
|
|
|
: BUILT_IN_TSAN_READ8;
|
2012-11-22 22:56:58 +01:00
|
|
|
else
|
2012-12-03 18:28:10 +01:00
|
|
|
fcode = is_write ? BUILT_IN_TSAN_WRITE16
|
|
|
|
: BUILT_IN_TSAN_READ16;
|
2012-11-22 22:56:58 +01:00
|
|
|
|
|
|
|
return builtin_decl_implicit (fcode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check as to whether EXPR refers to a store to vptr. */
|
|
|
|
|
|
|
|
static tree
|
2015-09-20 02:52:59 +02:00
|
|
|
is_vptr_store (gimple *stmt, tree expr, bool is_write)
|
2012-11-22 22:56:58 +01:00
|
|
|
{
|
|
|
|
if (is_write == true
|
|
|
|
&& gimple_assign_single_p (stmt)
|
|
|
|
&& TREE_CODE (expr) == COMPONENT_REF)
|
|
|
|
{
|
|
|
|
tree field = TREE_OPERAND (expr, 1);
|
|
|
|
if (TREE_CODE (field) == FIELD_DECL
|
|
|
|
&& DECL_VIRTUAL_P (field))
|
|
|
|
return gimple_assign_rhs1 (stmt);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Instruments EXPR if needed. If any instrumentation is inserted,
|
2012-11-23 15:28:19 +01:00
|
|
|
return true. */
|
2012-11-22 22:56:58 +01:00
|
|
|
|
|
|
|
static bool
|
|
|
|
instrument_expr (gimple_stmt_iterator gsi, tree expr, bool is_write)
|
|
|
|
{
|
2012-12-04 14:25:07 +01:00
|
|
|
tree base, rhs, expr_ptr, builtin_decl;
|
2012-11-22 22:56:58 +01:00
|
|
|
basic_block bb;
|
|
|
|
HOST_WIDE_INT size;
|
2015-09-20 02:52:59 +02:00
|
|
|
gimple *stmt, *g;
|
2012-12-04 14:25:07 +01:00
|
|
|
gimple_seq seq;
|
2012-11-22 22:56:58 +01:00
|
|
|
location_t loc;
|
2015-01-02 23:16:59 +01:00
|
|
|
unsigned int align;
|
2012-11-22 22:56:58 +01:00
|
|
|
|
|
|
|
size = int_size_in_bytes (TREE_TYPE (expr));
|
2015-01-02 23:16:59 +01:00
|
|
|
if (size <= 0)
|
2012-11-22 22:56:58 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
HOST_WIDE_INT bitsize, bitpos;
|
|
|
|
tree offset;
|
decl.c, [...]: Remove redundant enum from machine_mode.
gcc/ada/
* gcc-interface/decl.c, gcc-interface/gigi.h, gcc-interface/misc.c,
gcc-interface/trans.c, gcc-interface/utils.c, gcc-interface/utils2.c:
Remove redundant enum from machine_mode.
gcc/c-family/
* c-common.c, c-common.h, c-cppbuiltin.c, c-lex.c: Remove redundant
enum from machine_mode.
gcc/c/
* c-decl.c, c-tree.h, c-typeck.c: Remove redundant enum from
machine_mode.
gcc/cp/
* constexpr.c: Remove redundant enum from machine_mode.
gcc/fortran/
* trans-types.c, trans-types.h: Remove redundant enum from
machine_mode.
gcc/go/
* go-lang.c: Remove redundant enum from machine_mode.
gcc/java/
* builtins.c, java-tree.h, typeck.c: Remove redundant enum from
machine_mode.
gcc/lto/
* lto-lang.c: Remove redundant enum from machine_mode.
gcc/
* addresses.h, alias.c, asan.c, auto-inc-dec.c, bt-load.c, builtins.c,
builtins.h, caller-save.c, calls.c, calls.h, cfgexpand.c, cfgloop.h,
cfgrtl.c, combine.c, compare-elim.c, config/aarch64/aarch64-builtins.c,
config/aarch64/aarch64-protos.h, config/aarch64/aarch64-simd.md,
config/aarch64/aarch64.c, config/aarch64/aarch64.h,
config/aarch64/aarch64.md, config/alpha/alpha-protos.h,
config/alpha/alpha.c, config/arc/arc-protos.h, config/arc/arc.c,
config/arc/arc.h, config/arc/predicates.md,
config/arm/aarch-common-protos.h, config/arm/aarch-common.c,
config/arm/arm-protos.h, config/arm/arm.c, config/arm/arm.h,
config/arm/arm.md, config/arm/neon.md, config/arm/thumb2.md,
config/avr/avr-log.c, config/avr/avr-protos.h, config/avr/avr.c,
config/avr/avr.md, config/bfin/bfin-protos.h, config/bfin/bfin.c,
config/c6x/c6x-protos.h, config/c6x/c6x.c, config/c6x/c6x.md,
config/cr16/cr16-protos.h, config/cr16/cr16.c,
config/cris/cris-protos.h, config/cris/cris.c, config/cris/cris.md,
config/darwin-protos.h, config/darwin.c,
config/epiphany/epiphany-protos.h, config/epiphany/epiphany.c,
config/epiphany/epiphany.md, config/fr30/fr30.c,
config/frv/frv-protos.h, config/frv/frv.c, config/frv/predicates.md,
config/h8300/h8300-protos.h, config/h8300/h8300.c,
config/i386/i386-builtin-types.awk, config/i386/i386-protos.h,
config/i386/i386.c, config/i386/i386.md, config/i386/predicates.md,
config/i386/sse.md, config/i386/sync.md, config/ia64/ia64-protos.h,
config/ia64/ia64.c, config/iq2000/iq2000-protos.h,
config/iq2000/iq2000.c, config/iq2000/iq2000.md,
config/lm32/lm32-protos.h, config/lm32/lm32.c,
config/m32c/m32c-protos.h, config/m32c/m32c.c,
config/m32r/m32r-protos.h, config/m32r/m32r.c,
config/m68k/m68k-protos.h, config/m68k/m68k.c,
config/mcore/mcore-protos.h, config/mcore/mcore.c,
config/mcore/mcore.md, config/mep/mep-protos.h, config/mep/mep.c,
config/microblaze/microblaze-protos.h, config/microblaze/microblaze.c,
config/mips/mips-protos.h, config/mips/mips.c,
config/mmix/mmix-protos.h, config/mmix/mmix.c,
config/mn10300/mn10300-protos.h, config/mn10300/mn10300.c,
config/moxie/moxie.c, config/msp430/msp430-protos.h,
config/msp430/msp430.c, config/nds32/nds32-cost.c,
config/nds32/nds32-intrinsic.c, config/nds32/nds32-md-auxiliary.c,
config/nds32/nds32-protos.h, config/nds32/nds32.c,
config/nios2/nios2-protos.h, config/nios2/nios2.c,
config/pa/pa-protos.h, config/pa/pa.c, config/pdp11/pdp11-protos.h,
config/pdp11/pdp11.c, config/rl78/rl78-protos.h, config/rl78/rl78.c,
config/rs6000/altivec.md, config/rs6000/rs6000-c.c,
config/rs6000/rs6000-protos.h, config/rs6000/rs6000.c,
config/rs6000/rs6000.h, config/rx/rx-protos.h, config/rx/rx.c,
config/s390/predicates.md, config/s390/s390-protos.h,
config/s390/s390.c, config/s390/s390.h, config/s390/s390.md,
config/sh/predicates.md, config/sh/sh-protos.h, config/sh/sh.c,
config/sh/sh.md, config/sparc/predicates.md,
config/sparc/sparc-protos.h, config/sparc/sparc.c,
config/sparc/sparc.md, config/spu/spu-protos.h, config/spu/spu.c,
config/stormy16/stormy16-protos.h, config/stormy16/stormy16.c,
config/tilegx/tilegx-protos.h, config/tilegx/tilegx.c,
config/tilegx/tilegx.md, config/tilepro/tilepro-protos.h,
config/tilepro/tilepro.c, config/v850/v850-protos.h,
config/v850/v850.c, config/v850/v850.md, config/vax/vax-protos.h,
config/vax/vax.c, config/vms/vms-c.c, config/xtensa/xtensa-protos.h,
config/xtensa/xtensa.c, coverage.c, cprop.c, cse.c, cselib.c, cselib.h,
dbxout.c, ddg.c, df-problems.c, dfp.c, dfp.h, doc/md.texi,
doc/rtl.texi, doc/tm.texi, doc/tm.texi.in, dojump.c, dse.c,
dwarf2cfi.c, dwarf2out.c, dwarf2out.h, emit-rtl.c, emit-rtl.h,
except.c, explow.c, expmed.c, expmed.h, expr.c, expr.h, final.c,
fixed-value.c, fixed-value.h, fold-const.c, function.c, function.h,
fwprop.c, gcse.c, gengenrtl.c, genmodes.c, genopinit.c, genoutput.c,
genpreds.c, genrecog.c, gensupport.c, gimple-ssa-strength-reduction.c,
graphite-clast-to-gimple.c, haifa-sched.c, hooks.c, hooks.h, ifcvt.c,
internal-fn.c, ira-build.c, ira-color.c, ira-conflicts.c, ira-costs.c,
ira-emit.c, ira-int.h, ira-lives.c, ira.c, ira.h, jump.c, langhooks.h,
libfuncs.h, lists.c, loop-doloop.c, loop-invariant.c, loop-iv.c,
loop-unroll.c, lower-subreg.c, lower-subreg.h, lra-assigns.c,
lra-constraints.c, lra-eliminations.c, lra-int.h, lra-lives.c,
lra-spills.c, lra.c, lra.h, machmode.h, omp-low.c, optabs.c, optabs.h,
output.h, postreload.c, print-tree.c, read-rtl.c, real.c, real.h,
recog.c, recog.h, ree.c, reg-stack.c, regcprop.c, reginfo.c,
regrename.c, regs.h, reload.c, reload.h, reload1.c, rtl.c, rtl.h,
rtlanal.c, rtlhash.c, rtlhooks-def.h, rtlhooks.c, sched-deps.c,
sel-sched-dump.c, sel-sched-ir.c, sel-sched-ir.h, sel-sched.c,
simplify-rtx.c, stmt.c, stor-layout.c, stor-layout.h, target.def,
targhooks.c, targhooks.h, tree-affine.c, tree-call-cdce.c,
tree-complex.c, tree-data-ref.c, tree-dfa.c, tree-if-conv.c,
tree-inline.c, tree-outof-ssa.c, tree-scalar-evolution.c,
tree-ssa-address.c, tree-ssa-ccp.c, tree-ssa-loop-ivopts.c,
tree-ssa-loop-ivopts.h, tree-ssa-loop-manip.c,
tree-ssa-loop-prefetch.c, tree-ssa-math-opts.c, tree-ssa-reassoc.c,
tree-ssa-sccvn.c, tree-streamer-in.c, tree-switch-conversion.c,
tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop.c,
tree-vect-patterns.c, tree-vect-slp.c, tree-vect-stmts.c,
tree-vrp.c, tree.c, tree.h, tsan.c, ubsan.c, valtrack.c,
var-tracking.c, varasm.c: Remove redundant enum from
machine_mode.
gcc/
* gengtype.c (main): Treat machine_mode as a scalar typedef.
* genmodes.c (emit_insn_modes_h): Hide inline functions if
USED_FOR_TARGET.
From-SVN: r216834
2014-10-29 13:02:45 +01:00
|
|
|
machine_mode mode;
|
2015-11-08 19:33:42 +01:00
|
|
|
int unsignedp, reversep, volatilep = 0;
|
|
|
|
base = get_inner_reference (expr, &bitsize, &bitpos, &offset, &mode,
|
Convert TYPE_ALIGN_OK to a TYPE_LANG_FLAG.
2016-07-11 Bernd Edlinger <bernd.edlinger@hotmail.de>
Convert TYPE_ALIGN_OK to a TYPE_LANG_FLAG.
* tree-core.h (tree_base::nothrow_flag): Adjust comment.
(tree_type_common::lang_flag_7): New.
(tree_type_common::spare): Reduce size.
* tree.h (TYPE_ALIGN_OK): Remove.
(TYPE_LANG_FLAG_7): New.
(get_inner_reference): Adjust header.
* print-tree.c (print_node): Adjust.
* expr.c (get_inner_reference): Remove parameter keep_aligning.
(get_bit_range, expand_assignment, expand_expr_addr_expr_1): Adjust
calls to get_inner_reference.
(expand_expr_real_1): Adjust call to get_inner_reference. Remove
handling of TYPE_ALIGN_OK.
* builtins.c (get_object_alignment_2): Adjust call to
get_inner_reference. Remove handling of VIEW_CONVERT_EXPR.
* emit-rtl.c (set_mem_attributes_minus_bitpos): Remove handling of
TYPE_ALIGN_OK.
* asan.c (instrument_derefs): Adjust calls to get_inner_reference.
* cfgexpand.c (expand_debug_expr): Likewise.
* dbxout.c (dbxout_expand_expr): Likewise.
* dwarf2out.c (loc_list_for_address_of_addr_expr_of_indirect_ref,
loc_list_from_tree, fortran_common): Likewise.
* fold-const.c (optimize_bit_field_compare,
decode_field_reference, fold_unary_loc, fold_comparison,
split_address_to_core_and_offset): Likewise.
* gimple-laddress.c (execute): Likewise.
* gimple-ssa-strength-reduction.c (slsr_process_ref): Likewise.
* gimplify.c (gimplify_scan_omp_clauses): Likewise.
* hsa-gen.c (gen_hsa_addr): Likewise.
* simplifx-rtx.c (delegitimize_mem_from_attrs): Likewise.
* tsan.c (instrument_expr): Likewise.
* ubsan.c (instrument_bool_enum_load, instrument_object_size): Likewise.
* tree.c (verify_type_variant): Remove handling of TYPE_ALIGN_OK.
* tree-affine.c (tree_to_aff_combination,
get_inner_reference_aff): Adjust calls to get_inner_reference.
* tree-data-ref.c (split_constant_offset_1,
dr_analyze_innermost): Likewise.
* tree-scalar-evolution.c (interpret_rhs_expr): Likewise.
* tree-sra.c (ipa_sra_check_caller): Likewise.
* tree-ssa-loop-ivopts.c (split_address_cost): Likewise.
* tree-ssa-math-opts.c (find_bswap_or_nop_load,
bswap_replace): Likewise.
* tree-vect-data-refs.c (vect_check_gather,
vect_analyze_data_refs): Likewise.
* config/mips/mips.c (r10k_safe_mem_expr_p): Likewise.
* config/pa/pa.c (pa_emit_move_sequence): Remove handling of
TYPE_ALIGN_OK.
ada:
2016-07-11 Bernd Edlinger <bernd.edlinger@hotmail.de>
Convert TYPE_ALIGN_OK to a TYPE_LANG_FLAG.
* gcc-interface/ada-tree.h (TYPE_ALIGN_OK): Define.
* gcc-interface/trans.c (Attribute_to_gnu): Adjust call to
get_inner_reference.
* gcc-interface/utils2.c (build_unary_op): Likewise.
From-SVN: r238210
2016-07-11 17:02:12 +02:00
|
|
|
&unsignedp, &reversep, &volatilep);
|
2012-11-30 09:48:02 +01:00
|
|
|
|
|
|
|
/* No need to instrument accesses to decls that don't escape,
|
|
|
|
they can't escape to other threads then. */
|
2015-01-12 17:47:11 +01:00
|
|
|
if (DECL_P (base) && !is_global_var (base))
|
2012-11-30 09:48:02 +01:00
|
|
|
{
|
|
|
|
struct pt_solution pt;
|
|
|
|
memset (&pt, 0, sizeof (pt));
|
|
|
|
pt.escaped = 1;
|
|
|
|
pt.ipa_escaped = flag_ipa_pta != 0;
|
|
|
|
if (!pt_solution_includes (&pt, base))
|
|
|
|
return false;
|
2015-01-12 17:47:11 +01:00
|
|
|
if (!may_be_aliased (base))
|
2012-11-30 09:48:02 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
tree-ssa.c (target_for_debug_bind, [...]): Use VAR_P and/or VAR_OR_FUNCTION_DECL_P macros.
* tree-ssa.c (target_for_debug_bind, verify_phi_args,
ssa_undefined_value_p, maybe_optimize_var): Use VAR_P and/or
VAR_OR_FUNCTION_DECL_P macros.
* tree-chkp.c (chkp_register_var_initializer, chkp_make_static_bounds,
chkp_get_bounds_for_decl_addr, chkp_parse_array_and_component_ref,
chkp_find_bounds_1): Likewise.
* ipa-polymorphic-call.c (decl_maybe_in_construction_p): Likewise.
* hsa-gen.c (get_symbol_for_decl): Likewise.
* cgraphunit.c (check_global_declaration, analyze_functions,
handle_alias_pairs, thunk_adjust, cgraph_node::expand_thunk):
Likewise.
* gimple-fold.c (can_refer_decl_in_current_unit_p,
canonicalize_constructor_val, gimple_get_virt_method_for_vtable):
Likewise.
* tree.c (set_decl_section_name, copy_node_stat,
need_assembler_name_p, free_lang_data_in_decl, find_decls_types_r,
merge_dllimport_decl_attributes, handle_dll_attribute,
decl_init_priority_insert, auto_var_in_fn_p, array_at_struct_end_p,
verify_type): Likewise.
* gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior,
find_explicit_erroneous_behavior): Likewise.
* sdbout.c (sdbout_toplevel_data, sdbout_late_global_decl): Likewise.
* ipa.c (process_references): Likewise.
* tree-chkp-opt.c (chkp_get_check_result): Likewise.
* varasm.c (get_block_for_decl, use_blocks_for_decl_p, make_decl_rtl,
notice_global_symbol, assemble_variable, mark_decl_referenced,
build_constant_desc, output_constant_def_contents, do_assemble_alias,
make_decl_one_only, default_section_type_flags,
categorize_decl_for_section, default_encode_section_info): Likewise.
* trans-mem.c (requires_barrier): Likewise.
* gimple-expr.c (mark_addressable): Likewise.
* cfgexpand.c (add_scope_conflicts_1, expand_one_var,
expand_used_vars_for_block, clear_tree_used, stack_protect_decl_p,
expand_debug_expr): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* ubsan.c (instrument_bool_enum_load): Likewise.
* tree-pretty-print.c (print_declaration): Likewise.
* simplify-rtx.c (delegitimize_mem_from_attrs): Likewise.
* tree-ssa-uninit.c (warn_uninitialized_vars): Likewise.
* asan.c (asan_protect_global, instrument_derefs): Likewise.
* tree-into-ssa.c (rewrite_stmt, maybe_register_def,
pass_build_ssa::execute): Likewise.
* var-tracking.c (var_debug_decl, track_expr_p): Likewise.
* tree-ssa-loop-ivopts.c (force_expr_to_var_cost, split_address_cost):
Likewise.
* ipa-split.c (test_nonssa_use, consider_split, mark_nonssa_use):
Likewise.
* tree-inline.c (insert_debug_decl_map, remap_ssa_name,
can_be_nonlocal, remap_decls, copy_debug_stmt,
initialize_inlined_parameters, add_local_variables,
reset_debug_binding, replace_locals_op): Likewise.
* dse.c (can_escape): Likewise.
* ipa-devirt.c (compare_virtual_tables, referenced_from_vtable_p):
Likewise.
* tree-diagnostic.c (default_tree_printer): Likewise.
* tree-streamer-in.c (unpack_ts_decl_common_value_fields,
unpack_ts_decl_with_vis_value_fields,
lto_input_ts_decl_common_tree_pointers): Likewise.
* builtins.c (builtin_save_expr, fold_builtin_expect,
readonly_data_expr): Likewise.
* tree-ssa-structalias.c (new_var_info, get_constraint_for_ssa_var,
create_variable_info_for, set_uids_in_ptset, visit_loadstore):
Likewise.
* gimple-streamer-out.c (output_gimple_stmt): Likewise.
* gimplify.c (force_constant_size, gimplify_bind_expr,
gimplify_decl_expr, gimplify_var_or_parm_decl,
gimplify_compound_lval, gimplify_init_constructor,
gimplify_modify_expr, gimplify_asm_expr, gimplify_oacc_declare,
gimplify_type_sizes): Likewise.
* cgraphbuild.c (record_reference, record_type_list, mark_address,
mark_load, mark_store, pass_build_cgraph_edges::execute): Likewise.
* tree-ssa-live.c (mark_all_vars_used_1, remove_unused_scope_block_p,
remove_unused_locals): Likewise.
* tree-ssa-alias.c (ptr_deref_may_alias_decl_p, ptrs_compare_unequal,
ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Likewise.
* function.c (instantiate_expr, instantiate_decls_1,
setjmp_vars_warning, add_local_decl): Likewise.
* alias.c (ao_ref_from_mem, get_alias_set, compare_base_symbol_refs):
Likewise.
* tree-stdarg.c (find_va_list_reference, va_list_counter_struct_op,
va_list_ptr_read, va_list_ptr_write, check_all_va_list_escapes,
optimize_va_list_gpr_fpr_size): Likewise.
* tree-nrv.c (pass_nrv::execute): Likewise.
* tsan.c (instrument_expr): Likewise.
* tree-ssa-dce.c (remove_dead_stmt): Likewise.
* vtable-verify.c (verify_bb_vtables): Likewise.
* tree-dfa.c (ssa_default_def, set_ssa_default_def,
get_ref_base_and_extent): Likewise.
* toplev.c (wrapup_global_declaration_1, wrapup_global_declaration_2):
Likewise.
* tree-sra.c (static bool constant_decl_p, find_var_candidates,
analyze_all_variable_accesses): Likewise.
* tree-nested.c (get_nonlocal_debug_decl,
convert_nonlocal_omp_clauses, note_nonlocal_vla_type,
note_nonlocal_block_vlas, convert_nonlocal_reference_stmt,
get_local_debug_decl, convert_local_omp_clauses,
convert_local_reference_stmt, nesting_copy_decl, remap_vla_decls):
Likewise.
* tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Likewise.
* stmt.c (decl_overlaps_hard_reg_set_p): Likewise.
* dbxout.c (dbxout_late_global_decl, dbxout_type_fields,
dbxout_symbol, dbxout_common_check): Likewise.
* expr.c (expand_assignment, expand_expr_real_2, expand_expr_real_1,
string_constant): Likewise.
* hsa.c (hsa_get_declaration_name): Likewise.
* passes.c (rest_of_decl_compilation): Likewise.
* tree-ssanames.c (make_ssa_name_fn): Likewise.
* tree-streamer-out.c (pack_ts_decl_common_value_fields,
pack_ts_decl_with_vis_value_fields,
write_ts_decl_common_tree_pointers): Likewise.
* stor-layout.c (place_field): Likewise.
* symtab.c (symtab_node::maybe_create_reference,
symtab_node::verify_base, symtab_node::make_decl_local,
symtab_node::copy_visibility_from,
symtab_node::can_increase_alignment_p): Likewise.
* dwarf2out.c (add_var_loc_to_decl, tls_mem_loc_descriptor,
decl_by_reference_p, reference_to_unused, rtl_for_decl_location,
fortran_common, add_location_or_const_value_attribute,
add_scalar_info, add_linkage_name, set_block_abstract_flags,
local_function_static, gen_variable_die, dwarf2out_late_global_decl,
optimize_one_addr_into_implicit_ptr,
optimize_location_into_implicit_ptr): Likewise.
* gimple-low.c (record_vars_into): Likewise.
* ipa-visibility.c (update_vtable_references): Likewise.
* tree-ssa-address.c (fixed_address_object_p, copy_ref_info):
Likewise.
* lto-streamer-out.c (tree_is_indexable, get_symbol_initial_value,
DFS::DFS_write_tree_body, write_symbol): Likewise.
* langhooks.c (lhd_warn_unused_global_decl,
lhd_set_decl_assembler_name): Likewise.
* attribs.c (decl_attributes): Likewise.
* except.c (output_ttype): Likewise.
* varpool.c (varpool_node::get_create, ctor_for_folding,
varpool_node::assemble_decl, varpool_node::create_alias): Likewise.
* fold-const.c (fold_unary_loc): Likewise.
* ipa-prop.c (ipa_compute_jump_functions_for_edge,
ipa_find_agg_cst_from_init): Likewise.
* omp-low.c (expand_omp_regimplify_p, expand_omp_taskreg,
expand_omp_target, lower_omp_regimplify_p,
grid_reg_assignment_to_local_var_p, grid_remap_prebody_decls,
find_link_var_op): Likewise.
* tree-chrec.c (chrec_contains_symbols): Likewise.
* tree-cfg.c (verify_address, verify_expr, verify_expr_location_1,
gimple_duplicate_bb, move_stmt_op, replace_block_vars_by_duplicates,
execute_fixup_cfg): Likewise.
From-SVN: r240900
2016-10-09 13:19:48 +02:00
|
|
|
if (TREE_READONLY (base) || (VAR_P (base) && DECL_HARD_REGISTER (base)))
|
2012-11-22 22:56:58 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
stmt = gsi_stmt (gsi);
|
|
|
|
loc = gimple_location (stmt);
|
|
|
|
rhs = is_vptr_store (stmt, expr, is_write);
|
2015-01-02 23:16:59 +01:00
|
|
|
|
|
|
|
if ((TREE_CODE (expr) == COMPONENT_REF
|
|
|
|
&& DECL_BIT_FIELD_TYPE (TREE_OPERAND (expr, 1)))
|
|
|
|
|| TREE_CODE (expr) == BIT_FIELD_REF)
|
|
|
|
{
|
|
|
|
base = TREE_OPERAND (expr, 0);
|
|
|
|
if (TREE_CODE (expr) == COMPONENT_REF)
|
|
|
|
{
|
|
|
|
expr = TREE_OPERAND (expr, 1);
|
|
|
|
if (is_write && DECL_BIT_FIELD_REPRESENTATIVE (expr))
|
|
|
|
expr = DECL_BIT_FIELD_REPRESENTATIVE (expr);
|
|
|
|
if (!tree_fits_uhwi_p (DECL_FIELD_OFFSET (expr))
|
|
|
|
|| !tree_fits_uhwi_p (DECL_FIELD_BIT_OFFSET (expr))
|
|
|
|
|| !tree_fits_uhwi_p (DECL_SIZE (expr)))
|
|
|
|
return false;
|
|
|
|
bitpos = tree_to_uhwi (DECL_FIELD_OFFSET (expr)) * BITS_PER_UNIT
|
|
|
|
+ tree_to_uhwi (DECL_FIELD_BIT_OFFSET (expr));
|
|
|
|
bitsize = tree_to_uhwi (DECL_SIZE (expr));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!tree_fits_uhwi_p (TREE_OPERAND (expr, 2))
|
|
|
|
|| !tree_fits_uhwi_p (TREE_OPERAND (expr, 1)))
|
|
|
|
return false;
|
|
|
|
bitpos = tree_to_uhwi (TREE_OPERAND (expr, 2));
|
|
|
|
bitsize = tree_to_uhwi (TREE_OPERAND (expr, 1));
|
|
|
|
}
|
|
|
|
if (bitpos < 0 || bitsize <= 0)
|
|
|
|
return false;
|
|
|
|
size = (bitpos % BITS_PER_UNIT + bitsize + BITS_PER_UNIT - 1)
|
|
|
|
/ BITS_PER_UNIT;
|
2015-01-12 17:47:11 +01:00
|
|
|
if (may_be_nonaddressable_p (base))
|
|
|
|
return false;
|
2015-01-02 23:16:59 +01:00
|
|
|
align = get_object_alignment (base);
|
|
|
|
if (align < BITS_PER_UNIT)
|
|
|
|
return false;
|
|
|
|
bitpos = bitpos & ~(BITS_PER_UNIT - 1);
|
|
|
|
if ((align - 1) & bitpos)
|
|
|
|
{
|
|
|
|
align = (align - 1) & bitpos;
|
Add inline functions for various bitwise operations.
* hwint.h (least_bit_hwi, pow2_or_zerop, pow2p_hwi, ctz_or_zero):
New.
* hwint.c (exact_log2): Use pow2p_hwi.
(ctz_hwi, ffs_hwi): Use least_bit_hwi.
* alias.c (memrefs_conflict_p): Use pow2_or_zerop.
* builtins.c (get_object_alignment_2, get_object_alignment)
(get_pointer_alignment, fold_builtin_atomic_always_lock_free): Use
least_bit_hwi.
* calls.c (compute_argument_addresses, store_one_arg): Use
least_bit_hwi.
* cfgexpand.c (expand_one_stack_var_at): Use least_bit_hwi.
* combine.c (force_to_mode): Use least_bit_hwi.
* emit-rtl.c (set_mem_attributes_minus_bitpos, adjust_address_1):
Use least_bit_hwi.
* expmed.c (synth_mult, expand_divmod): Use ctz_or_zero, ctz_hwi.
(init_expmed_one_conv): Use pow2p_hwi.
* fold-const.c (round_up_loc, round_down_loc): Use pow2_or_zerop.
(fold_binary_loc): Use pow2p_hwi.
* function.c (assign_parm_find_stack_rtl): Use least_bit_hwi.
* gimple-fold.c (gimple_fold_builtin_memory_op): Use pow2p_hwi.
* gimple-ssa-strength-reduction.c (replace_ref): Use least_bit_hwi.
* hsa-gen.c (gen_hsa_addr_with_align, hsa_bitmemref_alignment):
Use least_bit_hwi.
* ipa-cp.c (ipcp_alignment_lattice::meet_with_1): Use least_bit_hwi.
* ipa-prop.c (ipa_modify_call_arguments): Use least_bit_hwi.
* omp-low.c (oacc_loop_fixed_partitions)
(oacc_loop_auto_partitions): Use least_bit_hwi.
* rtlanal.c (nonzero_bits1): Use ctz_or_zero.
* stor-layout.c (place_field): Use least_bit_hwi.
* tree-pretty-print.c (dump_generic_node): Use pow2p_hwi.
* tree-sra.c (build_ref_for_offset): Use least_bit_hwi.
* tree-ssa-ccp.c (ccp_finalize): Use least_bit_hwi.
* tree-ssa-math-opts.c (bswap_replace): Use least_bit_hwi.
* tree-ssa-strlen.c (handle_builtin_memcmp): Use pow2p_hwi.
* tree-vect-data-refs.c (vect_analyze_group_access_1)
(vect_grouped_store_supported, vect_grouped_load_supported)
(vect_permute_load_chain, vect_shift_permute_load_chain)
(vect_transform_grouped_load): Use pow2p_hwi.
* tree-vect-generic.c (expand_vector_divmod): Use ctz_or_zero.
* tree-vect-patterns.c (vect_recog_divmod_pattern): Use ctz_or_zero.
* tree-vect-stmts.c (vectorizable_mask_load_store): Use
least_bit_hwi.
* tsan.c (instrument_expr): Use least_bit_hwi.
* var-tracking.c (negative_power_of_two_p): Use pow2_or_zerop.
From-SVN: r240194
2016-09-16 21:20:44 +02:00
|
|
|
align = least_bit_hwi (align);
|
2015-01-02 23:16:59 +01:00
|
|
|
}
|
|
|
|
expr = build_fold_addr_expr (unshare_expr (base));
|
|
|
|
expr = build2 (MEM_REF, char_type_node, expr,
|
|
|
|
build_int_cst (TREE_TYPE (expr), bitpos / BITS_PER_UNIT));
|
|
|
|
expr_ptr = build_fold_addr_expr (expr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-12 17:47:11 +01:00
|
|
|
if (may_be_nonaddressable_p (expr))
|
|
|
|
return false;
|
2015-01-02 23:16:59 +01:00
|
|
|
align = get_object_alignment (expr);
|
|
|
|
if (align < BITS_PER_UNIT)
|
|
|
|
return false;
|
|
|
|
expr_ptr = build_fold_addr_expr (unshare_expr (expr));
|
|
|
|
}
|
2015-01-12 17:47:11 +01:00
|
|
|
expr_ptr = force_gimple_operand (expr_ptr, &seq, true, NULL_TREE);
|
2015-01-02 23:41:10 +01:00
|
|
|
if ((size & (size - 1)) != 0 || size > 16
|
2015-01-02 23:16:59 +01:00
|
|
|
|| align < MIN (size, 8) * BITS_PER_UNIT)
|
|
|
|
{
|
|
|
|
builtin_decl = builtin_decl_implicit (is_write
|
|
|
|
? BUILT_IN_TSAN_WRITE_RANGE
|
|
|
|
: BUILT_IN_TSAN_READ_RANGE);
|
|
|
|
g = gimple_build_call (builtin_decl, 2, expr_ptr, size_int (size));
|
|
|
|
}
|
|
|
|
else if (rhs == NULL)
|
2012-12-04 14:25:07 +01:00
|
|
|
g = gimple_build_call (get_memory_access_decl (is_write, size),
|
|
|
|
1, expr_ptr);
|
2012-11-22 22:56:58 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
builtin_decl = builtin_decl_implicit (BUILT_IN_TSAN_VPTR_UPDATE);
|
2015-01-16 18:49:56 +01:00
|
|
|
g = gimple_build_call (builtin_decl, 2, expr_ptr, unshare_expr (rhs));
|
2012-11-22 22:56:58 +01:00
|
|
|
}
|
|
|
|
gimple_set_location (g, loc);
|
2012-12-04 14:25:07 +01:00
|
|
|
gimple_seq_add_stmt_without_update (&seq, g);
|
2012-11-22 22:56:58 +01:00
|
|
|
/* Instrumentation for assignment of a function result
|
|
|
|
must be inserted after the call. Instrumentation for
|
|
|
|
reads of function arguments must be inserted before the call.
|
|
|
|
That's because the call can contain synchronization. */
|
|
|
|
if (is_gimple_call (stmt) && is_write)
|
|
|
|
{
|
|
|
|
/* If the call can throw, it must be the last stmt in
|
|
|
|
a basic block, so the instrumented stmts need to be
|
2012-11-23 15:28:19 +01:00
|
|
|
inserted in successor bbs. */
|
2012-11-22 22:56:58 +01:00
|
|
|
if (is_ctrl_altering_stmt (stmt))
|
|
|
|
{
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
bb = gsi_bb (gsi);
|
|
|
|
e = find_fallthru_edge (bb->succs);
|
|
|
|
if (e)
|
2012-12-04 14:25:07 +01:00
|
|
|
gsi_insert_seq_on_edge_immediate (e, seq);
|
2012-11-22 22:56:58 +01:00
|
|
|
}
|
|
|
|
else
|
2012-12-04 14:25:07 +01:00
|
|
|
gsi_insert_seq_after (&gsi, seq, GSI_NEW_STMT);
|
2012-11-22 22:56:58 +01:00
|
|
|
}
|
|
|
|
else
|
2012-12-04 14:25:07 +01:00
|
|
|
gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
|
2012-11-22 22:56:58 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-12-04 14:20:20 +01:00
|
|
|
/* Actions for sync/atomic builtin transformations. */
|
|
|
|
enum tsan_atomic_action
|
|
|
|
{
|
|
|
|
check_last, add_seq_cst, add_acquire, weak_cas, strong_cas,
|
2016-09-14 11:01:49 +02:00
|
|
|
bool_cas, val_cas, lock_release, fetch_op, fetch_op_seq_cst,
|
|
|
|
bool_clear, bool_test_and_set
|
2012-12-04 14:20:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Table how to map sync/atomic builtins to their corresponding
|
|
|
|
tsan equivalents. */
|
2013-06-05 12:14:15 +02:00
|
|
|
static const struct tsan_map_atomic
|
2012-12-04 14:20:20 +01:00
|
|
|
{
|
|
|
|
enum built_in_function fcode, tsan_fcode;
|
|
|
|
enum tsan_atomic_action action;
|
|
|
|
enum tree_code code;
|
|
|
|
} tsan_atomic_table[] =
|
|
|
|
{
|
|
|
|
#define TRANSFORM(fcode, tsan_fcode, action, code) \
|
|
|
|
{ BUILT_IN_##fcode, BUILT_IN_##tsan_fcode, action, code }
|
|
|
|
#define CHECK_LAST(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, check_last, ERROR_MARK)
|
|
|
|
#define ADD_SEQ_CST(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, add_seq_cst, ERROR_MARK)
|
|
|
|
#define ADD_ACQUIRE(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, add_acquire, ERROR_MARK)
|
|
|
|
#define WEAK_CAS(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, weak_cas, ERROR_MARK)
|
|
|
|
#define STRONG_CAS(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, strong_cas, ERROR_MARK)
|
|
|
|
#define BOOL_CAS(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, bool_cas, ERROR_MARK)
|
|
|
|
#define VAL_CAS(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, val_cas, ERROR_MARK)
|
|
|
|
#define LOCK_RELEASE(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, lock_release, ERROR_MARK)
|
|
|
|
#define FETCH_OP(fcode, tsan_fcode, code) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, fetch_op, code)
|
|
|
|
#define FETCH_OPS(fcode, tsan_fcode, code) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, fetch_op_seq_cst, code)
|
2016-09-14 11:01:49 +02:00
|
|
|
#define BOOL_CLEAR(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, bool_clear, ERROR_MARK)
|
|
|
|
#define BOOL_TEST_AND_SET(fcode, tsan_fcode) \
|
|
|
|
TRANSFORM (fcode, tsan_fcode, bool_test_and_set, ERROR_MARK)
|
2012-12-04 14:20:20 +01:00
|
|
|
|
|
|
|
CHECK_LAST (ATOMIC_LOAD_1, TSAN_ATOMIC8_LOAD),
|
|
|
|
CHECK_LAST (ATOMIC_LOAD_2, TSAN_ATOMIC16_LOAD),
|
|
|
|
CHECK_LAST (ATOMIC_LOAD_4, TSAN_ATOMIC32_LOAD),
|
|
|
|
CHECK_LAST (ATOMIC_LOAD_8, TSAN_ATOMIC64_LOAD),
|
|
|
|
CHECK_LAST (ATOMIC_LOAD_16, TSAN_ATOMIC128_LOAD),
|
|
|
|
CHECK_LAST (ATOMIC_STORE_1, TSAN_ATOMIC8_STORE),
|
|
|
|
CHECK_LAST (ATOMIC_STORE_2, TSAN_ATOMIC16_STORE),
|
|
|
|
CHECK_LAST (ATOMIC_STORE_4, TSAN_ATOMIC32_STORE),
|
|
|
|
CHECK_LAST (ATOMIC_STORE_8, TSAN_ATOMIC64_STORE),
|
|
|
|
CHECK_LAST (ATOMIC_STORE_16, TSAN_ATOMIC128_STORE),
|
|
|
|
CHECK_LAST (ATOMIC_EXCHANGE_1, TSAN_ATOMIC8_EXCHANGE),
|
|
|
|
CHECK_LAST (ATOMIC_EXCHANGE_2, TSAN_ATOMIC16_EXCHANGE),
|
|
|
|
CHECK_LAST (ATOMIC_EXCHANGE_4, TSAN_ATOMIC32_EXCHANGE),
|
|
|
|
CHECK_LAST (ATOMIC_EXCHANGE_8, TSAN_ATOMIC64_EXCHANGE),
|
|
|
|
CHECK_LAST (ATOMIC_EXCHANGE_16, TSAN_ATOMIC128_EXCHANGE),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_ADD_1, TSAN_ATOMIC8_FETCH_ADD),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_ADD_2, TSAN_ATOMIC16_FETCH_ADD),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_ADD_4, TSAN_ATOMIC32_FETCH_ADD),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_ADD_8, TSAN_ATOMIC64_FETCH_ADD),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_ADD_16, TSAN_ATOMIC128_FETCH_ADD),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_SUB_1, TSAN_ATOMIC8_FETCH_SUB),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_SUB_2, TSAN_ATOMIC16_FETCH_SUB),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_SUB_4, TSAN_ATOMIC32_FETCH_SUB),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_SUB_8, TSAN_ATOMIC64_FETCH_SUB),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_SUB_16, TSAN_ATOMIC128_FETCH_SUB),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_AND_1, TSAN_ATOMIC8_FETCH_AND),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_AND_2, TSAN_ATOMIC16_FETCH_AND),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_AND_4, TSAN_ATOMIC32_FETCH_AND),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_AND_8, TSAN_ATOMIC64_FETCH_AND),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_AND_16, TSAN_ATOMIC128_FETCH_AND),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_OR_1, TSAN_ATOMIC8_FETCH_OR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_OR_2, TSAN_ATOMIC16_FETCH_OR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_OR_4, TSAN_ATOMIC32_FETCH_OR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_OR_8, TSAN_ATOMIC64_FETCH_OR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_OR_16, TSAN_ATOMIC128_FETCH_OR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_XOR_1, TSAN_ATOMIC8_FETCH_XOR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_XOR_2, TSAN_ATOMIC16_FETCH_XOR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_XOR_4, TSAN_ATOMIC32_FETCH_XOR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_XOR_8, TSAN_ATOMIC64_FETCH_XOR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_XOR_16, TSAN_ATOMIC128_FETCH_XOR),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_NAND_1, TSAN_ATOMIC8_FETCH_NAND),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_NAND_2, TSAN_ATOMIC16_FETCH_NAND),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_NAND_4, TSAN_ATOMIC32_FETCH_NAND),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_NAND_8, TSAN_ATOMIC64_FETCH_NAND),
|
|
|
|
CHECK_LAST (ATOMIC_FETCH_NAND_16, TSAN_ATOMIC128_FETCH_NAND),
|
|
|
|
|
|
|
|
CHECK_LAST (ATOMIC_THREAD_FENCE, TSAN_ATOMIC_THREAD_FENCE),
|
|
|
|
CHECK_LAST (ATOMIC_SIGNAL_FENCE, TSAN_ATOMIC_SIGNAL_FENCE),
|
|
|
|
|
|
|
|
FETCH_OP (ATOMIC_ADD_FETCH_1, TSAN_ATOMIC8_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_ADD_FETCH_2, TSAN_ATOMIC16_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_ADD_FETCH_4, TSAN_ATOMIC32_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_ADD_FETCH_8, TSAN_ATOMIC64_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_ADD_FETCH_16, TSAN_ATOMIC128_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_SUB_FETCH_1, TSAN_ATOMIC8_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_SUB_FETCH_2, TSAN_ATOMIC16_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_SUB_FETCH_4, TSAN_ATOMIC32_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_SUB_FETCH_8, TSAN_ATOMIC64_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_SUB_FETCH_16, TSAN_ATOMIC128_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_AND_FETCH_1, TSAN_ATOMIC8_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_AND_FETCH_2, TSAN_ATOMIC16_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_AND_FETCH_4, TSAN_ATOMIC32_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_AND_FETCH_8, TSAN_ATOMIC64_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_AND_FETCH_16, TSAN_ATOMIC128_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_OR_FETCH_1, TSAN_ATOMIC8_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_OR_FETCH_2, TSAN_ATOMIC16_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_OR_FETCH_4, TSAN_ATOMIC32_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_OR_FETCH_8, TSAN_ATOMIC64_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_OR_FETCH_16, TSAN_ATOMIC128_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_XOR_FETCH_1, TSAN_ATOMIC8_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_XOR_FETCH_2, TSAN_ATOMIC16_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_XOR_FETCH_4, TSAN_ATOMIC32_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_XOR_FETCH_8, TSAN_ATOMIC64_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_XOR_FETCH_16, TSAN_ATOMIC128_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_NAND_FETCH_1, TSAN_ATOMIC8_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_NAND_FETCH_2, TSAN_ATOMIC16_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_NAND_FETCH_4, TSAN_ATOMIC32_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_NAND_FETCH_8, TSAN_ATOMIC64_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
FETCH_OP (ATOMIC_NAND_FETCH_16, TSAN_ATOMIC128_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
|
|
|
|
ADD_ACQUIRE (SYNC_LOCK_TEST_AND_SET_1, TSAN_ATOMIC8_EXCHANGE),
|
|
|
|
ADD_ACQUIRE (SYNC_LOCK_TEST_AND_SET_2, TSAN_ATOMIC16_EXCHANGE),
|
|
|
|
ADD_ACQUIRE (SYNC_LOCK_TEST_AND_SET_4, TSAN_ATOMIC32_EXCHANGE),
|
|
|
|
ADD_ACQUIRE (SYNC_LOCK_TEST_AND_SET_8, TSAN_ATOMIC64_EXCHANGE),
|
|
|
|
ADD_ACQUIRE (SYNC_LOCK_TEST_AND_SET_16, TSAN_ATOMIC128_EXCHANGE),
|
|
|
|
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_ADD_1, TSAN_ATOMIC8_FETCH_ADD),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_ADD_2, TSAN_ATOMIC16_FETCH_ADD),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_ADD_4, TSAN_ATOMIC32_FETCH_ADD),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_ADD_8, TSAN_ATOMIC64_FETCH_ADD),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_ADD_16, TSAN_ATOMIC128_FETCH_ADD),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_SUB_1, TSAN_ATOMIC8_FETCH_SUB),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_SUB_2, TSAN_ATOMIC16_FETCH_SUB),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_SUB_4, TSAN_ATOMIC32_FETCH_SUB),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_SUB_8, TSAN_ATOMIC64_FETCH_SUB),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_SUB_16, TSAN_ATOMIC128_FETCH_SUB),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_AND_1, TSAN_ATOMIC8_FETCH_AND),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_AND_2, TSAN_ATOMIC16_FETCH_AND),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_AND_4, TSAN_ATOMIC32_FETCH_AND),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_AND_8, TSAN_ATOMIC64_FETCH_AND),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_AND_16, TSAN_ATOMIC128_FETCH_AND),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_OR_1, TSAN_ATOMIC8_FETCH_OR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_OR_2, TSAN_ATOMIC16_FETCH_OR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_OR_4, TSAN_ATOMIC32_FETCH_OR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_OR_8, TSAN_ATOMIC64_FETCH_OR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_OR_16, TSAN_ATOMIC128_FETCH_OR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_XOR_1, TSAN_ATOMIC8_FETCH_XOR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_XOR_2, TSAN_ATOMIC16_FETCH_XOR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_XOR_4, TSAN_ATOMIC32_FETCH_XOR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_XOR_8, TSAN_ATOMIC64_FETCH_XOR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_XOR_16, TSAN_ATOMIC128_FETCH_XOR),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_NAND_1, TSAN_ATOMIC8_FETCH_NAND),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_NAND_2, TSAN_ATOMIC16_FETCH_NAND),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_NAND_4, TSAN_ATOMIC32_FETCH_NAND),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_NAND_8, TSAN_ATOMIC64_FETCH_NAND),
|
|
|
|
ADD_SEQ_CST (SYNC_FETCH_AND_NAND_16, TSAN_ATOMIC128_FETCH_NAND),
|
|
|
|
|
|
|
|
ADD_SEQ_CST (SYNC_SYNCHRONIZE, TSAN_ATOMIC_THREAD_FENCE),
|
|
|
|
|
|
|
|
FETCH_OPS (SYNC_ADD_AND_FETCH_1, TSAN_ATOMIC8_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_ADD_AND_FETCH_2, TSAN_ATOMIC16_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_ADD_AND_FETCH_4, TSAN_ATOMIC32_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_ADD_AND_FETCH_8, TSAN_ATOMIC64_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_ADD_AND_FETCH_16, TSAN_ATOMIC128_FETCH_ADD, PLUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_SUB_AND_FETCH_1, TSAN_ATOMIC8_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_SUB_AND_FETCH_2, TSAN_ATOMIC16_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_SUB_AND_FETCH_4, TSAN_ATOMIC32_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_SUB_AND_FETCH_8, TSAN_ATOMIC64_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_SUB_AND_FETCH_16, TSAN_ATOMIC128_FETCH_SUB, MINUS_EXPR),
|
|
|
|
FETCH_OPS (SYNC_AND_AND_FETCH_1, TSAN_ATOMIC8_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OPS (SYNC_AND_AND_FETCH_2, TSAN_ATOMIC16_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OPS (SYNC_AND_AND_FETCH_4, TSAN_ATOMIC32_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OPS (SYNC_AND_AND_FETCH_8, TSAN_ATOMIC64_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OPS (SYNC_AND_AND_FETCH_16, TSAN_ATOMIC128_FETCH_AND, BIT_AND_EXPR),
|
|
|
|
FETCH_OPS (SYNC_OR_AND_FETCH_1, TSAN_ATOMIC8_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_OR_AND_FETCH_2, TSAN_ATOMIC16_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_OR_AND_FETCH_4, TSAN_ATOMIC32_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_OR_AND_FETCH_8, TSAN_ATOMIC64_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_OR_AND_FETCH_16, TSAN_ATOMIC128_FETCH_OR, BIT_IOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_XOR_AND_FETCH_1, TSAN_ATOMIC8_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_XOR_AND_FETCH_2, TSAN_ATOMIC16_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_XOR_AND_FETCH_4, TSAN_ATOMIC32_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_XOR_AND_FETCH_8, TSAN_ATOMIC64_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_XOR_AND_FETCH_16, TSAN_ATOMIC128_FETCH_XOR, BIT_XOR_EXPR),
|
|
|
|
FETCH_OPS (SYNC_NAND_AND_FETCH_1, TSAN_ATOMIC8_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
FETCH_OPS (SYNC_NAND_AND_FETCH_2, TSAN_ATOMIC16_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
FETCH_OPS (SYNC_NAND_AND_FETCH_4, TSAN_ATOMIC32_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
FETCH_OPS (SYNC_NAND_AND_FETCH_8, TSAN_ATOMIC64_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
FETCH_OPS (SYNC_NAND_AND_FETCH_16, TSAN_ATOMIC128_FETCH_NAND, BIT_NOT_EXPR),
|
|
|
|
|
|
|
|
WEAK_CAS (ATOMIC_COMPARE_EXCHANGE_1, TSAN_ATOMIC8_COMPARE_EXCHANGE_WEAK),
|
|
|
|
WEAK_CAS (ATOMIC_COMPARE_EXCHANGE_2, TSAN_ATOMIC16_COMPARE_EXCHANGE_WEAK),
|
|
|
|
WEAK_CAS (ATOMIC_COMPARE_EXCHANGE_4, TSAN_ATOMIC32_COMPARE_EXCHANGE_WEAK),
|
|
|
|
WEAK_CAS (ATOMIC_COMPARE_EXCHANGE_8, TSAN_ATOMIC64_COMPARE_EXCHANGE_WEAK),
|
|
|
|
WEAK_CAS (ATOMIC_COMPARE_EXCHANGE_16, TSAN_ATOMIC128_COMPARE_EXCHANGE_WEAK),
|
|
|
|
|
|
|
|
STRONG_CAS (ATOMIC_COMPARE_EXCHANGE_1, TSAN_ATOMIC8_COMPARE_EXCHANGE_STRONG),
|
|
|
|
STRONG_CAS (ATOMIC_COMPARE_EXCHANGE_2,
|
|
|
|
TSAN_ATOMIC16_COMPARE_EXCHANGE_STRONG),
|
|
|
|
STRONG_CAS (ATOMIC_COMPARE_EXCHANGE_4,
|
|
|
|
TSAN_ATOMIC32_COMPARE_EXCHANGE_STRONG),
|
|
|
|
STRONG_CAS (ATOMIC_COMPARE_EXCHANGE_8,
|
|
|
|
TSAN_ATOMIC64_COMPARE_EXCHANGE_STRONG),
|
|
|
|
STRONG_CAS (ATOMIC_COMPARE_EXCHANGE_16,
|
|
|
|
TSAN_ATOMIC128_COMPARE_EXCHANGE_STRONG),
|
|
|
|
|
|
|
|
BOOL_CAS (SYNC_BOOL_COMPARE_AND_SWAP_1,
|
|
|
|
TSAN_ATOMIC8_COMPARE_EXCHANGE_STRONG),
|
|
|
|
BOOL_CAS (SYNC_BOOL_COMPARE_AND_SWAP_2,
|
|
|
|
TSAN_ATOMIC16_COMPARE_EXCHANGE_STRONG),
|
|
|
|
BOOL_CAS (SYNC_BOOL_COMPARE_AND_SWAP_4,
|
|
|
|
TSAN_ATOMIC32_COMPARE_EXCHANGE_STRONG),
|
|
|
|
BOOL_CAS (SYNC_BOOL_COMPARE_AND_SWAP_8,
|
|
|
|
TSAN_ATOMIC64_COMPARE_EXCHANGE_STRONG),
|
|
|
|
BOOL_CAS (SYNC_BOOL_COMPARE_AND_SWAP_16,
|
|
|
|
TSAN_ATOMIC128_COMPARE_EXCHANGE_STRONG),
|
|
|
|
|
|
|
|
VAL_CAS (SYNC_VAL_COMPARE_AND_SWAP_1, TSAN_ATOMIC8_COMPARE_EXCHANGE_STRONG),
|
|
|
|
VAL_CAS (SYNC_VAL_COMPARE_AND_SWAP_2, TSAN_ATOMIC16_COMPARE_EXCHANGE_STRONG),
|
|
|
|
VAL_CAS (SYNC_VAL_COMPARE_AND_SWAP_4, TSAN_ATOMIC32_COMPARE_EXCHANGE_STRONG),
|
|
|
|
VAL_CAS (SYNC_VAL_COMPARE_AND_SWAP_8, TSAN_ATOMIC64_COMPARE_EXCHANGE_STRONG),
|
|
|
|
VAL_CAS (SYNC_VAL_COMPARE_AND_SWAP_16,
|
|
|
|
TSAN_ATOMIC128_COMPARE_EXCHANGE_STRONG),
|
|
|
|
|
|
|
|
LOCK_RELEASE (SYNC_LOCK_RELEASE_1, TSAN_ATOMIC8_STORE),
|
|
|
|
LOCK_RELEASE (SYNC_LOCK_RELEASE_2, TSAN_ATOMIC16_STORE),
|
|
|
|
LOCK_RELEASE (SYNC_LOCK_RELEASE_4, TSAN_ATOMIC32_STORE),
|
|
|
|
LOCK_RELEASE (SYNC_LOCK_RELEASE_8, TSAN_ATOMIC64_STORE),
|
2016-09-14 11:01:49 +02:00
|
|
|
LOCK_RELEASE (SYNC_LOCK_RELEASE_16, TSAN_ATOMIC128_STORE),
|
|
|
|
|
|
|
|
BOOL_CLEAR (ATOMIC_CLEAR, TSAN_ATOMIC8_STORE),
|
|
|
|
|
|
|
|
BOOL_TEST_AND_SET (ATOMIC_TEST_AND_SET, TSAN_ATOMIC8_EXCHANGE)
|
2012-12-04 14:20:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Instrument an atomic builtin. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
instrument_builtin_call (gimple_stmt_iterator *gsi)
|
|
|
|
{
|
2015-09-20 02:52:59 +02:00
|
|
|
gimple *stmt = gsi_stmt (*gsi), *g;
|
2012-12-04 14:20:20 +01:00
|
|
|
tree callee = gimple_call_fndecl (stmt), last_arg, args[6], t, lhs;
|
|
|
|
enum built_in_function fcode = DECL_FUNCTION_CODE (callee);
|
|
|
|
unsigned int i, num = gimple_call_num_args (stmt), j;
|
|
|
|
for (j = 0; j < 6 && j < num; j++)
|
|
|
|
args[j] = gimple_call_arg (stmt, j);
|
|
|
|
for (i = 0; i < ARRAY_SIZE (tsan_atomic_table); i++)
|
|
|
|
if (fcode != tsan_atomic_table[i].fcode)
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tree decl = builtin_decl_implicit (tsan_atomic_table[i].tsan_fcode);
|
|
|
|
if (decl == NULL_TREE)
|
|
|
|
return;
|
|
|
|
switch (tsan_atomic_table[i].action)
|
|
|
|
{
|
|
|
|
case check_last:
|
|
|
|
case fetch_op:
|
|
|
|
last_arg = gimple_call_arg (stmt, num - 1);
|
2017-03-21 09:22:57 +01:00
|
|
|
if (tree_fits_uhwi_p (last_arg)
|
|
|
|
&& memmodel_base (tree_to_uhwi (last_arg)) >= MEMMODEL_LAST)
|
2012-12-04 14:20:20 +01:00
|
|
|
return;
|
|
|
|
gimple_call_set_fndecl (stmt, decl);
|
|
|
|
update_stmt (stmt);
|
2017-03-22 19:34:44 +01:00
|
|
|
maybe_clean_eh_stmt (stmt);
|
2012-12-04 14:20:20 +01:00
|
|
|
if (tsan_atomic_table[i].action == fetch_op)
|
|
|
|
{
|
|
|
|
args[1] = gimple_call_arg (stmt, 1);
|
|
|
|
goto adjust_result;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case add_seq_cst:
|
|
|
|
case add_acquire:
|
|
|
|
case fetch_op_seq_cst:
|
|
|
|
gcc_assert (num <= 2);
|
|
|
|
for (j = 0; j < num; j++)
|
|
|
|
args[j] = gimple_call_arg (stmt, j);
|
|
|
|
for (; j < 2; j++)
|
|
|
|
args[j] = NULL_TREE;
|
|
|
|
args[num] = build_int_cst (NULL_TREE,
|
|
|
|
tsan_atomic_table[i].action
|
|
|
|
!= add_acquire
|
|
|
|
? MEMMODEL_SEQ_CST
|
|
|
|
: MEMMODEL_ACQUIRE);
|
|
|
|
update_gimple_call (gsi, decl, num + 1, args[0], args[1], args[2]);
|
2017-03-22 19:34:44 +01:00
|
|
|
maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (*gsi));
|
2012-12-04 14:20:20 +01:00
|
|
|
stmt = gsi_stmt (*gsi);
|
|
|
|
if (tsan_atomic_table[i].action == fetch_op_seq_cst)
|
|
|
|
{
|
|
|
|
adjust_result:
|
|
|
|
lhs = gimple_call_lhs (stmt);
|
|
|
|
if (lhs == NULL_TREE)
|
|
|
|
return;
|
|
|
|
if (!useless_type_conversion_p (TREE_TYPE (lhs),
|
|
|
|
TREE_TYPE (args[1])))
|
|
|
|
{
|
gimple-expr.h (create_tmp_var_raw, [...]): Add default NULL value to last argument.
* gimple-expr.h (create_tmp_var_raw, create_tmp_var,
create_tmp_reg): Add default NULL value to last argument.
* tree-ssanames.h (make_ssa_name, copy_ssa_name): Likewise.
* gimple-low.c (lower_builtin_posix_memalign): Remove NULL
last argument from create_tmp_var_raw, create_tmp_var,
create_tmp_reg, make_ssa_name and copy_ssa_name calls.
* tree-ssa-strlen.c (get_string_length): Likewise.
* tree-emutls.c (gen_emutls_addr, lower_emutls_1): Likewise.
* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
* ipa-prop.c (ipa_modify_call_arguments): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* tree-ssa-ccp.c (fold_builtin_alloca_with_align): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_expr, instrument_builtin_call,
instrument_func_entry): Likewise.
* varpool.c (add_new_static_var): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* gimplify.c (internal_get_tmp_var, gimplify_return_expr,
gimplify_modify_expr_to_memcpy, gimplify_modify_expr_to_memset,
gimplify_init_ctor_eval_range, gimplify_init_constructor,
gimplify_omp_atomic, gimplify_expr): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1,
slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge,
vect_loop_versioning): Likewise.
* tree-if-conv.c (version_loop_for_if_conversion): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern): Likewise.
* tree-sra.c (build_ref_for_offset, create_access_replacement):
Likewise.
* tree-cfg.c (make_blocks): Likewise.
* tree-eh.c (lower_eh_constructs_2, lower_resx, lower_eh_dispatch):
Likewise.
* tree-ssa-propagate.c (update_call_from_tree): Likewise.
* tree-complex.c (get_component_ssa_name, expand_complex_div_wide):
Likewise.
* tree-ssa-math-opts.c (build_and_insert_cast): Likewise.
* tree-tailcall.c (update_accumulator_with_ops): Likewise.
* tree-predcom.c (initialize_root_vars, initialize_root_vars_lm,
execute_load_motion, reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
vect_create_epilog_for_reduction): Likewise.
* ipa-split.c (split_function): Likewise.
* tree-inline.c (remap_ssa_name, setup_one_parameter,
declare_return_variable, tree_function_versioning): Likewise.
* tree-cfgcleanup.c (fixup_noreturn_call): Likewise.
* cfgexpand.c (update_alias_info_with_stack_vars, expand_used_vars):
Likewise.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement,
neg_replacement): Likewise.
* gimplify-me.c (force_gimple_operand_1, gimple_regimplify_operands):
Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests,
build_one_array, build_arrays, gen_def_assigns): Likewise.
* gimple-fold.c (gimple_fold_builtin_memory_op,
gimple_fold_builtin_strcat, gimple_fold_call, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_encode_value, ubsan_expand_null_ifn,
ubsan_expand_objsize_ifn, instrument_si_overflow,
instrument_bool_enum_load, instrument_nonnull_arg): Likewise.
* tree-outof-ssa.c (insert_backedge_copies): Likewise.
* tree-ssa-loop-manip.c (create_iv,
tree_transform_and_unroll_loop): Likewise.
* omp-low.c (scan_omp_parallel, lower_rec_simd_input_clauses,
lower_rec_input_clauses, lower_lastprivate_clauses,
expand_parallel_call, expand_omp_for_static_chunk,
expand_omp_atomic_pipeline, expand_omp_target,
maybe_add_implicit_barrier_cancel, lower_omp_single_simple,
lower_omp_critical, lower_omp_for, task_copyfn_copy_decl,
lower_depend_clauses, lower_omp_target, lower_omp_1,
ipa_simd_modify_stmt_ops, simd_clone_adjust): Likewise.
* tree-parloops.c (take_address_of, create_phi_for_local_result,
create_call_for_reduction_1, separate_decls_in_region,
create_parallel_loop): Likewise.
* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_dependence,
handle_scalar_deps_crossing_scop_limits): Likewise.
* trans-mem.c (lower_transaction, build_tm_load, build_tm_store,
expand_assign_tm, expand_call_tm, expand_transaction,
ipa_tm_insert_gettmclone_call): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_setup_realignment):
Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_call, vectorizable_simd_clone_call,
vectorizable_conversion, vectorizable_store, permute_vec_elements,
vectorizable_load): Likewise.
c/
* c-typeck.c (convert_lvalue_to_rvalue, build_atomic_assign,
c_finish_stmt_expr): Remove NULL last argument from
create_tmp_var_raw and create_tmp_var calls.
* c-array-notation.c (fix_builtin_array_notation_fn,
build_array_notation_expr, fix_conditional_array_notations_1,
fix_array_notation_expr, fix_array_notation_call_expr): Likewise.
cp/
* cp-gimplify.c (cxx_omp_clause_apply_fn): Remove NULL last argument
from create_tmp_var calls.
c-family/
* c-common.c (convert_vector_to_pointer_for_subscript): Remove NULL
last argument from create_tmp_var_raw and create_tmp_var calls.
* cilk.c (gimplify_cilk_spawn): Likewise.
* c-omp.c (c_finish_omp_atomic): Likewise.
fortran/
* trans-openmp.c (gfc_omp_finish_clause,
gfc_trans_omp_array_reduction_or_udr, gfc_trans_omp_atomic): Remove
NULL last argument from create_tmp_var_raw and create_tmp_var calls.
From-SVN: r218181
2014-11-29 12:35:30 +01:00
|
|
|
tree var = make_ssa_name (TREE_TYPE (lhs));
|
gimple.h (gimple_build_assign_stat): Remove prototype.
* gimple.h (gimple_build_assign_stat): Remove prototype.
(gimple_build_assign): Remove define. Add overload prototypes
with tree lhs and either a tree rhs, or enum tree_code and
1, 2 or 3 tree operands.
* gimple.c (gimple_build_assign_stat): Renamed to...
(gimple_build_assign): ... this. Add overloads with
enum tree_code and 1, 2 or 3 tree operands.
(gimple_build_assign_with_ops): Remove 1 and 2 operand overloads.
Rename the 3 operand overload to ...
(gimple_build_assign_1): ... this. Make it static inline.
* tree-ssa-strlen.c (get_string_length): Use gimple_build_assign
instead of gimple_build_assign_with_ops, swap the order of first
two arguments and adjust formatting where necessary.
* tree-vect-slp.c (vect_get_constant_vectors,
vect_create_mask_and_perm): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_builtin_call): Likewise.
* tree-chkp.c (chkp_compute_bounds_for_assignment,
chkp_generate_extern_var_bounds): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* tree-ssa-loop-im.c (rewrite_reciprocal): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (vect_create_cond_for_align_checks): Likewise.
* value-prof.c (gimple_divmod_fixed_value, gimple_mod_pow2,
gimple_mod_subtract): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_recog_dot_prod_pattern,
vect_recog_sad_pattern, vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_recog_pow_pattern,
vect_recog_widen_sum_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern, vect_recog_widen_shift_pattern,
vect_recog_rotate_pattern, vect_recog_vector_vector_shift_pattern,
vect_recog_divmod_pattern, vect_recog_mixed_size_cond_pattern,
adjust_bool_pattern_cast, adjust_bool_pattern,
vect_recog_bool_pattern): Likewise.
* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge,
insert_initializers, introduce_cast_before_cand,
replace_one_candidate): Likewise.
* tree-ssa-math-opts.c (insert_reciprocals, powi_as_mults_1,
powi_as_mults, build_and_insert_binop, build_and_insert_cast,
pass_cse_sincos::execute, bswap_replace, convert_mult_to_fma):
Likewise.
* tree-tailcall.c (adjust_return_value_with_ops,
update_accumulator_with_ops): Likewise.
* tree-predcom.c (reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates, attempt_builtin_powi,
reassociate_bb): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
get_initial_def_for_induction, vect_create_epilog_for_reduction):
Likewise.
* ipa-split.c (split_function): Likewise.
* tree-ssa-phiopt.c (conditional_replacement, minmax_replacement,
abs_replacement, neg_replacement): Likewise.
* tree-profile.c (gimple_gen_edge_profiler): Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* gimple-fold.c (rewrite_to_defined_overflow, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_expand_null_ifn, ubsan_expand_objsize_ifn,
instrument_bool_enum_load): Likewise.
* tree-ssa-loop-manip.c (create_iv): Likewise.
* omp-low.c (lower_rec_input_clauses, expand_omp_for_generic,
expand_omp_for_static_nochunk, expand_omp_for_static_chunk,
expand_cilk_for, simd_clone_adjust): Likewise.
* trans-mem.c (expand_transaction): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_permute_store_chain,
vect_setup_realignment, vect_permute_load_chain,
vect_shift_permute_load_chain): Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_simd_clone_call, vect_gen_widened_results_half,
vect_create_vectorized_demotion_stmts, vectorizable_conversion,
vectorizable_shift, vectorizable_operation, vectorizable_store,
permute_vec_elements, vectorizable_load): Likewise.
From-SVN: r218216
2014-12-01 14:58:10 +01:00
|
|
|
g = gimple_build_assign (var, NOP_EXPR, args[1]);
|
2012-12-04 14:20:20 +01:00
|
|
|
gsi_insert_after (gsi, g, GSI_NEW_STMT);
|
|
|
|
args[1] = var;
|
|
|
|
}
|
gimple-expr.h (create_tmp_var_raw, [...]): Add default NULL value to last argument.
* gimple-expr.h (create_tmp_var_raw, create_tmp_var,
create_tmp_reg): Add default NULL value to last argument.
* tree-ssanames.h (make_ssa_name, copy_ssa_name): Likewise.
* gimple-low.c (lower_builtin_posix_memalign): Remove NULL
last argument from create_tmp_var_raw, create_tmp_var,
create_tmp_reg, make_ssa_name and copy_ssa_name calls.
* tree-ssa-strlen.c (get_string_length): Likewise.
* tree-emutls.c (gen_emutls_addr, lower_emutls_1): Likewise.
* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
* ipa-prop.c (ipa_modify_call_arguments): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* tree-ssa-ccp.c (fold_builtin_alloca_with_align): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_expr, instrument_builtin_call,
instrument_func_entry): Likewise.
* varpool.c (add_new_static_var): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* gimplify.c (internal_get_tmp_var, gimplify_return_expr,
gimplify_modify_expr_to_memcpy, gimplify_modify_expr_to_memset,
gimplify_init_ctor_eval_range, gimplify_init_constructor,
gimplify_omp_atomic, gimplify_expr): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1,
slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge,
vect_loop_versioning): Likewise.
* tree-if-conv.c (version_loop_for_if_conversion): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern): Likewise.
* tree-sra.c (build_ref_for_offset, create_access_replacement):
Likewise.
* tree-cfg.c (make_blocks): Likewise.
* tree-eh.c (lower_eh_constructs_2, lower_resx, lower_eh_dispatch):
Likewise.
* tree-ssa-propagate.c (update_call_from_tree): Likewise.
* tree-complex.c (get_component_ssa_name, expand_complex_div_wide):
Likewise.
* tree-ssa-math-opts.c (build_and_insert_cast): Likewise.
* tree-tailcall.c (update_accumulator_with_ops): Likewise.
* tree-predcom.c (initialize_root_vars, initialize_root_vars_lm,
execute_load_motion, reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
vect_create_epilog_for_reduction): Likewise.
* ipa-split.c (split_function): Likewise.
* tree-inline.c (remap_ssa_name, setup_one_parameter,
declare_return_variable, tree_function_versioning): Likewise.
* tree-cfgcleanup.c (fixup_noreturn_call): Likewise.
* cfgexpand.c (update_alias_info_with_stack_vars, expand_used_vars):
Likewise.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement,
neg_replacement): Likewise.
* gimplify-me.c (force_gimple_operand_1, gimple_regimplify_operands):
Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests,
build_one_array, build_arrays, gen_def_assigns): Likewise.
* gimple-fold.c (gimple_fold_builtin_memory_op,
gimple_fold_builtin_strcat, gimple_fold_call, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_encode_value, ubsan_expand_null_ifn,
ubsan_expand_objsize_ifn, instrument_si_overflow,
instrument_bool_enum_load, instrument_nonnull_arg): Likewise.
* tree-outof-ssa.c (insert_backedge_copies): Likewise.
* tree-ssa-loop-manip.c (create_iv,
tree_transform_and_unroll_loop): Likewise.
* omp-low.c (scan_omp_parallel, lower_rec_simd_input_clauses,
lower_rec_input_clauses, lower_lastprivate_clauses,
expand_parallel_call, expand_omp_for_static_chunk,
expand_omp_atomic_pipeline, expand_omp_target,
maybe_add_implicit_barrier_cancel, lower_omp_single_simple,
lower_omp_critical, lower_omp_for, task_copyfn_copy_decl,
lower_depend_clauses, lower_omp_target, lower_omp_1,
ipa_simd_modify_stmt_ops, simd_clone_adjust): Likewise.
* tree-parloops.c (take_address_of, create_phi_for_local_result,
create_call_for_reduction_1, separate_decls_in_region,
create_parallel_loop): Likewise.
* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_dependence,
handle_scalar_deps_crossing_scop_limits): Likewise.
* trans-mem.c (lower_transaction, build_tm_load, build_tm_store,
expand_assign_tm, expand_call_tm, expand_transaction,
ipa_tm_insert_gettmclone_call): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_setup_realignment):
Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_call, vectorizable_simd_clone_call,
vectorizable_conversion, vectorizable_store, permute_vec_elements,
vectorizable_load): Likewise.
c/
* c-typeck.c (convert_lvalue_to_rvalue, build_atomic_assign,
c_finish_stmt_expr): Remove NULL last argument from
create_tmp_var_raw and create_tmp_var calls.
* c-array-notation.c (fix_builtin_array_notation_fn,
build_array_notation_expr, fix_conditional_array_notations_1,
fix_array_notation_expr, fix_array_notation_call_expr): Likewise.
cp/
* cp-gimplify.c (cxx_omp_clause_apply_fn): Remove NULL last argument
from create_tmp_var calls.
c-family/
* c-common.c (convert_vector_to_pointer_for_subscript): Remove NULL
last argument from create_tmp_var_raw and create_tmp_var calls.
* cilk.c (gimplify_cilk_spawn): Likewise.
* c-omp.c (c_finish_omp_atomic): Likewise.
fortran/
* trans-openmp.c (gfc_omp_finish_clause,
gfc_trans_omp_array_reduction_or_udr, gfc_trans_omp_atomic): Remove
NULL last argument from create_tmp_var_raw and create_tmp_var calls.
From-SVN: r218181
2014-11-29 12:35:30 +01:00
|
|
|
gimple_call_set_lhs (stmt, make_ssa_name (TREE_TYPE (lhs)));
|
2012-12-04 14:20:20 +01:00
|
|
|
/* BIT_NOT_EXPR stands for NAND. */
|
|
|
|
if (tsan_atomic_table[i].code == BIT_NOT_EXPR)
|
|
|
|
{
|
gimple-expr.h (create_tmp_var_raw, [...]): Add default NULL value to last argument.
* gimple-expr.h (create_tmp_var_raw, create_tmp_var,
create_tmp_reg): Add default NULL value to last argument.
* tree-ssanames.h (make_ssa_name, copy_ssa_name): Likewise.
* gimple-low.c (lower_builtin_posix_memalign): Remove NULL
last argument from create_tmp_var_raw, create_tmp_var,
create_tmp_reg, make_ssa_name and copy_ssa_name calls.
* tree-ssa-strlen.c (get_string_length): Likewise.
* tree-emutls.c (gen_emutls_addr, lower_emutls_1): Likewise.
* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
* ipa-prop.c (ipa_modify_call_arguments): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* tree-ssa-ccp.c (fold_builtin_alloca_with_align): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_expr, instrument_builtin_call,
instrument_func_entry): Likewise.
* varpool.c (add_new_static_var): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* gimplify.c (internal_get_tmp_var, gimplify_return_expr,
gimplify_modify_expr_to_memcpy, gimplify_modify_expr_to_memset,
gimplify_init_ctor_eval_range, gimplify_init_constructor,
gimplify_omp_atomic, gimplify_expr): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1,
slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge,
vect_loop_versioning): Likewise.
* tree-if-conv.c (version_loop_for_if_conversion): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern): Likewise.
* tree-sra.c (build_ref_for_offset, create_access_replacement):
Likewise.
* tree-cfg.c (make_blocks): Likewise.
* tree-eh.c (lower_eh_constructs_2, lower_resx, lower_eh_dispatch):
Likewise.
* tree-ssa-propagate.c (update_call_from_tree): Likewise.
* tree-complex.c (get_component_ssa_name, expand_complex_div_wide):
Likewise.
* tree-ssa-math-opts.c (build_and_insert_cast): Likewise.
* tree-tailcall.c (update_accumulator_with_ops): Likewise.
* tree-predcom.c (initialize_root_vars, initialize_root_vars_lm,
execute_load_motion, reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
vect_create_epilog_for_reduction): Likewise.
* ipa-split.c (split_function): Likewise.
* tree-inline.c (remap_ssa_name, setup_one_parameter,
declare_return_variable, tree_function_versioning): Likewise.
* tree-cfgcleanup.c (fixup_noreturn_call): Likewise.
* cfgexpand.c (update_alias_info_with_stack_vars, expand_used_vars):
Likewise.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement,
neg_replacement): Likewise.
* gimplify-me.c (force_gimple_operand_1, gimple_regimplify_operands):
Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests,
build_one_array, build_arrays, gen_def_assigns): Likewise.
* gimple-fold.c (gimple_fold_builtin_memory_op,
gimple_fold_builtin_strcat, gimple_fold_call, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_encode_value, ubsan_expand_null_ifn,
ubsan_expand_objsize_ifn, instrument_si_overflow,
instrument_bool_enum_load, instrument_nonnull_arg): Likewise.
* tree-outof-ssa.c (insert_backedge_copies): Likewise.
* tree-ssa-loop-manip.c (create_iv,
tree_transform_and_unroll_loop): Likewise.
* omp-low.c (scan_omp_parallel, lower_rec_simd_input_clauses,
lower_rec_input_clauses, lower_lastprivate_clauses,
expand_parallel_call, expand_omp_for_static_chunk,
expand_omp_atomic_pipeline, expand_omp_target,
maybe_add_implicit_barrier_cancel, lower_omp_single_simple,
lower_omp_critical, lower_omp_for, task_copyfn_copy_decl,
lower_depend_clauses, lower_omp_target, lower_omp_1,
ipa_simd_modify_stmt_ops, simd_clone_adjust): Likewise.
* tree-parloops.c (take_address_of, create_phi_for_local_result,
create_call_for_reduction_1, separate_decls_in_region,
create_parallel_loop): Likewise.
* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_dependence,
handle_scalar_deps_crossing_scop_limits): Likewise.
* trans-mem.c (lower_transaction, build_tm_load, build_tm_store,
expand_assign_tm, expand_call_tm, expand_transaction,
ipa_tm_insert_gettmclone_call): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_setup_realignment):
Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_call, vectorizable_simd_clone_call,
vectorizable_conversion, vectorizable_store, permute_vec_elements,
vectorizable_load): Likewise.
c/
* c-typeck.c (convert_lvalue_to_rvalue, build_atomic_assign,
c_finish_stmt_expr): Remove NULL last argument from
create_tmp_var_raw and create_tmp_var calls.
* c-array-notation.c (fix_builtin_array_notation_fn,
build_array_notation_expr, fix_conditional_array_notations_1,
fix_array_notation_expr, fix_array_notation_call_expr): Likewise.
cp/
* cp-gimplify.c (cxx_omp_clause_apply_fn): Remove NULL last argument
from create_tmp_var calls.
c-family/
* c-common.c (convert_vector_to_pointer_for_subscript): Remove NULL
last argument from create_tmp_var_raw and create_tmp_var calls.
* cilk.c (gimplify_cilk_spawn): Likewise.
* c-omp.c (c_finish_omp_atomic): Likewise.
fortran/
* trans-openmp.c (gfc_omp_finish_clause,
gfc_trans_omp_array_reduction_or_udr, gfc_trans_omp_atomic): Remove
NULL last argument from create_tmp_var_raw and create_tmp_var calls.
From-SVN: r218181
2014-11-29 12:35:30 +01:00
|
|
|
tree var = make_ssa_name (TREE_TYPE (lhs));
|
gimple.h (gimple_build_assign_stat): Remove prototype.
* gimple.h (gimple_build_assign_stat): Remove prototype.
(gimple_build_assign): Remove define. Add overload prototypes
with tree lhs and either a tree rhs, or enum tree_code and
1, 2 or 3 tree operands.
* gimple.c (gimple_build_assign_stat): Renamed to...
(gimple_build_assign): ... this. Add overloads with
enum tree_code and 1, 2 or 3 tree operands.
(gimple_build_assign_with_ops): Remove 1 and 2 operand overloads.
Rename the 3 operand overload to ...
(gimple_build_assign_1): ... this. Make it static inline.
* tree-ssa-strlen.c (get_string_length): Use gimple_build_assign
instead of gimple_build_assign_with_ops, swap the order of first
two arguments and adjust formatting where necessary.
* tree-vect-slp.c (vect_get_constant_vectors,
vect_create_mask_and_perm): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_builtin_call): Likewise.
* tree-chkp.c (chkp_compute_bounds_for_assignment,
chkp_generate_extern_var_bounds): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* tree-ssa-loop-im.c (rewrite_reciprocal): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (vect_create_cond_for_align_checks): Likewise.
* value-prof.c (gimple_divmod_fixed_value, gimple_mod_pow2,
gimple_mod_subtract): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_recog_dot_prod_pattern,
vect_recog_sad_pattern, vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_recog_pow_pattern,
vect_recog_widen_sum_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern, vect_recog_widen_shift_pattern,
vect_recog_rotate_pattern, vect_recog_vector_vector_shift_pattern,
vect_recog_divmod_pattern, vect_recog_mixed_size_cond_pattern,
adjust_bool_pattern_cast, adjust_bool_pattern,
vect_recog_bool_pattern): Likewise.
* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge,
insert_initializers, introduce_cast_before_cand,
replace_one_candidate): Likewise.
* tree-ssa-math-opts.c (insert_reciprocals, powi_as_mults_1,
powi_as_mults, build_and_insert_binop, build_and_insert_cast,
pass_cse_sincos::execute, bswap_replace, convert_mult_to_fma):
Likewise.
* tree-tailcall.c (adjust_return_value_with_ops,
update_accumulator_with_ops): Likewise.
* tree-predcom.c (reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates, attempt_builtin_powi,
reassociate_bb): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
get_initial_def_for_induction, vect_create_epilog_for_reduction):
Likewise.
* ipa-split.c (split_function): Likewise.
* tree-ssa-phiopt.c (conditional_replacement, minmax_replacement,
abs_replacement, neg_replacement): Likewise.
* tree-profile.c (gimple_gen_edge_profiler): Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* gimple-fold.c (rewrite_to_defined_overflow, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_expand_null_ifn, ubsan_expand_objsize_ifn,
instrument_bool_enum_load): Likewise.
* tree-ssa-loop-manip.c (create_iv): Likewise.
* omp-low.c (lower_rec_input_clauses, expand_omp_for_generic,
expand_omp_for_static_nochunk, expand_omp_for_static_chunk,
expand_cilk_for, simd_clone_adjust): Likewise.
* trans-mem.c (expand_transaction): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_permute_store_chain,
vect_setup_realignment, vect_permute_load_chain,
vect_shift_permute_load_chain): Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_simd_clone_call, vect_gen_widened_results_half,
vect_create_vectorized_demotion_stmts, vectorizable_conversion,
vectorizable_shift, vectorizable_operation, vectorizable_store,
permute_vec_elements, vectorizable_load): Likewise.
From-SVN: r218216
2014-12-01 14:58:10 +01:00
|
|
|
g = gimple_build_assign (var, BIT_AND_EXPR,
|
|
|
|
gimple_call_lhs (stmt), args[1]);
|
2012-12-04 14:20:20 +01:00
|
|
|
gsi_insert_after (gsi, g, GSI_NEW_STMT);
|
gimple.h (gimple_build_assign_stat): Remove prototype.
* gimple.h (gimple_build_assign_stat): Remove prototype.
(gimple_build_assign): Remove define. Add overload prototypes
with tree lhs and either a tree rhs, or enum tree_code and
1, 2 or 3 tree operands.
* gimple.c (gimple_build_assign_stat): Renamed to...
(gimple_build_assign): ... this. Add overloads with
enum tree_code and 1, 2 or 3 tree operands.
(gimple_build_assign_with_ops): Remove 1 and 2 operand overloads.
Rename the 3 operand overload to ...
(gimple_build_assign_1): ... this. Make it static inline.
* tree-ssa-strlen.c (get_string_length): Use gimple_build_assign
instead of gimple_build_assign_with_ops, swap the order of first
two arguments and adjust formatting where necessary.
* tree-vect-slp.c (vect_get_constant_vectors,
vect_create_mask_and_perm): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_builtin_call): Likewise.
* tree-chkp.c (chkp_compute_bounds_for_assignment,
chkp_generate_extern_var_bounds): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* tree-ssa-loop-im.c (rewrite_reciprocal): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (vect_create_cond_for_align_checks): Likewise.
* value-prof.c (gimple_divmod_fixed_value, gimple_mod_pow2,
gimple_mod_subtract): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_recog_dot_prod_pattern,
vect_recog_sad_pattern, vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_recog_pow_pattern,
vect_recog_widen_sum_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern, vect_recog_widen_shift_pattern,
vect_recog_rotate_pattern, vect_recog_vector_vector_shift_pattern,
vect_recog_divmod_pattern, vect_recog_mixed_size_cond_pattern,
adjust_bool_pattern_cast, adjust_bool_pattern,
vect_recog_bool_pattern): Likewise.
* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge,
insert_initializers, introduce_cast_before_cand,
replace_one_candidate): Likewise.
* tree-ssa-math-opts.c (insert_reciprocals, powi_as_mults_1,
powi_as_mults, build_and_insert_binop, build_and_insert_cast,
pass_cse_sincos::execute, bswap_replace, convert_mult_to_fma):
Likewise.
* tree-tailcall.c (adjust_return_value_with_ops,
update_accumulator_with_ops): Likewise.
* tree-predcom.c (reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates, attempt_builtin_powi,
reassociate_bb): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
get_initial_def_for_induction, vect_create_epilog_for_reduction):
Likewise.
* ipa-split.c (split_function): Likewise.
* tree-ssa-phiopt.c (conditional_replacement, minmax_replacement,
abs_replacement, neg_replacement): Likewise.
* tree-profile.c (gimple_gen_edge_profiler): Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* gimple-fold.c (rewrite_to_defined_overflow, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_expand_null_ifn, ubsan_expand_objsize_ifn,
instrument_bool_enum_load): Likewise.
* tree-ssa-loop-manip.c (create_iv): Likewise.
* omp-low.c (lower_rec_input_clauses, expand_omp_for_generic,
expand_omp_for_static_nochunk, expand_omp_for_static_chunk,
expand_cilk_for, simd_clone_adjust): Likewise.
* trans-mem.c (expand_transaction): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_permute_store_chain,
vect_setup_realignment, vect_permute_load_chain,
vect_shift_permute_load_chain): Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_simd_clone_call, vect_gen_widened_results_half,
vect_create_vectorized_demotion_stmts, vectorizable_conversion,
vectorizable_shift, vectorizable_operation, vectorizable_store,
permute_vec_elements, vectorizable_load): Likewise.
From-SVN: r218216
2014-12-01 14:58:10 +01:00
|
|
|
g = gimple_build_assign (lhs, BIT_NOT_EXPR, var);
|
2012-12-04 14:20:20 +01:00
|
|
|
}
|
|
|
|
else
|
gimple.h (gimple_build_assign_stat): Remove prototype.
* gimple.h (gimple_build_assign_stat): Remove prototype.
(gimple_build_assign): Remove define. Add overload prototypes
with tree lhs and either a tree rhs, or enum tree_code and
1, 2 or 3 tree operands.
* gimple.c (gimple_build_assign_stat): Renamed to...
(gimple_build_assign): ... this. Add overloads with
enum tree_code and 1, 2 or 3 tree operands.
(gimple_build_assign_with_ops): Remove 1 and 2 operand overloads.
Rename the 3 operand overload to ...
(gimple_build_assign_1): ... this. Make it static inline.
* tree-ssa-strlen.c (get_string_length): Use gimple_build_assign
instead of gimple_build_assign_with_ops, swap the order of first
two arguments and adjust formatting where necessary.
* tree-vect-slp.c (vect_get_constant_vectors,
vect_create_mask_and_perm): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_builtin_call): Likewise.
* tree-chkp.c (chkp_compute_bounds_for_assignment,
chkp_generate_extern_var_bounds): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* tree-ssa-loop-im.c (rewrite_reciprocal): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (vect_create_cond_for_align_checks): Likewise.
* value-prof.c (gimple_divmod_fixed_value, gimple_mod_pow2,
gimple_mod_subtract): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_recog_dot_prod_pattern,
vect_recog_sad_pattern, vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_recog_pow_pattern,
vect_recog_widen_sum_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern, vect_recog_widen_shift_pattern,
vect_recog_rotate_pattern, vect_recog_vector_vector_shift_pattern,
vect_recog_divmod_pattern, vect_recog_mixed_size_cond_pattern,
adjust_bool_pattern_cast, adjust_bool_pattern,
vect_recog_bool_pattern): Likewise.
* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge,
insert_initializers, introduce_cast_before_cand,
replace_one_candidate): Likewise.
* tree-ssa-math-opts.c (insert_reciprocals, powi_as_mults_1,
powi_as_mults, build_and_insert_binop, build_and_insert_cast,
pass_cse_sincos::execute, bswap_replace, convert_mult_to_fma):
Likewise.
* tree-tailcall.c (adjust_return_value_with_ops,
update_accumulator_with_ops): Likewise.
* tree-predcom.c (reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates, attempt_builtin_powi,
reassociate_bb): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
get_initial_def_for_induction, vect_create_epilog_for_reduction):
Likewise.
* ipa-split.c (split_function): Likewise.
* tree-ssa-phiopt.c (conditional_replacement, minmax_replacement,
abs_replacement, neg_replacement): Likewise.
* tree-profile.c (gimple_gen_edge_profiler): Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* gimple-fold.c (rewrite_to_defined_overflow, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_expand_null_ifn, ubsan_expand_objsize_ifn,
instrument_bool_enum_load): Likewise.
* tree-ssa-loop-manip.c (create_iv): Likewise.
* omp-low.c (lower_rec_input_clauses, expand_omp_for_generic,
expand_omp_for_static_nochunk, expand_omp_for_static_chunk,
expand_cilk_for, simd_clone_adjust): Likewise.
* trans-mem.c (expand_transaction): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_permute_store_chain,
vect_setup_realignment, vect_permute_load_chain,
vect_shift_permute_load_chain): Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_simd_clone_call, vect_gen_widened_results_half,
vect_create_vectorized_demotion_stmts, vectorizable_conversion,
vectorizable_shift, vectorizable_operation, vectorizable_store,
permute_vec_elements, vectorizable_load): Likewise.
From-SVN: r218216
2014-12-01 14:58:10 +01:00
|
|
|
g = gimple_build_assign (lhs, tsan_atomic_table[i].code,
|
|
|
|
gimple_call_lhs (stmt), args[1]);
|
2012-12-04 14:20:20 +01:00
|
|
|
update_stmt (stmt);
|
|
|
|
gsi_insert_after (gsi, g, GSI_NEW_STMT);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case weak_cas:
|
|
|
|
if (!integer_nonzerop (gimple_call_arg (stmt, 3)))
|
|
|
|
continue;
|
|
|
|
/* FALLTHRU */
|
|
|
|
case strong_cas:
|
|
|
|
gcc_assert (num == 6);
|
|
|
|
for (j = 0; j < 6; j++)
|
|
|
|
args[j] = gimple_call_arg (stmt, j);
|
2017-03-21 09:22:57 +01:00
|
|
|
if (tree_fits_uhwi_p (args[4])
|
|
|
|
&& memmodel_base (tree_to_uhwi (args[4])) >= MEMMODEL_LAST)
|
2012-12-04 14:20:20 +01:00
|
|
|
return;
|
2017-03-21 09:22:57 +01:00
|
|
|
if (tree_fits_uhwi_p (args[5])
|
|
|
|
&& memmodel_base (tree_to_uhwi (args[5])) >= MEMMODEL_LAST)
|
2012-12-04 14:20:20 +01:00
|
|
|
return;
|
|
|
|
update_gimple_call (gsi, decl, 5, args[0], args[1], args[2],
|
|
|
|
args[4], args[5]);
|
2017-03-22 19:34:44 +01:00
|
|
|
maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (*gsi));
|
2012-12-04 14:20:20 +01:00
|
|
|
return;
|
|
|
|
case bool_cas:
|
|
|
|
case val_cas:
|
|
|
|
gcc_assert (num == 3);
|
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
args[j] = gimple_call_arg (stmt, j);
|
|
|
|
t = TYPE_ARG_TYPES (TREE_TYPE (decl));
|
|
|
|
t = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (t)));
|
gimple-expr.h (create_tmp_var_raw, [...]): Add default NULL value to last argument.
* gimple-expr.h (create_tmp_var_raw, create_tmp_var,
create_tmp_reg): Add default NULL value to last argument.
* tree-ssanames.h (make_ssa_name, copy_ssa_name): Likewise.
* gimple-low.c (lower_builtin_posix_memalign): Remove NULL
last argument from create_tmp_var_raw, create_tmp_var,
create_tmp_reg, make_ssa_name and copy_ssa_name calls.
* tree-ssa-strlen.c (get_string_length): Likewise.
* tree-emutls.c (gen_emutls_addr, lower_emutls_1): Likewise.
* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
* ipa-prop.c (ipa_modify_call_arguments): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* tree-ssa-ccp.c (fold_builtin_alloca_with_align): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_expr, instrument_builtin_call,
instrument_func_entry): Likewise.
* varpool.c (add_new_static_var): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* gimplify.c (internal_get_tmp_var, gimplify_return_expr,
gimplify_modify_expr_to_memcpy, gimplify_modify_expr_to_memset,
gimplify_init_ctor_eval_range, gimplify_init_constructor,
gimplify_omp_atomic, gimplify_expr): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1,
slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge,
vect_loop_versioning): Likewise.
* tree-if-conv.c (version_loop_for_if_conversion): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern): Likewise.
* tree-sra.c (build_ref_for_offset, create_access_replacement):
Likewise.
* tree-cfg.c (make_blocks): Likewise.
* tree-eh.c (lower_eh_constructs_2, lower_resx, lower_eh_dispatch):
Likewise.
* tree-ssa-propagate.c (update_call_from_tree): Likewise.
* tree-complex.c (get_component_ssa_name, expand_complex_div_wide):
Likewise.
* tree-ssa-math-opts.c (build_and_insert_cast): Likewise.
* tree-tailcall.c (update_accumulator_with_ops): Likewise.
* tree-predcom.c (initialize_root_vars, initialize_root_vars_lm,
execute_load_motion, reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
vect_create_epilog_for_reduction): Likewise.
* ipa-split.c (split_function): Likewise.
* tree-inline.c (remap_ssa_name, setup_one_parameter,
declare_return_variable, tree_function_versioning): Likewise.
* tree-cfgcleanup.c (fixup_noreturn_call): Likewise.
* cfgexpand.c (update_alias_info_with_stack_vars, expand_used_vars):
Likewise.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement,
neg_replacement): Likewise.
* gimplify-me.c (force_gimple_operand_1, gimple_regimplify_operands):
Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests,
build_one_array, build_arrays, gen_def_assigns): Likewise.
* gimple-fold.c (gimple_fold_builtin_memory_op,
gimple_fold_builtin_strcat, gimple_fold_call, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_encode_value, ubsan_expand_null_ifn,
ubsan_expand_objsize_ifn, instrument_si_overflow,
instrument_bool_enum_load, instrument_nonnull_arg): Likewise.
* tree-outof-ssa.c (insert_backedge_copies): Likewise.
* tree-ssa-loop-manip.c (create_iv,
tree_transform_and_unroll_loop): Likewise.
* omp-low.c (scan_omp_parallel, lower_rec_simd_input_clauses,
lower_rec_input_clauses, lower_lastprivate_clauses,
expand_parallel_call, expand_omp_for_static_chunk,
expand_omp_atomic_pipeline, expand_omp_target,
maybe_add_implicit_barrier_cancel, lower_omp_single_simple,
lower_omp_critical, lower_omp_for, task_copyfn_copy_decl,
lower_depend_clauses, lower_omp_target, lower_omp_1,
ipa_simd_modify_stmt_ops, simd_clone_adjust): Likewise.
* tree-parloops.c (take_address_of, create_phi_for_local_result,
create_call_for_reduction_1, separate_decls_in_region,
create_parallel_loop): Likewise.
* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_dependence,
handle_scalar_deps_crossing_scop_limits): Likewise.
* trans-mem.c (lower_transaction, build_tm_load, build_tm_store,
expand_assign_tm, expand_call_tm, expand_transaction,
ipa_tm_insert_gettmclone_call): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_setup_realignment):
Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_call, vectorizable_simd_clone_call,
vectorizable_conversion, vectorizable_store, permute_vec_elements,
vectorizable_load): Likewise.
c/
* c-typeck.c (convert_lvalue_to_rvalue, build_atomic_assign,
c_finish_stmt_expr): Remove NULL last argument from
create_tmp_var_raw and create_tmp_var calls.
* c-array-notation.c (fix_builtin_array_notation_fn,
build_array_notation_expr, fix_conditional_array_notations_1,
fix_array_notation_expr, fix_array_notation_call_expr): Likewise.
cp/
* cp-gimplify.c (cxx_omp_clause_apply_fn): Remove NULL last argument
from create_tmp_var calls.
c-family/
* c-common.c (convert_vector_to_pointer_for_subscript): Remove NULL
last argument from create_tmp_var_raw and create_tmp_var calls.
* cilk.c (gimplify_cilk_spawn): Likewise.
* c-omp.c (c_finish_omp_atomic): Likewise.
fortran/
* trans-openmp.c (gfc_omp_finish_clause,
gfc_trans_omp_array_reduction_or_udr, gfc_trans_omp_atomic): Remove
NULL last argument from create_tmp_var_raw and create_tmp_var calls.
From-SVN: r218181
2014-11-29 12:35:30 +01:00
|
|
|
t = create_tmp_var (t);
|
2012-12-04 14:20:20 +01:00
|
|
|
mark_addressable (t);
|
|
|
|
if (!useless_type_conversion_p (TREE_TYPE (t),
|
|
|
|
TREE_TYPE (args[1])))
|
|
|
|
{
|
gimple.h (gimple_build_assign_stat): Remove prototype.
* gimple.h (gimple_build_assign_stat): Remove prototype.
(gimple_build_assign): Remove define. Add overload prototypes
with tree lhs and either a tree rhs, or enum tree_code and
1, 2 or 3 tree operands.
* gimple.c (gimple_build_assign_stat): Renamed to...
(gimple_build_assign): ... this. Add overloads with
enum tree_code and 1, 2 or 3 tree operands.
(gimple_build_assign_with_ops): Remove 1 and 2 operand overloads.
Rename the 3 operand overload to ...
(gimple_build_assign_1): ... this. Make it static inline.
* tree-ssa-strlen.c (get_string_length): Use gimple_build_assign
instead of gimple_build_assign_with_ops, swap the order of first
two arguments and adjust formatting where necessary.
* tree-vect-slp.c (vect_get_constant_vectors,
vect_create_mask_and_perm): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_builtin_call): Likewise.
* tree-chkp.c (chkp_compute_bounds_for_assignment,
chkp_generate_extern_var_bounds): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* tree-ssa-loop-im.c (rewrite_reciprocal): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (vect_create_cond_for_align_checks): Likewise.
* value-prof.c (gimple_divmod_fixed_value, gimple_mod_pow2,
gimple_mod_subtract): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_recog_dot_prod_pattern,
vect_recog_sad_pattern, vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_recog_pow_pattern,
vect_recog_widen_sum_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern, vect_recog_widen_shift_pattern,
vect_recog_rotate_pattern, vect_recog_vector_vector_shift_pattern,
vect_recog_divmod_pattern, vect_recog_mixed_size_cond_pattern,
adjust_bool_pattern_cast, adjust_bool_pattern,
vect_recog_bool_pattern): Likewise.
* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge,
insert_initializers, introduce_cast_before_cand,
replace_one_candidate): Likewise.
* tree-ssa-math-opts.c (insert_reciprocals, powi_as_mults_1,
powi_as_mults, build_and_insert_binop, build_and_insert_cast,
pass_cse_sincos::execute, bswap_replace, convert_mult_to_fma):
Likewise.
* tree-tailcall.c (adjust_return_value_with_ops,
update_accumulator_with_ops): Likewise.
* tree-predcom.c (reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates, attempt_builtin_powi,
reassociate_bb): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
get_initial_def_for_induction, vect_create_epilog_for_reduction):
Likewise.
* ipa-split.c (split_function): Likewise.
* tree-ssa-phiopt.c (conditional_replacement, minmax_replacement,
abs_replacement, neg_replacement): Likewise.
* tree-profile.c (gimple_gen_edge_profiler): Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* gimple-fold.c (rewrite_to_defined_overflow, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_expand_null_ifn, ubsan_expand_objsize_ifn,
instrument_bool_enum_load): Likewise.
* tree-ssa-loop-manip.c (create_iv): Likewise.
* omp-low.c (lower_rec_input_clauses, expand_omp_for_generic,
expand_omp_for_static_nochunk, expand_omp_for_static_chunk,
expand_cilk_for, simd_clone_adjust): Likewise.
* trans-mem.c (expand_transaction): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_permute_store_chain,
vect_setup_realignment, vect_permute_load_chain,
vect_shift_permute_load_chain): Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_simd_clone_call, vect_gen_widened_results_half,
vect_create_vectorized_demotion_stmts, vectorizable_conversion,
vectorizable_shift, vectorizable_operation, vectorizable_store,
permute_vec_elements, vectorizable_load): Likewise.
From-SVN: r218216
2014-12-01 14:58:10 +01:00
|
|
|
g = gimple_build_assign (make_ssa_name (TREE_TYPE (t)),
|
|
|
|
NOP_EXPR, args[1]);
|
2012-12-04 14:20:20 +01:00
|
|
|
gsi_insert_before (gsi, g, GSI_SAME_STMT);
|
|
|
|
args[1] = gimple_assign_lhs (g);
|
|
|
|
}
|
|
|
|
g = gimple_build_assign (t, args[1]);
|
|
|
|
gsi_insert_before (gsi, g, GSI_SAME_STMT);
|
|
|
|
lhs = gimple_call_lhs (stmt);
|
|
|
|
update_gimple_call (gsi, decl, 5, args[0],
|
|
|
|
build_fold_addr_expr (t), args[2],
|
|
|
|
build_int_cst (NULL_TREE,
|
|
|
|
MEMMODEL_SEQ_CST),
|
|
|
|
build_int_cst (NULL_TREE,
|
|
|
|
MEMMODEL_SEQ_CST));
|
2017-03-22 19:34:44 +01:00
|
|
|
maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (*gsi));
|
2012-12-04 14:20:20 +01:00
|
|
|
if (tsan_atomic_table[i].action == val_cas && lhs)
|
|
|
|
{
|
|
|
|
tree cond;
|
|
|
|
stmt = gsi_stmt (*gsi);
|
gimple-expr.h (create_tmp_var_raw, [...]): Add default NULL value to last argument.
* gimple-expr.h (create_tmp_var_raw, create_tmp_var,
create_tmp_reg): Add default NULL value to last argument.
* tree-ssanames.h (make_ssa_name, copy_ssa_name): Likewise.
* gimple-low.c (lower_builtin_posix_memalign): Remove NULL
last argument from create_tmp_var_raw, create_tmp_var,
create_tmp_reg, make_ssa_name and copy_ssa_name calls.
* tree-ssa-strlen.c (get_string_length): Likewise.
* tree-emutls.c (gen_emutls_addr, lower_emutls_1): Likewise.
* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
* ipa-prop.c (ipa_modify_call_arguments): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* tree-ssa-ccp.c (fold_builtin_alloca_with_align): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_expr, instrument_builtin_call,
instrument_func_entry): Likewise.
* varpool.c (add_new_static_var): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* gimplify.c (internal_get_tmp_var, gimplify_return_expr,
gimplify_modify_expr_to_memcpy, gimplify_modify_expr_to_memset,
gimplify_init_ctor_eval_range, gimplify_init_constructor,
gimplify_omp_atomic, gimplify_expr): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1,
slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge,
vect_loop_versioning): Likewise.
* tree-if-conv.c (version_loop_for_if_conversion): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern): Likewise.
* tree-sra.c (build_ref_for_offset, create_access_replacement):
Likewise.
* tree-cfg.c (make_blocks): Likewise.
* tree-eh.c (lower_eh_constructs_2, lower_resx, lower_eh_dispatch):
Likewise.
* tree-ssa-propagate.c (update_call_from_tree): Likewise.
* tree-complex.c (get_component_ssa_name, expand_complex_div_wide):
Likewise.
* tree-ssa-math-opts.c (build_and_insert_cast): Likewise.
* tree-tailcall.c (update_accumulator_with_ops): Likewise.
* tree-predcom.c (initialize_root_vars, initialize_root_vars_lm,
execute_load_motion, reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
vect_create_epilog_for_reduction): Likewise.
* ipa-split.c (split_function): Likewise.
* tree-inline.c (remap_ssa_name, setup_one_parameter,
declare_return_variable, tree_function_versioning): Likewise.
* tree-cfgcleanup.c (fixup_noreturn_call): Likewise.
* cfgexpand.c (update_alias_info_with_stack_vars, expand_used_vars):
Likewise.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement,
neg_replacement): Likewise.
* gimplify-me.c (force_gimple_operand_1, gimple_regimplify_operands):
Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests,
build_one_array, build_arrays, gen_def_assigns): Likewise.
* gimple-fold.c (gimple_fold_builtin_memory_op,
gimple_fold_builtin_strcat, gimple_fold_call, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_encode_value, ubsan_expand_null_ifn,
ubsan_expand_objsize_ifn, instrument_si_overflow,
instrument_bool_enum_load, instrument_nonnull_arg): Likewise.
* tree-outof-ssa.c (insert_backedge_copies): Likewise.
* tree-ssa-loop-manip.c (create_iv,
tree_transform_and_unroll_loop): Likewise.
* omp-low.c (scan_omp_parallel, lower_rec_simd_input_clauses,
lower_rec_input_clauses, lower_lastprivate_clauses,
expand_parallel_call, expand_omp_for_static_chunk,
expand_omp_atomic_pipeline, expand_omp_target,
maybe_add_implicit_barrier_cancel, lower_omp_single_simple,
lower_omp_critical, lower_omp_for, task_copyfn_copy_decl,
lower_depend_clauses, lower_omp_target, lower_omp_1,
ipa_simd_modify_stmt_ops, simd_clone_adjust): Likewise.
* tree-parloops.c (take_address_of, create_phi_for_local_result,
create_call_for_reduction_1, separate_decls_in_region,
create_parallel_loop): Likewise.
* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_dependence,
handle_scalar_deps_crossing_scop_limits): Likewise.
* trans-mem.c (lower_transaction, build_tm_load, build_tm_store,
expand_assign_tm, expand_call_tm, expand_transaction,
ipa_tm_insert_gettmclone_call): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_setup_realignment):
Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_call, vectorizable_simd_clone_call,
vectorizable_conversion, vectorizable_store, permute_vec_elements,
vectorizable_load): Likewise.
c/
* c-typeck.c (convert_lvalue_to_rvalue, build_atomic_assign,
c_finish_stmt_expr): Remove NULL last argument from
create_tmp_var_raw and create_tmp_var calls.
* c-array-notation.c (fix_builtin_array_notation_fn,
build_array_notation_expr, fix_conditional_array_notations_1,
fix_array_notation_expr, fix_array_notation_call_expr): Likewise.
cp/
* cp-gimplify.c (cxx_omp_clause_apply_fn): Remove NULL last argument
from create_tmp_var calls.
c-family/
* c-common.c (convert_vector_to_pointer_for_subscript): Remove NULL
last argument from create_tmp_var_raw and create_tmp_var calls.
* cilk.c (gimplify_cilk_spawn): Likewise.
* c-omp.c (c_finish_omp_atomic): Likewise.
fortran/
* trans-openmp.c (gfc_omp_finish_clause,
gfc_trans_omp_array_reduction_or_udr, gfc_trans_omp_atomic): Remove
NULL last argument from create_tmp_var_raw and create_tmp_var calls.
From-SVN: r218181
2014-11-29 12:35:30 +01:00
|
|
|
g = gimple_build_assign (make_ssa_name (TREE_TYPE (t)), t);
|
2012-12-04 14:20:20 +01:00
|
|
|
gsi_insert_after (gsi, g, GSI_NEW_STMT);
|
|
|
|
t = make_ssa_name (TREE_TYPE (TREE_TYPE (decl)), stmt);
|
|
|
|
cond = build2 (NE_EXPR, boolean_type_node, t,
|
|
|
|
build_int_cst (TREE_TYPE (t), 0));
|
gimple.h (gimple_build_assign_stat): Remove prototype.
* gimple.h (gimple_build_assign_stat): Remove prototype.
(gimple_build_assign): Remove define. Add overload prototypes
with tree lhs and either a tree rhs, or enum tree_code and
1, 2 or 3 tree operands.
* gimple.c (gimple_build_assign_stat): Renamed to...
(gimple_build_assign): ... this. Add overloads with
enum tree_code and 1, 2 or 3 tree operands.
(gimple_build_assign_with_ops): Remove 1 and 2 operand overloads.
Rename the 3 operand overload to ...
(gimple_build_assign_1): ... this. Make it static inline.
* tree-ssa-strlen.c (get_string_length): Use gimple_build_assign
instead of gimple_build_assign_with_ops, swap the order of first
two arguments and adjust formatting where necessary.
* tree-vect-slp.c (vect_get_constant_vectors,
vect_create_mask_and_perm): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_builtin_call): Likewise.
* tree-chkp.c (chkp_compute_bounds_for_assignment,
chkp_generate_extern_var_bounds): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* tree-ssa-loop-im.c (rewrite_reciprocal): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (vect_create_cond_for_align_checks): Likewise.
* value-prof.c (gimple_divmod_fixed_value, gimple_mod_pow2,
gimple_mod_subtract): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_recog_dot_prod_pattern,
vect_recog_sad_pattern, vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_recog_pow_pattern,
vect_recog_widen_sum_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern, vect_recog_widen_shift_pattern,
vect_recog_rotate_pattern, vect_recog_vector_vector_shift_pattern,
vect_recog_divmod_pattern, vect_recog_mixed_size_cond_pattern,
adjust_bool_pattern_cast, adjust_bool_pattern,
vect_recog_bool_pattern): Likewise.
* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge,
insert_initializers, introduce_cast_before_cand,
replace_one_candidate): Likewise.
* tree-ssa-math-opts.c (insert_reciprocals, powi_as_mults_1,
powi_as_mults, build_and_insert_binop, build_and_insert_cast,
pass_cse_sincos::execute, bswap_replace, convert_mult_to_fma):
Likewise.
* tree-tailcall.c (adjust_return_value_with_ops,
update_accumulator_with_ops): Likewise.
* tree-predcom.c (reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates, attempt_builtin_powi,
reassociate_bb): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
get_initial_def_for_induction, vect_create_epilog_for_reduction):
Likewise.
* ipa-split.c (split_function): Likewise.
* tree-ssa-phiopt.c (conditional_replacement, minmax_replacement,
abs_replacement, neg_replacement): Likewise.
* tree-profile.c (gimple_gen_edge_profiler): Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* gimple-fold.c (rewrite_to_defined_overflow, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_expand_null_ifn, ubsan_expand_objsize_ifn,
instrument_bool_enum_load): Likewise.
* tree-ssa-loop-manip.c (create_iv): Likewise.
* omp-low.c (lower_rec_input_clauses, expand_omp_for_generic,
expand_omp_for_static_nochunk, expand_omp_for_static_chunk,
expand_cilk_for, simd_clone_adjust): Likewise.
* trans-mem.c (expand_transaction): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_permute_store_chain,
vect_setup_realignment, vect_permute_load_chain,
vect_shift_permute_load_chain): Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_simd_clone_call, vect_gen_widened_results_half,
vect_create_vectorized_demotion_stmts, vectorizable_conversion,
vectorizable_shift, vectorizable_operation, vectorizable_store,
permute_vec_elements, vectorizable_load): Likewise.
From-SVN: r218216
2014-12-01 14:58:10 +01:00
|
|
|
g = gimple_build_assign (lhs, COND_EXPR, cond, args[1],
|
|
|
|
gimple_assign_lhs (g));
|
2012-12-04 14:20:20 +01:00
|
|
|
gimple_call_set_lhs (stmt, t);
|
|
|
|
update_stmt (stmt);
|
|
|
|
gsi_insert_after (gsi, g, GSI_NEW_STMT);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case lock_release:
|
|
|
|
gcc_assert (num == 1);
|
|
|
|
t = TYPE_ARG_TYPES (TREE_TYPE (decl));
|
|
|
|
t = TREE_VALUE (TREE_CHAIN (t));
|
|
|
|
update_gimple_call (gsi, decl, 3, gimple_call_arg (stmt, 0),
|
|
|
|
build_int_cst (t, 0),
|
|
|
|
build_int_cst (NULL_TREE,
|
|
|
|
MEMMODEL_RELEASE));
|
2017-03-22 19:34:44 +01:00
|
|
|
maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (*gsi));
|
2012-12-04 14:20:20 +01:00
|
|
|
return;
|
2016-09-14 11:01:49 +02:00
|
|
|
case bool_clear:
|
|
|
|
case bool_test_and_set:
|
|
|
|
if (BOOL_TYPE_SIZE != 8)
|
|
|
|
{
|
|
|
|
decl = NULL_TREE;
|
|
|
|
for (j = 1; j < 5; j++)
|
|
|
|
if (BOOL_TYPE_SIZE == (8 << j))
|
|
|
|
{
|
|
|
|
enum built_in_function tsan_fcode
|
|
|
|
= (enum built_in_function)
|
|
|
|
(tsan_atomic_table[i].tsan_fcode + j);
|
|
|
|
decl = builtin_decl_implicit (tsan_fcode);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (decl == NULL_TREE)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
last_arg = gimple_call_arg (stmt, num - 1);
|
2017-03-21 09:22:57 +01:00
|
|
|
if (tree_fits_uhwi_p (last_arg)
|
|
|
|
&& memmodel_base (tree_to_uhwi (last_arg)) >= MEMMODEL_LAST)
|
2016-09-14 11:01:49 +02:00
|
|
|
return;
|
|
|
|
t = TYPE_ARG_TYPES (TREE_TYPE (decl));
|
|
|
|
t = TREE_VALUE (TREE_CHAIN (t));
|
|
|
|
if (tsan_atomic_table[i].action == bool_clear)
|
|
|
|
{
|
|
|
|
update_gimple_call (gsi, decl, 3, gimple_call_arg (stmt, 0),
|
|
|
|
build_int_cst (t, 0), last_arg);
|
2017-03-22 19:34:44 +01:00
|
|
|
maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (*gsi));
|
2016-09-14 11:01:49 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
t = build_int_cst (t, targetm.atomic_test_and_set_trueval);
|
|
|
|
update_gimple_call (gsi, decl, 3, gimple_call_arg (stmt, 0),
|
|
|
|
t, last_arg);
|
2017-03-22 19:34:44 +01:00
|
|
|
maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (*gsi));
|
2016-09-14 11:01:49 +02:00
|
|
|
stmt = gsi_stmt (*gsi);
|
|
|
|
lhs = gimple_call_lhs (stmt);
|
|
|
|
if (lhs == NULL_TREE)
|
|
|
|
return;
|
|
|
|
if (targetm.atomic_test_and_set_trueval != 1
|
|
|
|
|| !useless_type_conversion_p (TREE_TYPE (lhs),
|
|
|
|
TREE_TYPE (t)))
|
|
|
|
{
|
|
|
|
tree new_lhs = make_ssa_name (TREE_TYPE (t));
|
|
|
|
gimple_call_set_lhs (stmt, new_lhs);
|
|
|
|
if (targetm.atomic_test_and_set_trueval != 1)
|
|
|
|
g = gimple_build_assign (lhs, NE_EXPR, new_lhs,
|
|
|
|
build_int_cst (TREE_TYPE (t), 0));
|
|
|
|
else
|
|
|
|
g = gimple_build_assign (lhs, NOP_EXPR, new_lhs);
|
|
|
|
gsi_insert_after (gsi, g, GSI_NEW_STMT);
|
|
|
|
update_stmt (stmt);
|
|
|
|
}
|
|
|
|
return;
|
2012-12-04 14:20:20 +01:00
|
|
|
default:
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-22 22:56:58 +01:00
|
|
|
/* Instruments the gimple pointed to by GSI. Return
|
2012-11-23 15:28:19 +01:00
|
|
|
true if func entry/exit should be instrumented. */
|
2012-11-22 22:56:58 +01:00
|
|
|
|
|
|
|
static bool
|
2012-12-04 14:20:20 +01:00
|
|
|
instrument_gimple (gimple_stmt_iterator *gsi)
|
2012-11-22 22:56:58 +01:00
|
|
|
{
|
2015-09-20 02:52:59 +02:00
|
|
|
gimple *stmt;
|
2012-11-22 22:56:58 +01:00
|
|
|
tree rhs, lhs;
|
|
|
|
bool instrumented = false;
|
|
|
|
|
2012-12-04 14:20:20 +01:00
|
|
|
stmt = gsi_stmt (*gsi);
|
2012-11-22 22:56:58 +01:00
|
|
|
if (is_gimple_call (stmt)
|
|
|
|
&& (gimple_call_fndecl (stmt)
|
|
|
|
!= builtin_decl_implicit (BUILT_IN_TSAN_INIT)))
|
2012-12-04 14:20:20 +01:00
|
|
|
{
|
2015-03-19 11:12:34 +01:00
|
|
|
/* All functions with function call will have exit instrumented,
|
|
|
|
therefore no function calls other than __tsan_func_exit
|
|
|
|
shall appear in the functions. */
|
|
|
|
gimple_call_set_tail (as_a <gcall *> (stmt), false);
|
2014-01-08 10:06:27 +01:00
|
|
|
if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
|
2012-12-04 14:20:20 +01:00
|
|
|
instrument_builtin_call (gsi);
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-23 15:28:19 +01:00
|
|
|
else if (is_gimple_assign (stmt)
|
|
|
|
&& !gimple_clobber_p (stmt))
|
2012-11-22 22:56:58 +01:00
|
|
|
{
|
|
|
|
if (gimple_store_p (stmt))
|
|
|
|
{
|
|
|
|
lhs = gimple_assign_lhs (stmt);
|
2012-12-04 14:20:20 +01:00
|
|
|
instrumented = instrument_expr (*gsi, lhs, true);
|
2012-11-22 22:56:58 +01:00
|
|
|
}
|
|
|
|
if (gimple_assign_load_p (stmt))
|
|
|
|
{
|
|
|
|
rhs = gimple_assign_rhs1 (stmt);
|
2012-12-04 14:20:20 +01:00
|
|
|
instrumented = instrument_expr (*gsi, rhs, false);
|
2012-11-22 22:56:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return instrumented;
|
|
|
|
}
|
|
|
|
|
2015-01-05 22:47:51 +01:00
|
|
|
/* Replace TSAN_FUNC_EXIT internal call with function exit tsan builtin. */
|
|
|
|
|
|
|
|
static void
|
2015-09-20 02:52:59 +02:00
|
|
|
replace_func_exit (gimple *stmt)
|
2015-01-05 22:47:51 +01:00
|
|
|
{
|
|
|
|
tree builtin_decl = builtin_decl_implicit (BUILT_IN_TSAN_FUNC_EXIT);
|
2015-09-20 02:52:59 +02:00
|
|
|
gimple *g = gimple_build_call (builtin_decl, 0);
|
2015-01-05 22:47:51 +01:00
|
|
|
gimple_set_location (g, cfun->function_end_locus);
|
|
|
|
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
|
|
|
|
gsi_replace (&gsi, g, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Instrument function exit. Used when TSAN_FUNC_EXIT does not exist. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
instrument_func_exit (void)
|
|
|
|
{
|
|
|
|
location_t loc;
|
|
|
|
basic_block exit_bb;
|
|
|
|
gimple_stmt_iterator gsi;
|
2015-09-20 02:52:59 +02:00
|
|
|
gimple *stmt, *g;
|
2015-01-05 22:47:51 +01:00
|
|
|
tree builtin_decl;
|
|
|
|
edge e;
|
|
|
|
edge_iterator ei;
|
|
|
|
|
|
|
|
/* Find all function exits. */
|
|
|
|
exit_bb = EXIT_BLOCK_PTR_FOR_FN (cfun);
|
|
|
|
FOR_EACH_EDGE (e, ei, exit_bb->preds)
|
|
|
|
{
|
|
|
|
gsi = gsi_last_bb (e->src);
|
|
|
|
stmt = gsi_stmt (gsi);
|
|
|
|
gcc_assert (gimple_code (stmt) == GIMPLE_RETURN
|
|
|
|
|| gimple_call_builtin_p (stmt, BUILT_IN_RETURN));
|
|
|
|
loc = gimple_location (stmt);
|
|
|
|
builtin_decl = builtin_decl_implicit (BUILT_IN_TSAN_FUNC_EXIT);
|
|
|
|
g = gimple_build_call (builtin_decl, 0);
|
|
|
|
gimple_set_location (g, loc);
|
|
|
|
gsi_insert_before (&gsi, g, GSI_SAME_STMT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-22 22:56:58 +01:00
|
|
|
/* Instruments all interesting memory accesses in the current function.
|
2012-11-23 15:28:19 +01:00
|
|
|
Return true if func entry/exit should be instrumented. */
|
2012-11-22 22:56:58 +01:00
|
|
|
|
|
|
|
static bool
|
2017-03-22 19:34:44 +01:00
|
|
|
instrument_memory_accesses (bool *cfg_changed)
|
2012-11-22 22:56:58 +01:00
|
|
|
{
|
|
|
|
basic_block bb;
|
|
|
|
gimple_stmt_iterator gsi;
|
|
|
|
bool fentry_exit_instrument = false;
|
2015-01-05 22:47:51 +01:00
|
|
|
bool func_exit_seen = false;
|
2015-09-20 02:52:59 +02:00
|
|
|
auto_vec<gimple *> tsan_func_exits;
|
2012-11-22 22:56:58 +01:00
|
|
|
|
Eliminate FOR_EACH_BB macro.
gcc/
* basic-block.h (FOR_EACH_BB): Eliminate macro.
* asan.c (transform_statements, execute_sanopt): Eliminate
use of FOR_EACH_BB in favor of FOR_EACH_BB_FN, to make use of cfun
explicit.
* auto-inc-dec.c (rest_of_handle_auto_inc_dec): Likewise.
* bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges,
set_edge_can_fallthru_flag, fix_up_fall_thru_edges,
fix_crossing_unconditional_branches, add_reg_crossing_jump_notes,
insert_section_boundary_note, rest_of_handle_reorder_blocks,
duplicate_computed_gotos): Likewise.
* cfg.c (clear_edges, compact_blocks, brief_dump_cfg): Likewise.
* cfganal.c (find_unreachable_blocks, add_noreturn_fake_exit_edges,
compute_dominance_frontiers_1, single_pred_before_succ_order): Likewise.
* cfgbuild.c (find_many_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_dead_jumptables): Likewise.
* cfgexpand.c (add_scope_conflicts, discover_nonconstant_array_refs):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, get_loop_body, record_loop_exits,
verify_loop_structure): Likewise.
* cfgloopanal.c (mark_loop_exit_edges): Likewise.
* cfgrtl.c (compute_bb_for_insn, find_partition_fixes,
verify_hot_cold_block_grouping, purge_all_dead_edges,
fixup_abnormal_edges, record_effective_endpoints,
outof_cfg_layout_mode, fixup_reorder_chain, force_one_exit_fallthru,
break_superblocks): Likewise.
* cgraphbuild.c (build_cgraph_edges, rebuild_cgraph_edges,
cgraph_rebuild_references): Likewise.
* combine-stack-adj.c (combine_stack_adjustments): Likewise.
* combine.c (delete_noop_moves, create_log_links,
combine_instructions): Likewise.
* config/arm/arm.c (thumb1_reorg, thumb2_reorg): Likewise.
* config/bfin/bfin.c (bfin_gen_bundles, reorder_var_tracking_notes):
Likewise.
* config/c6x/c6x.c (c6x_gen_bundles, conditionalize_after_sched,
c6x_reorg): Likewise.
* config/epiphany/resolve-sw-modes.c (resolve_sw_modes): Likewise.
* config/frv/frv.c (frv_optimize_membar): Likewise.
* config/i386/i386.c (ix86_finalize_stack_realign_flags): Likewise.
* config/ia64/ia64.c (ia64_reorg): Likewise.
* config/mips/mips.c (mips_annotate_pic_calls): Likewise.
* config/picochip/picochip.c (reorder_var_tracking_notes): Likewise.
* config/rs6000/rs6000.c (rs6000_alloc_sdmode_stack_slot): Likewise.
* config/s390/s390.c (s390_regs_ever_clobbered): Likewise.
* config/sh/sh_treg_combine.cc (sh_treg_combine::execute): Likewise.
* config/spu/spu.c (spu_machine_dependent_reorg): Likewise.
* config/tilegx/tilegx.c (tilegx_gen_bundles,
reorder_var_tracking_notes): Likewise.
* config/tilepro/tilepro.c (tilepro_gen_bundles,
reorder_var_tracking_notes): Likewise.
* coverage.c (coverage_compute_cfg_checksum): Likewise.
* cprop.c (compute_hash_table_work, compute_cprop_data,
local_cprop_pass, find_implicit_sets): Likewise.
* cse.c (cse_condition_code_reg): Likewise.
* dce.c (prescan_insns_for_dce): Likewise.
* df-core.c (df_compact_blocks): Likewise.
* df-problems.c (df_word_lr_alloc): Likewise.
* df-scan.c (df_scan_start_dump, df_scan_blocks, df_insn_rescan_all,
df_update_entry_exit_and_calls): Likewise.
* dominance.c (calculate_dominance_info, verify_dominators,
debug_dominance_info): Likewise.
* dse.c (dse_step5_nospill): Likewise.
* except.c (finish_eh_generation): Likewise.
* final.c (compute_alignments): Likewise.
* function.c (thread_prologue_and_epilogue_insns,
rest_of_match_asm_constraints): Likewise.
* gcse.c (compute_hash_table_work, prune_expressions,
compute_pre_data, compute_code_hoist_vbeinout, hoist_code,
calculate_bb_reg_pressure, compute_ld_motion_mems): Likewise.
* gimple-iterator.c (gsi_commit_edge_inserts): Likewise.
* gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour,
find_explicit_erroneous_behaviour): Likewise.
* graphite-sese-to-poly.c (rewrite_reductions_out_of_ssa,
rewrite_cross_bb_scalar_deps_out_of_ssa): Likewise.
* haifa-sched.c (haifa_sched_init): Likewise.
* hw-doloop.c (discover_loops, set_bb_indices, reorder_loops):
Likewise.
* ifcvt.c (if_convert): Likewise.
* init-regs.c (initialize_uninitialized_regs): Likewise.
* ipa-prop.c (ipcp_transform_function): Likewise.
* ipa-pure-const.c (analyze_function): Likewise.
* ipa-split.c (find_split_points, execute_split_functions): Likewise.
* ira-build.c (form_loop_tree): Likewise.
* ira-costs.c (find_costs_and_classes): Likewise.
* ira-emit.c (emit_moves, add_ranges_and_copies, ira_emit): Likewise.
* ira.c (decrease_live_ranges_number, compute_regs_asm_clobbered,
mark_elimination, update_equiv_regs, find_moveable_pseudos,
split_live_ranges_for_shrink_wrap, allocate_initial_values): Likewise.
* jump.c (mark_all_labels): Likewise.
* lcm.c (compute_laterin, compute_insert_delete, compute_available,
compute_nearerout, compute_rev_insert_delete): Likewise.
* loop-init.c (fix_loop_structure): Likewise.
* loop-invariant.c (calculate_loop_reg_pressure): Likewise.
* lower-subreg.c (decompose_multiword_subregs,
decompose_multiword_subregs): Likewise.
* lra-assigns.c (assign_by_spills): Likewise.
* lra-coalesce.c (lra_coalesce): Likewise.
* lra-constraints.c (lra_inheritance, remove_inheritance_pseudos):
Likewise.
* lra-eliminations.c (lra_init_elimination): Likewise.
* lra-spills.c (assign_spill_hard_regs, spill_pseudos,
lra_final_code_change): Likewise.
* lra.c (remove_scratches, check_rtl, has_nonexceptional_receiver,
update_inc_notes): Likewise.
* mcf.c (adjust_cfg_counts): Likewise.
* mode-switching.c (optimize_mode_switching): Likewise.
* modulo-sched.c (rest_of_handle_sms): Likewise.
* omp-low.c (optimize_omp_library_calls, expand_omp_taskreg,
expand_omp_target): Likewise.
* postreload-gcse.c (alloc_mem, compute_hash_table): Likewise.
* postreload.c (reload_cse_regs_1): Likewise.
* predict.c (strip_predict_hints, tree_bb_level_predictions,
tree_estimate_probability, expensive_function_p,
estimate_bb_frequencies, compute_function_frequency): Likewise.
* profile.c (is_inconsistent, compute_branch_probabilities,
branch_prob): Likewise.
* ree.c (find_removable_extensions): Likewise.
* reg-stack.c (compensate_edges, convert_regs, reg_to_stack): Likewise.
* regcprop.c (copyprop_hardreg_forward): Likewise.
* reginfo.c (init_subregs_of_mode): Likewise.
* regrename.c (regrename_analyze): Likewise.
* regstat.c (regstat_compute_ri, regstat_compute_calls_crossed):
Likewise.
* reload1.c (has_nonexceptional_receiver, reload,
calculate_elim_costs_all_insns): Likewise.
* resource.c (init_resource_info, free_resource_info): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, find_single_block_region,
haifa_find_rgns, sched_rgn_local_init): Likewise.
* sel-sched-dump.c (sel_dump_cfg_2): Likewise.
* sel-sched-ir.c (init_lv_sets, free_lv_sets,
make_regions_from_the_rest): Likewise.
* sese.c (build_sese_loop_nests, sese_build_liveouts): Likewise.
* stack-ptr-mod.c (notice_stack_pointer_modification): Likewise.
* store-motion.c (compute_store_table, build_store_vectors,
one_store_motion_pass): Likewise.
* tracer.c (tail_duplicate): Likewise.
* trans-mem.c (compute_transaction_bits): Likewise.
* tree-call-cdce.c (tree_call_cdce): Likewise.
* tree-cfg.c (replace_loop_annotate, factor_computed_gotos,
fold_cond_expr_cond, make_edges, assign_discriminators,
make_abnormal_goto_edges, cleanup_dead_labels, group_case_labels,
dump_cfg_stats, gimple_verify_flow_info, print_loop,
execute_fixup_cfg): Likewise.
* tree-cfgcleanup.c (cleanup_tree_cfg_1, merge_phi_nodes): Likewise.
* tree-complex.c (init_dont_simulate_again, tree_lower_complex):
Likewise.
* tree-dfa.c (collect_dfa_stats, dump_enumerated_decls): Likewise.
* tree-eh.c (execute_lower_resx, execute_lower_eh_dispatch,
mark_reachable_handlers): Likewise.
* tree-emutls.c (lower_emutls_function_body): Likewise.
* tree-if-conv.c (main_tree_if_conversion): Likewise.
* tree-inline.c (optimize_inline_calls): Likewise.
* tree-into-ssa.c (rewrite_into_ssa, update_ssa): Likewise.
* tree-nrv.c (tree_nrv, execute_return_slot_opt): Likewise.
* tree-object-size.c (compute_object_sizes): Likewise.
* tree-outof-ssa.c (eliminate_useless_phis, rewrite_trees,
insert_backedge_copies, tree_profiling): Likewise.
* tree-scalar-evolution.c (scev_const_prop): Likewise.
* tree-sra.c (scan_function, sra_modify_function_body,
propagate_dereference_distances, ipa_sra_modify_function_body,
convert_callers): Likewise.
* tree-ssa-ccp.c (ccp_initialize, execute_fold_all_builtins): Likewise.
* tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise.
create_outofssa_var_map, coalesce_partitions): Likewise.
* tree-ssa-copy.c (init_copy_prop): Likewise.
* tree-ssa-copyrename.c (rename_ssa_copies): Likewise.
* tree-ssa-dce.c (find_obviously_necessary_stmts,
eliminate_unnecessary_stmts): Likewise.
* tree-ssa-dom.c (free_all_edge_infos, tree_ssa_dominator_optimize):
Likewise.
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
* tree-ssa-live.c (clear_unused_block_pointer, remove_unused_locals,
new_tree_live_info, calculate_live_on_exit, dump_live_info,
analyze_memory_references, fill_always_executed_in,
tree_ssa_lim_finalize): Likewise.
* tree-ssa-loop-manip.c (find_uses_to_rename, verify_loop_closed_ssa):
Likewise.
* tree-ssa-math-opts.c (execute_cse_reciprocals, execute_cse_sincos,
execute_optimize_bswap, execute_optimize_widening_mul): Likewise.
* tree-ssa-propagate.c (substitute_and_fold): Likewise.
* tree-ssa-structalias.c (compute_points_to_sets): Likewise.
* tree-ssa-tail-merge.c (find_same_succ, reset_cluster_vectors):
Likewise.
* tree-ssa-ter.c (find_replaceable_exprs): Likewise.
* tree-ssa-threadupdate.c (thread_through_all_blocks): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges,
tree_ssa_uncprop): Likewise.
* tree-ssa-uninit.c (warn_uninitialized_vars,
execute_late_warn_uninitialized): Likewise.
* tree-ssa.c (verify_ssa, execute_update_addresses_taken): Likewise.
* tree-stdarg.c (check_all_va_list_escapes, execute_optimize_stdarg):
Likewise.
* tree-switch-conversion.c (do_switchconv): Likewise.
* tree-vect-generic.c (expand_vector_operations): Likewise.
* tree-vectorizer.c (adjust_simduid_builtins, note_simd_array_uses,
execute_vect_slp): Likewise.
* tree-vrp.c (check_all_array_refs, remove_range_assertions,
vrp_initialize, identify_jump_threads, instrument_memory_accesses):
Likewise.
* ubsan.c (ubsan_pass): Likewise.
* value-prof.c (verify_histograms, gimple_value_profile_transformations,
gimple_find_values_to_profile): Likewise.
* var-tracking.c (vt_find_locations, dump_dataflow_sets, vt_emit_notes,
vt_initialize, delete_debug_insns, vt_finalize): Likewise.
gcc/testsuite/
* g++.dg/plugin/selfassign.c (execute_warn_self_assign): Eliminate
use of FOR_EACH_BB in favor of FOR_EACH_BB_FN, to make use of cfun
explicit.
* gcc.dg/plugin/selfassign.c (execute_warn_self_assign): Likewise.
From-SVN: r205828
2013-12-09 22:06:06 +01:00
|
|
|
FOR_EACH_BB_FN (bb, cfun)
|
2017-03-22 19:34:44 +01:00
|
|
|
{
|
|
|
|
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
|
|
|
|
{
|
|
|
|
gimple *stmt = gsi_stmt (gsi);
|
|
|
|
if (gimple_call_internal_p (stmt, IFN_TSAN_FUNC_EXIT))
|
|
|
|
{
|
|
|
|
if (fentry_exit_instrument)
|
|
|
|
replace_func_exit (stmt);
|
|
|
|
else
|
|
|
|
tsan_func_exits.safe_push (stmt);
|
|
|
|
func_exit_seen = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fentry_exit_instrument |= instrument_gimple (&gsi);
|
|
|
|
}
|
|
|
|
if (gimple_purge_dead_eh_edges (bb))
|
|
|
|
*cfg_changed = true;
|
|
|
|
}
|
2015-01-05 22:47:51 +01:00
|
|
|
unsigned int i;
|
2015-09-20 02:52:59 +02:00
|
|
|
gimple *stmt;
|
2015-01-05 22:47:51 +01:00
|
|
|
FOR_EACH_VEC_ELT (tsan_func_exits, i, stmt)
|
|
|
|
if (fentry_exit_instrument)
|
|
|
|
replace_func_exit (stmt);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gsi = gsi_for_stmt (stmt);
|
|
|
|
gsi_remove (&gsi, true);
|
|
|
|
}
|
|
|
|
if (fentry_exit_instrument && !func_exit_seen)
|
|
|
|
instrument_func_exit ();
|
2012-11-22 22:56:58 +01:00
|
|
|
return fentry_exit_instrument;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Instruments function entry. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
instrument_func_entry (void)
|
|
|
|
{
|
|
|
|
tree ret_addr, builtin_decl;
|
2015-09-20 02:52:59 +02:00
|
|
|
gimple *g;
|
2014-12-15 10:37:47 +01:00
|
|
|
gimple_seq seq = NULL;
|
2012-11-22 22:56:58 +01:00
|
|
|
|
|
|
|
builtin_decl = builtin_decl_implicit (BUILT_IN_RETURN_ADDRESS);
|
|
|
|
g = gimple_build_call (builtin_decl, 1, integer_zero_node);
|
gimple-expr.h (create_tmp_var_raw, [...]): Add default NULL value to last argument.
* gimple-expr.h (create_tmp_var_raw, create_tmp_var,
create_tmp_reg): Add default NULL value to last argument.
* tree-ssanames.h (make_ssa_name, copy_ssa_name): Likewise.
* gimple-low.c (lower_builtin_posix_memalign): Remove NULL
last argument from create_tmp_var_raw, create_tmp_var,
create_tmp_reg, make_ssa_name and copy_ssa_name calls.
* tree-ssa-strlen.c (get_string_length): Likewise.
* tree-emutls.c (gen_emutls_addr, lower_emutls_1): Likewise.
* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
* ipa-prop.c (ipa_modify_call_arguments): Likewise.
* tree-ssa-forwprop.c (simplify_rotate): Likewise.
* tree-ssa-ccp.c (fold_builtin_alloca_with_align): Likewise.
* asan.c (build_shadow_mem_access, maybe_create_ssa_name,
maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
* tsan.c (instrument_expr, instrument_builtin_call,
instrument_func_entry): Likewise.
* varpool.c (add_new_static_var): Likewise.
* tree-loop-distribution.c (generate_memset_builtin): Likewise.
* gimplify.c (internal_get_tmp_var, gimplify_return_expr,
gimplify_modify_expr_to_memcpy, gimplify_modify_expr_to_memset,
gimplify_init_ctor_eval_range, gimplify_init_constructor,
gimplify_omp_atomic, gimplify_expr): Likewise.
* gimple-builder.c (build_assign, build_type_cast): Likewise.
* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1,
slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge,
vect_loop_versioning): Likewise.
* tree-if-conv.c (version_loop_for_if_conversion): Likewise.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.
* tree-vect-patterns.c (vect_handle_widen_op_by_const,
vect_recog_widen_mult_pattern, vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern): Likewise.
* tree-sra.c (build_ref_for_offset, create_access_replacement):
Likewise.
* tree-cfg.c (make_blocks): Likewise.
* tree-eh.c (lower_eh_constructs_2, lower_resx, lower_eh_dispatch):
Likewise.
* tree-ssa-propagate.c (update_call_from_tree): Likewise.
* tree-complex.c (get_component_ssa_name, expand_complex_div_wide):
Likewise.
* tree-ssa-math-opts.c (build_and_insert_cast): Likewise.
* tree-tailcall.c (update_accumulator_with_ops): Likewise.
* tree-predcom.c (initialize_root_vars, initialize_root_vars_lm,
execute_load_motion, reassociate_to_the_same_stmt): Likewise.
* tree-ssa-reassoc.c (build_and_add_sum,
optimize_range_tests_to_bit_test, update_ops,
maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
negate_value, repropagate_negates): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1,
vect_create_epilog_for_reduction): Likewise.
* ipa-split.c (split_function): Likewise.
* tree-inline.c (remap_ssa_name, setup_one_parameter,
declare_return_variable, tree_function_versioning): Likewise.
* tree-cfgcleanup.c (fixup_noreturn_call): Likewise.
* cfgexpand.c (update_alias_info_with_stack_vars, expand_used_vars):
Likewise.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement,
neg_replacement): Likewise.
* gimplify-me.c (force_gimple_operand_1, gimple_regimplify_operands):
Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges,
simplify_float_conversion_using_ranges,
simplify_internal_call_using_ranges): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests,
build_one_array, build_arrays, gen_def_assigns): Likewise.
* gimple-fold.c (gimple_fold_builtin_memory_op,
gimple_fold_builtin_strcat, gimple_fold_call, gimple_build): Likewise.
* tree-vect-generic.c (expand_vector_divmod,
optimize_vector_constructor): Likewise.
* ubsan.c (ubsan_encode_value, ubsan_expand_null_ifn,
ubsan_expand_objsize_ifn, instrument_si_overflow,
instrument_bool_enum_load, instrument_nonnull_arg): Likewise.
* tree-outof-ssa.c (insert_backedge_copies): Likewise.
* tree-ssa-loop-manip.c (create_iv,
tree_transform_and_unroll_loop): Likewise.
* omp-low.c (scan_omp_parallel, lower_rec_simd_input_clauses,
lower_rec_input_clauses, lower_lastprivate_clauses,
expand_parallel_call, expand_omp_for_static_chunk,
expand_omp_atomic_pipeline, expand_omp_target,
maybe_add_implicit_barrier_cancel, lower_omp_single_simple,
lower_omp_critical, lower_omp_for, task_copyfn_copy_decl,
lower_depend_clauses, lower_omp_target, lower_omp_1,
ipa_simd_modify_stmt_ops, simd_clone_adjust): Likewise.
* tree-parloops.c (take_address_of, create_phi_for_local_result,
create_call_for_reduction_1, separate_decls_in_region,
create_parallel_loop): Likewise.
* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_dependence,
handle_scalar_deps_crossing_scop_limits): Likewise.
* trans-mem.c (lower_transaction, build_tm_load, build_tm_store,
expand_assign_tm, expand_call_tm, expand_transaction,
ipa_tm_insert_gettmclone_call): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr, vect_setup_realignment):
Likewise.
* tree-vect-stmts.c (vect_init_vector, vectorizable_mask_load_store,
vectorizable_call, vectorizable_simd_clone_call,
vectorizable_conversion, vectorizable_store, permute_vec_elements,
vectorizable_load): Likewise.
c/
* c-typeck.c (convert_lvalue_to_rvalue, build_atomic_assign,
c_finish_stmt_expr): Remove NULL last argument from
create_tmp_var_raw and create_tmp_var calls.
* c-array-notation.c (fix_builtin_array_notation_fn,
build_array_notation_expr, fix_conditional_array_notations_1,
fix_array_notation_expr, fix_array_notation_call_expr): Likewise.
cp/
* cp-gimplify.c (cxx_omp_clause_apply_fn): Remove NULL last argument
from create_tmp_var calls.
c-family/
* c-common.c (convert_vector_to_pointer_for_subscript): Remove NULL
last argument from create_tmp_var_raw and create_tmp_var calls.
* cilk.c (gimplify_cilk_spawn): Likewise.
* c-omp.c (c_finish_omp_atomic): Likewise.
fortran/
* trans-openmp.c (gfc_omp_finish_clause,
gfc_trans_omp_array_reduction_or_udr, gfc_trans_omp_atomic): Remove
NULL last argument from create_tmp_var_raw and create_tmp_var calls.
From-SVN: r218181
2014-11-29 12:35:30 +01:00
|
|
|
ret_addr = make_ssa_name (ptr_type_node);
|
2012-11-22 22:56:58 +01:00
|
|
|
gimple_call_set_lhs (g, ret_addr);
|
|
|
|
gimple_set_location (g, cfun->function_start_locus);
|
2014-12-15 10:37:47 +01:00
|
|
|
gimple_seq_add_stmt_without_update (&seq, g);
|
2012-11-22 22:56:58 +01:00
|
|
|
|
2014-12-15 10:37:47 +01:00
|
|
|
builtin_decl = builtin_decl_implicit (BUILT_IN_TSAN_FUNC_ENTRY);
|
2012-11-22 22:56:58 +01:00
|
|
|
g = gimple_build_call (builtin_decl, 1, ret_addr);
|
|
|
|
gimple_set_location (g, cfun->function_start_locus);
|
2014-12-15 10:37:47 +01:00
|
|
|
gimple_seq_add_stmt_without_update (&seq, g);
|
|
|
|
|
|
|
|
edge e = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun));
|
|
|
|
gsi_insert_seq_on_edge_immediate (e, seq);
|
2012-11-22 22:56:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ThreadSanitizer instrumentation pass. */
|
|
|
|
|
|
|
|
static unsigned
|
|
|
|
tsan_pass (void)
|
|
|
|
{
|
2012-12-03 18:28:10 +01:00
|
|
|
initialize_sanitizer_builtins ();
|
2017-03-22 19:34:44 +01:00
|
|
|
bool cfg_changed = false;
|
|
|
|
if (instrument_memory_accesses (&cfg_changed))
|
2015-01-05 22:47:51 +01:00
|
|
|
instrument_func_entry ();
|
2017-03-22 19:34:44 +01:00
|
|
|
return cfg_changed ? TODO_cleanup_cfg : 0;
|
2012-11-22 22:56:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Inserts __tsan_init () into the list of CTORs. */
|
|
|
|
|
|
|
|
void
|
|
|
|
tsan_finish_file (void)
|
|
|
|
{
|
2012-12-03 18:28:10 +01:00
|
|
|
tree ctor_statements = NULL_TREE;
|
2012-11-22 22:56:58 +01:00
|
|
|
|
2012-12-03 18:28:10 +01:00
|
|
|
initialize_sanitizer_builtins ();
|
|
|
|
tree init_decl = builtin_decl_implicit (BUILT_IN_TSAN_INIT);
|
2012-11-22 22:56:58 +01:00
|
|
|
append_to_statement_list (build_call_expr (init_decl, 0),
|
|
|
|
&ctor_statements);
|
|
|
|
cgraph_build_static_cdtor ('I', ctor_statements,
|
|
|
|
MAX_RESERVED_INIT_PRIORITY - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The pass descriptor. */
|
|
|
|
|
2013-08-05 22:16:05 +02:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
const pass_data pass_data_tsan =
|
2012-11-22 22:56:58 +01:00
|
|
|
{
|
2013-08-05 22:16:05 +02:00
|
|
|
GIMPLE_PASS, /* type */
|
|
|
|
"tsan", /* name */
|
|
|
|
OPTGROUP_NONE, /* optinfo_flags */
|
|
|
|
TV_NONE, /* tv_id */
|
|
|
|
( PROP_ssa | PROP_cfg ), /* properties_required */
|
|
|
|
0, /* properties_provided */
|
|
|
|
0, /* properties_destroyed */
|
|
|
|
0, /* todo_flags_start */
|
2014-05-06 15:35:40 +02:00
|
|
|
TODO_update_ssa, /* todo_flags_finish */
|
2012-11-22 22:56:58 +01:00
|
|
|
};
|
|
|
|
|
2013-08-05 22:16:05 +02:00
|
|
|
class pass_tsan : public gimple_opt_pass
|
|
|
|
{
|
|
|
|
public:
|
alloc-pool.c, [...]: Add missing whitespace before "(".
gcc/
* alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c,
bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c,
cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c,
cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c,
combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h,
cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c,
df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c,
dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c,
errors.c, except.c, expmed.c, expr.c, file-find.c, final.c,
fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c,
gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c,
genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c,
genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c,
genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c,
gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c,
gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c,
gimple.h, godump.c, graphite-clast-to-gimple.c,
graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c,
graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c,
hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h,
ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c,
ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c,
ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c,
loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c,
lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c,
mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c,
pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c,
predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c,
profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c,
regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c,
reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c,
sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c,
statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h,
system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c,
tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h,
tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c,
tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c,
tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c,
tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c,
tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c,
tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c,
tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c,
tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c,
tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c,
tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c,
tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c,
varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing
whitespace before "(".
From-SVN: r203004
2013-09-28 10:42:34 +02:00
|
|
|
pass_tsan (gcc::context *ctxt)
|
|
|
|
: gimple_opt_pass (pass_data_tsan, ctxt)
|
2013-08-05 22:16:05 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
/* opt_pass methods: */
|
2013-09-30 22:35:40 +02:00
|
|
|
opt_pass * clone () { return new pass_tsan (m_ctxt); }
|
pass current function to opt_pass::gate ()
gcc/
* passes.c (opt_pass::gate): Take function * argument.
(gate_all_early_local_passes): Merge into
(early_local_passes::gate): this.
(gate_all_early_optimizations): Merge into
(all_early_optimizations::gate): this.
(gate_all_optimizations): Mege into
(all_optimizations::gate): this.
(gate_all_optimizations_g): Merge into
(all_optimizations_g::gate): this.
(gate_rest_of_compilation): Mege into
(rest_of_compilation::gate): this.
(gate_postreload): Merge into
(postreload::gate): this.
(dump_one_pass): Pass cfun to the pass's gate method.
(execute_ipa_summary_passes): Likewise.
(execute_one_pass): Likewise.
(ipa_write_summaries_2): Likewise.
(ipa_write_optimization_summaries_1): Likewise.
(ipa_read_summaries_1): Likewise.
(ipa_read_optimization_summaries_1): Likewise.
(execute_ipa_stmt_fixups): Likewise.
* tree-pass.h (opt_pass::gate): Add function * argument.
* asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
combine-stack-adj.c, combine.c, compare-elim.c,
config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
config/rl78/rl78.c, config/sh/sh_optimize_sett_clrt.cc,
config/sh/sh_treg_combine.cc, config/sparc/sparc.c, cprop.c, cse.c,
dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, fwprop.c, gcse.c,
gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c,
graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c,
ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c,
loop-init.c, lower-subreg.c, mode-switching.c, modulo-sched.c,
omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c,
reg-stack.c, regcprop.c, regrename.c, reorg.c, sched-rgn.c,
store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c,
tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c,
tree-nrv.c, tree-parloops.c, tree-predcom.c, tree-profile.c,
tree-sra.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c,
tree-ssa.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tsan.c, ubsan.c,
var-tracking.c, vtable-verify.c, web.c: Adjust.
gcc/testsuite/
* g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfasign.c,
gcc.dg/plugin/one_time_plugin.c, gcc.dg/plugin/selfasign.c: Adjust.
From-SVN: r209481
2014-04-17 14:37:16 +02:00
|
|
|
virtual bool gate (function *)
|
|
|
|
{
|
2015-01-08 19:56:11 +01:00
|
|
|
return ((flag_sanitize & SANITIZE_THREAD) != 0
|
|
|
|
&& !lookup_attribute ("no_sanitize_thread",
|
|
|
|
DECL_ATTRIBUTES (current_function_decl)));
|
pass current function to opt_pass::gate ()
gcc/
* passes.c (opt_pass::gate): Take function * argument.
(gate_all_early_local_passes): Merge into
(early_local_passes::gate): this.
(gate_all_early_optimizations): Merge into
(all_early_optimizations::gate): this.
(gate_all_optimizations): Mege into
(all_optimizations::gate): this.
(gate_all_optimizations_g): Merge into
(all_optimizations_g::gate): this.
(gate_rest_of_compilation): Mege into
(rest_of_compilation::gate): this.
(gate_postreload): Merge into
(postreload::gate): this.
(dump_one_pass): Pass cfun to the pass's gate method.
(execute_ipa_summary_passes): Likewise.
(execute_one_pass): Likewise.
(ipa_write_summaries_2): Likewise.
(ipa_write_optimization_summaries_1): Likewise.
(ipa_read_summaries_1): Likewise.
(ipa_read_optimization_summaries_1): Likewise.
(execute_ipa_stmt_fixups): Likewise.
* tree-pass.h (opt_pass::gate): Add function * argument.
* asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
combine-stack-adj.c, combine.c, compare-elim.c,
config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
config/rl78/rl78.c, config/sh/sh_optimize_sett_clrt.cc,
config/sh/sh_treg_combine.cc, config/sparc/sparc.c, cprop.c, cse.c,
dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, fwprop.c, gcse.c,
gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c,
graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c,
ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c,
loop-init.c, lower-subreg.c, mode-switching.c, modulo-sched.c,
omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c,
reg-stack.c, regcprop.c, regrename.c, reorg.c, sched-rgn.c,
store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c,
tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c,
tree-nrv.c, tree-parloops.c, tree-predcom.c, tree-profile.c,
tree-sra.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c,
tree-ssa.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tsan.c, ubsan.c,
var-tracking.c, vtable-verify.c, web.c: Adjust.
gcc/testsuite/
* g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfasign.c,
gcc.dg/plugin/one_time_plugin.c, gcc.dg/plugin/selfasign.c: Adjust.
From-SVN: r209481
2014-04-17 14:37:16 +02:00
|
|
|
}
|
|
|
|
|
pass cfun to pass::execute
gcc/
* passes.c (opt_pass::execute): Adjust.
(pass_manager::execute_pass_mode_switching): Likewise.
(early_local_passes::execute): Likewise.
(execute_one_pass): Pass cfun to the pass's execute method.
* tree-pass.h (opt_pass::execute): Add function * argument.
* asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c,
cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c,
compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c,
config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c,
config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c,
except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c,
gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c,
graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c,
ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c,
ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c,
lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c,
postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c,
reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c,
store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c,
tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c,
tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c,
tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c,
tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c,
tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c,
tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c,
tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c:
Adjust.
From-SVN: r209482
2014-04-17 14:37:34 +02:00
|
|
|
virtual unsigned int execute (function *) { return tsan_pass (); }
|
2013-08-05 22:16:05 +02:00
|
|
|
|
|
|
|
}; // class pass_tsan
|
|
|
|
|
|
|
|
} // anon namespace
|
|
|
|
|
|
|
|
gimple_opt_pass *
|
|
|
|
make_pass_tsan (gcc::context *ctxt)
|
|
|
|
{
|
|
|
|
return new pass_tsan (ctxt);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
const pass_data pass_data_tsan_O0 =
|
2012-11-22 22:56:58 +01:00
|
|
|
{
|
2013-08-05 22:16:05 +02:00
|
|
|
GIMPLE_PASS, /* type */
|
|
|
|
"tsan0", /* name */
|
|
|
|
OPTGROUP_NONE, /* optinfo_flags */
|
|
|
|
TV_NONE, /* tv_id */
|
|
|
|
( PROP_ssa | PROP_cfg ), /* properties_required */
|
|
|
|
0, /* properties_provided */
|
|
|
|
0, /* properties_destroyed */
|
|
|
|
0, /* todo_flags_start */
|
2014-05-06 15:35:40 +02:00
|
|
|
TODO_update_ssa, /* todo_flags_finish */
|
2012-11-22 22:56:58 +01:00
|
|
|
};
|
2013-08-05 22:16:05 +02:00
|
|
|
|
|
|
|
class pass_tsan_O0 : public gimple_opt_pass
|
|
|
|
{
|
|
|
|
public:
|
alloc-pool.c, [...]: Add missing whitespace before "(".
gcc/
* alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c,
bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c,
cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c,
cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c,
combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h,
cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c,
df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c,
dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c,
errors.c, except.c, expmed.c, expr.c, file-find.c, final.c,
fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c,
gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c,
genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c,
genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c,
genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c,
gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c,
gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c,
gimple.h, godump.c, graphite-clast-to-gimple.c,
graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c,
graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c,
hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h,
ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c,
ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c,
ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c,
loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c,
lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c,
mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c,
pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c,
predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c,
profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c,
regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c,
reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c,
sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c,
statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h,
system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c,
tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h,
tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c,
tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c,
tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c,
tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c,
tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c,
tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c,
tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c,
tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c,
tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c,
tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c,
tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c,
varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing
whitespace before "(".
From-SVN: r203004
2013-09-28 10:42:34 +02:00
|
|
|
pass_tsan_O0 (gcc::context *ctxt)
|
|
|
|
: gimple_opt_pass (pass_data_tsan_O0, ctxt)
|
2013-08-05 22:16:05 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
/* opt_pass methods: */
|
pass current function to opt_pass::gate ()
gcc/
* passes.c (opt_pass::gate): Take function * argument.
(gate_all_early_local_passes): Merge into
(early_local_passes::gate): this.
(gate_all_early_optimizations): Merge into
(all_early_optimizations::gate): this.
(gate_all_optimizations): Mege into
(all_optimizations::gate): this.
(gate_all_optimizations_g): Merge into
(all_optimizations_g::gate): this.
(gate_rest_of_compilation): Mege into
(rest_of_compilation::gate): this.
(gate_postreload): Merge into
(postreload::gate): this.
(dump_one_pass): Pass cfun to the pass's gate method.
(execute_ipa_summary_passes): Likewise.
(execute_one_pass): Likewise.
(ipa_write_summaries_2): Likewise.
(ipa_write_optimization_summaries_1): Likewise.
(ipa_read_summaries_1): Likewise.
(ipa_read_optimization_summaries_1): Likewise.
(execute_ipa_stmt_fixups): Likewise.
* tree-pass.h (opt_pass::gate): Add function * argument.
* asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
combine-stack-adj.c, combine.c, compare-elim.c,
config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
config/rl78/rl78.c, config/sh/sh_optimize_sett_clrt.cc,
config/sh/sh_treg_combine.cc, config/sparc/sparc.c, cprop.c, cse.c,
dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, fwprop.c, gcse.c,
gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c,
graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c,
ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c,
loop-init.c, lower-subreg.c, mode-switching.c, modulo-sched.c,
omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c,
reg-stack.c, regcprop.c, regrename.c, reorg.c, sched-rgn.c,
store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c,
tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c,
tree-nrv.c, tree-parloops.c, tree-predcom.c, tree-profile.c,
tree-sra.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c,
tree-ssa.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tsan.c, ubsan.c,
var-tracking.c, vtable-verify.c, web.c: Adjust.
gcc/testsuite/
* g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfasign.c,
gcc.dg/plugin/one_time_plugin.c, gcc.dg/plugin/selfasign.c: Adjust.
From-SVN: r209481
2014-04-17 14:37:16 +02:00
|
|
|
virtual bool gate (function *)
|
|
|
|
{
|
2015-01-08 19:56:11 +01:00
|
|
|
return ((flag_sanitize & SANITIZE_THREAD) != 0 && !optimize
|
|
|
|
&& !lookup_attribute ("no_sanitize_thread",
|
|
|
|
DECL_ATTRIBUTES (current_function_decl)));
|
pass current function to opt_pass::gate ()
gcc/
* passes.c (opt_pass::gate): Take function * argument.
(gate_all_early_local_passes): Merge into
(early_local_passes::gate): this.
(gate_all_early_optimizations): Merge into
(all_early_optimizations::gate): this.
(gate_all_optimizations): Mege into
(all_optimizations::gate): this.
(gate_all_optimizations_g): Merge into
(all_optimizations_g::gate): this.
(gate_rest_of_compilation): Mege into
(rest_of_compilation::gate): this.
(gate_postreload): Merge into
(postreload::gate): this.
(dump_one_pass): Pass cfun to the pass's gate method.
(execute_ipa_summary_passes): Likewise.
(execute_one_pass): Likewise.
(ipa_write_summaries_2): Likewise.
(ipa_write_optimization_summaries_1): Likewise.
(ipa_read_summaries_1): Likewise.
(ipa_read_optimization_summaries_1): Likewise.
(execute_ipa_stmt_fixups): Likewise.
* tree-pass.h (opt_pass::gate): Add function * argument.
* asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
combine-stack-adj.c, combine.c, compare-elim.c,
config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
config/rl78/rl78.c, config/sh/sh_optimize_sett_clrt.cc,
config/sh/sh_treg_combine.cc, config/sparc/sparc.c, cprop.c, cse.c,
dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, fwprop.c, gcse.c,
gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c,
graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c,
ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c,
loop-init.c, lower-subreg.c, mode-switching.c, modulo-sched.c,
omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c,
reg-stack.c, regcprop.c, regrename.c, reorg.c, sched-rgn.c,
store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c,
tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c,
tree-nrv.c, tree-parloops.c, tree-predcom.c, tree-profile.c,
tree-sra.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c,
tree-ssa.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tsan.c, ubsan.c,
var-tracking.c, vtable-verify.c, web.c: Adjust.
gcc/testsuite/
* g++.dg/plugin/dumb_plugin.c, g++.dg/plugin/selfasign.c,
gcc.dg/plugin/one_time_plugin.c, gcc.dg/plugin/selfasign.c: Adjust.
From-SVN: r209481
2014-04-17 14:37:16 +02:00
|
|
|
}
|
|
|
|
|
pass cfun to pass::execute
gcc/
* passes.c (opt_pass::execute): Adjust.
(pass_manager::execute_pass_mode_switching): Likewise.
(early_local_passes::execute): Likewise.
(execute_one_pass): Pass cfun to the pass's execute method.
* tree-pass.h (opt_pass::execute): Add function * argument.
* asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c,
cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c,
compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c,
config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c,
config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c,
except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c,
gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c,
graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c,
ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c,
ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c,
lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c,
postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c,
reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c,
store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c,
tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c,
tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c,
tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c,
tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c,
tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c,
tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c,
tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c:
Adjust.
From-SVN: r209482
2014-04-17 14:37:34 +02:00
|
|
|
virtual unsigned int execute (function *) { return tsan_pass (); }
|
2013-08-05 22:16:05 +02:00
|
|
|
|
|
|
|
}; // class pass_tsan_O0
|
|
|
|
|
|
|
|
} // anon namespace
|
|
|
|
|
|
|
|
gimple_opt_pass *
|
|
|
|
make_pass_tsan_O0 (gcc::context *ctxt)
|
|
|
|
{
|
|
|
|
return new pass_tsan_O0 (ctxt);
|
|
|
|
}
|