summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-operands.c
diff options
context:
space:
mode:
authorrazya <razya@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-29 11:05:04 +0000
committerrazya <razya@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-29 11:05:04 +0000
commitcb7f680b625e277f171438aa11776154de58bed1 (patch)
tree6b8a35dcec87c3829ed38ac34249604c36916f9c /gcc/tree-ssa-operands.c
parent2adb675d8eb150e3e210753cfb220b4602169c22 (diff)
downloadgcc-cb7f680b625e277f171438aa11776154de58bed1.tar.gz
2007-09-23 Razya Ladelsky
Zdenek Dvorak OMP_ATOMIC Changes, Reduction support for automatic parallelization. * expr.c (expand_expr_real_1): Add cases for OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE. * Makefile.in: Add dependencies to expr.o, tree-parloops.o, omp-low.o * tree-pretty-print.c (dump_generic_node): Add OMP_ATOMIC_LOAD and OMP_ATOMIC_STORE. * tree.h (OMP_DIRECTIVE_P): Add OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE. * gimple-low.c (lower_stmt): Same. * gimplify.c (gimplify_expr): Same. (gimplify_omp_atomic_fetch_op, gimplify_omp_atomic_pipeline, gimplify_omp_atomic_mutex): Remove. (gimplify_omp_atomic): Change it to simply gimplify the statement instead of expanding it. * omp-low.c: Add includes to optabs.h, cfgloop.h. (expand_omp_atomic, expand_omp_atomic_pipeline, goa_stabilize_expr, expand_omp_atomic_mutex, expand_omp_atomic_fetch_op): New functions to implement expansion of OMP_ATOMIC. (expand_omp, build_omp_regions_1): Add support for OMP_ATOMIC_LOAD/OMP_ATOMIC_STORE. * tree-cfg.c (make_edges): add case for OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE. * tree-gimple.c (is_gimple_stmt): Add OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE. * tree-parloops.c: add include to tree-vectorizer.h. (reduction_info): New structure for reduction. (reduction_list): New list to represent list of reductions per loop. (struct data_arg): New helper structure for reduction. (reduction_info_hash, reduction_info_eq, reduction_phi, initialize_reductions, create_call_for_reduction, create_phi_for_local_result, create_call_for_reduction_1, create_loads_for_reductions, create_final_loads_for_reduction): New functions. (loop_parallel_p): Identify reductions, add reduction_list parameter. (separate_decls_in_loop_name): Support reduction variables. (separate_decls_in_loop): Add reduction_list and ld_st_data arguments, call create_loads_for_reduction for each reduction. (canonicalize_loop_ivs): Identify reductions, add reduction_list parameter. (transform_to_exit_first_loop): Add reduction support, add reduction_list parameter. (gen_parallel_loop): Add reduction_list parameter. Add call separate_decls_in_loop with the new argument. Traverse reductions and call initialize_reductions, create_call_for_reduction. (parallelize_loops): Create and delete the reduction list. (add_field_for_name): Change use of data parameter. Add fields for reductions. * tree-vectorizer.h (vect_analyze_loop_form): Add declaration. * tree-vect-analyze.c (vect_analyze_loop_form): export it. * tree.def: Add definitions for OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE. * tree-inline.c (estimate_num_insns_1): add cases for OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE. * tree-cfg.c (make_edges): Add OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE. * tree-ssa-operands.c (get_addr_dereference_operands): New function. Subroutine of get_indirect_ref_operands. (get_indirect_ref_operands): Call get_addr_dereference_operands. (get_expr_operands): Support OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129716 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-operands.c')
-rw-r--r--gcc/tree-ssa-operands.c90
1 files changed, 62 insertions, 28 deletions
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index feeba6ee120..846fbb784eb 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1624,38 +1624,20 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags)
add_virtual_operand (var, s_ann, flags, NULL_TREE, 0, -1, false);
}
-
-/* A subroutine of get_expr_operands to handle INDIRECT_REF,
- ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF.
-
- STMT is the statement being processed, EXPR is the INDIRECT_REF
- that got us here.
-
- FLAGS is as in get_expr_operands.
-
- FULL_REF contains the full pointer dereference expression, if we
- have it, or NULL otherwise.
-
- OFFSET and SIZE are the location of the access inside the
- dereferenced pointer, if known.
-
- RECURSE_ON_BASE should be set to true if we want to continue
- calling get_expr_operands on the base pointer, and false if
- something else will do it for us. */
+/* Subroutine of get_indirect_ref_operands. ADDR is the address
+ that is dereferenced, the meaning of the rest of the arguments
+ is the same as in get_indirect_ref_operands. */
static void
-get_indirect_ref_operands (tree stmt, tree expr, int flags,
- tree full_ref,
- HOST_WIDE_INT offset, HOST_WIDE_INT size,
- bool recurse_on_base)
-{
- tree *pptr = &TREE_OPERAND (expr, 0);
- tree ptr = *pptr;
+get_addr_dereference_operands (tree stmt, tree *addr, int flags,
+ tree full_ref,
+ HOST_WIDE_INT offset, HOST_WIDE_INT size,
+ bool recurse_on_base)
+ {
+ tree ptr = *addr;
stmt_ann_t s_ann = stmt_ann (stmt);
s_ann->references_memory = true;
- if (TREE_THIS_VOLATILE (expr))
- s_ann->has_volatile_ops = true;
if (SSA_VAR_P (ptr))
{
@@ -1725,9 +1707,42 @@ get_indirect_ref_operands (tree stmt, tree expr, int flags,
/* If requested, add a USE operand for the base pointer. */
if (recurse_on_base)
- get_expr_operands (stmt, pptr, opf_use);
+ get_expr_operands (stmt, addr, opf_use);
}
+/* A subroutine of get_expr_operands to handle INDIRECT_REF,
+ ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF.
+
+ STMT is the statement being processed, EXPR is the INDIRECT_REF
+ that got us here.
+
+ FLAGS is as in get_expr_operands.
+
+ FULL_REF contains the full pointer dereference expression, if we
+ have it, or NULL otherwise.
+
+ OFFSET and SIZE are the location of the access inside the
+ dereferenced pointer, if known.
+
+ RECURSE_ON_BASE should be set to true if we want to continue
+ calling get_expr_operands on the base pointer, and false if
+ something else will do it for us. */
+
+static void
+get_indirect_ref_operands (tree stmt, tree expr, int flags,
+ tree full_ref,
+ HOST_WIDE_INT offset, HOST_WIDE_INT size,
+ bool recurse_on_base)
+{
+ tree *pptr = &TREE_OPERAND (expr, 0);
+ stmt_ann_t s_ann = stmt_ann (stmt);
+
+ if (TREE_THIS_VOLATILE (expr))
+ s_ann->has_volatile_ops = true;
+
+ get_addr_dereference_operands (stmt, pptr, flags, full_ref,
+ offset, size, recurse_on_base);
+}
/* A subroutine of get_expr_operands to handle TARGET_MEM_REF. */
@@ -2334,6 +2349,25 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
return;
}
+ case OMP_ATOMIC_LOAD:
+ {
+ tree *addr = &TREE_OPERAND (expr, 1);
+ get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_def);
+
+ if (TREE_CODE (*addr) == ADDR_EXPR)
+ get_expr_operands (stmt, &TREE_OPERAND (*addr, 0), opf_def);
+ else
+ get_addr_dereference_operands (stmt, addr, opf_def,
+ NULL_TREE, 0, -1, true);
+ return;
+ }
+
+ case OMP_ATOMIC_STORE:
+ {
+ get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_use);
+ return;
+ }
+
case BLOCK:
case FUNCTION_DECL:
case EXC_PTR_EXPR: