aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2006-12-05 17:26:05 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2006-12-05 17:26:05 +0000
commit07beea0df36b29ef9acb27111eac0b0e92e181a5 (patch)
tree32d3ee1ddfcad180d619d756a84eeb0df779a6a2 /gcc/fortran
parent3b8aab767b942e122caf583493d7cd858c091cde (diff)
downloadgcc-07beea0df36b29ef9acb27111eac0b0e92e181a5.zip
gcc-07beea0df36b29ef9acb27111eac0b0e92e181a5.tar.gz
gcc-07beea0df36b29ef9acb27111eac0b0e92e181a5.tar.bz2
Merge gimple-tuples-branch into mainline.
From-SVN: r119546
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/f95-lang.c3
-rw-r--r--gcc/fortran/resolve.c13
-rw-r--r--gcc/fortran/trans-array.c14
-rw-r--r--gcc/fortran/trans-array.h6
-rw-r--r--gcc/fortran/trans-openmp.c16
-rw-r--r--gcc/fortran/trans.c11
-rw-r--r--gcc/fortran/trans.h8
7 files changed, 52 insertions, 19 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 52c0b5f..1151318 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -62,7 +62,8 @@ GTY(())
union lang_tree_node
GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
+ chain_next ("(GIMPLE_STMT_P (&%h.generic) ? (union lang_tree_node *) 0 : (union lang_tree_node *)TREE_CHAIN (&%h.generic))")))
+
{
union tree_node GTY((tag ("0"),
desc ("tree_node_structure (&%h)"))) generic;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index e31ecbd..8cbcac93 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -5741,6 +5741,19 @@ resolve_fl_derived (gfc_symbol *sym)
sym->ns->derived_types = dt_list;
}
+ /* Add derived type to the derived type list. */
+ for (dt_list = sym->ns->derived_types; dt_list; dt_list = dt_list->next)
+ if (sym == dt_list->derived)
+ break;
+
+ if (dt_list == NULL)
+ {
+ dt_list = gfc_get_dt_list ();
+ dt_list->next = sym->ns->derived_types;
+ dt_list->derived = sym;
+ sym->ns->derived_types = dt_list;
+ }
+
return SUCCESS;
}
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 991fa1c..0049ad5 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -156,10 +156,18 @@ gfc_conv_descriptor_data_get (tree desc)
return t;
}
-/* This provides WRITE access to the data field. */
+/* This provides WRITE access to the data field.
+
+ TUPLES_P is true if we are generating tuples.
+
+ This function gets called through the following macros:
+ gfc_conv_descriptor_data_set
+ gfc_conv_descriptor_data_set_tuples. */
void
-gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value)
+gfc_conv_descriptor_data_set_internal (stmtblock_t *block,
+ tree desc, tree value,
+ bool tuples_p)
{
tree field, type, t;
@@ -170,7 +178,7 @@ gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value)
gcc_assert (DATA_FIELD == 0);
t = build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE);
- gfc_add_modify_expr (block, t, fold_convert (TREE_TYPE (field), value));
+ gfc_add_modify (block, t, fold_convert (TREE_TYPE (field), value), tuples_p);
}
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 3374c4c..38ad123 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -118,7 +118,11 @@ tree gfc_conv_array_ubound (tree, int);
/* Build expressions for accessing components of an array descriptor. */
tree gfc_conv_descriptor_data_get (tree);
-void gfc_conv_descriptor_data_set (stmtblock_t *, tree, tree);
+void gfc_conv_descriptor_data_set_internal (stmtblock_t *, tree, tree, bool);
+#define gfc_conv_descriptor_data_set(BLOCK, T1, T2) \
+ gfc_conv_descriptor_data_set_internal ((BLOCK), (T1), (T2), false)
+#define gfc_conv_descriptor_data_set_tuples(BLOCK, T1, T2) \
+ gfc_conv_descriptor_data_set_internal ((BLOCK), (T1), (T2), true)
tree gfc_conv_descriptor_data_addr (tree);
tree gfc_conv_descriptor_offset (tree);
tree gfc_conv_descriptor_dtype (tree);
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index fa8be1d..8276316 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -111,7 +111,7 @@ gfc_omp_clause_default_ctor (tree clause ATTRIBUTE_UNUSED, tree decl)
"not currently allocated" allocation status. */
gfc_init_block (&block);
- gfc_conv_descriptor_data_set (&block, decl, null_pointer_node);
+ gfc_conv_descriptor_data_set_tuples (&block, decl, null_pointer_node);
return gfc_finish_block (&block);
}
@@ -832,7 +832,7 @@ gfc_trans_omp_atomic (gfc_code *code)
tree accum = gfc_create_var (TREE_TYPE (rse.expr), NULL);
gfc_actual_arglist *arg;
- gfc_add_modify_expr (&block, accum, rse.expr);
+ gfc_add_modify_stmt (&block, accum, rse.expr);
for (arg = expr2->value.function.actual->next->next; arg;
arg = arg->next)
{
@@ -840,7 +840,7 @@ gfc_trans_omp_atomic (gfc_code *code)
gfc_conv_expr (&rse, arg->expr);
gfc_add_block_to_block (&block, &rse.pre);
x = fold_build2 (op, TREE_TYPE (accum), accum, rse.expr);
- gfc_add_modify_expr (&block, accum, x);
+ gfc_add_modify_stmt (&block, accum, x);
}
rse.expr = accum;
@@ -957,11 +957,11 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
/* Loop body. */
if (simple)
{
- init = build2_v (MODIFY_EXPR, dovar, from);
+ init = build2_v (GIMPLE_MODIFY_STMT, dovar, from);
cond = build2 (simple > 0 ? LE_EXPR : GE_EXPR, boolean_type_node,
dovar, to);
incr = fold_build2 (PLUS_EXPR, type, dovar, step);
- incr = fold_build2 (MODIFY_EXPR, type, dovar, incr);
+ incr = fold_build2 (GIMPLE_MODIFY_STMT, type, dovar, incr);
if (pblock != &block)
{
pushlevel (0);
@@ -983,10 +983,10 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
tmp = fold_build2 (TRUNC_DIV_EXPR, type, tmp, step);
tmp = gfc_evaluate_now (tmp, pblock);
count = gfc_create_var (type, "count");
- init = build2_v (MODIFY_EXPR, count, build_int_cst (type, 0));
+ init = build2_v (GIMPLE_MODIFY_STMT, count, build_int_cst (type, 0));
cond = build2 (LT_EXPR, boolean_type_node, count, tmp);
incr = fold_build2 (PLUS_EXPR, type, count, build_int_cst (type, 1));
- incr = fold_build2 (MODIFY_EXPR, type, count, incr);
+ incr = fold_build2 (GIMPLE_MODIFY_STMT, type, count, incr);
if (pblock != &block)
{
@@ -998,7 +998,7 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
/* Initialize DOVAR. */
tmp = fold_build2 (MULT_EXPR, type, count, step);
tmp = build2 (PLUS_EXPR, type, from, tmp);
- gfc_add_modify_expr (&body, dovar, tmp);
+ gfc_add_modify_stmt (&body, dovar, tmp);
}
if (!dovar_found)
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 69a702e..3040319 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -140,11 +140,13 @@ gfc_evaluate_now (tree expr, stmtblock_t * pblock)
}
-/* Build a MODIFY_EXPR node and add it to a given statement block PBLOCK.
- A MODIFY_EXPR is an assignment: LHS <- RHS. */
+/* Build a MODIFY_EXPR (or GIMPLE_MODIFY_STMT) node and add it to a
+ given statement block PBLOCK. A MODIFY_EXPR is an assignment:
+ LHS <- RHS. */
void
-gfc_add_modify_expr (stmtblock_t * pblock, tree lhs, tree rhs)
+gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs,
+ bool tuples_p)
{
tree tmp;
@@ -157,7 +159,8 @@ gfc_add_modify_expr (stmtblock_t * pblock, tree lhs, tree rhs)
|| AGGREGATE_TYPE_P (TREE_TYPE (lhs)));
#endif
- tmp = fold_build2 (MODIFY_EXPR, void_type_node, lhs, rhs);
+ tmp = fold_build2 (tuples_p ? GIMPLE_MODIFY_STMT : MODIFY_EXPR,
+ void_type_node, lhs, rhs);
gfc_add_expr_to_block (pblock, tmp);
}
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index f471f09..ed96838 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -334,8 +334,12 @@ void gfc_trans_vla_type_sizes (gfc_symbol *, stmtblock_t *);
void gfc_add_expr_to_block (stmtblock_t *, tree);
/* Add a block to the end of a block. */
void gfc_add_block_to_block (stmtblock_t *, stmtblock_t *);
-/* Add a MODIFY_EXPR to a block. */
-void gfc_add_modify_expr (stmtblock_t *, tree, tree);
+/* Add a MODIFY_EXPR or a GIMPLE_MODIFY_STMT to a block. */
+void gfc_add_modify (stmtblock_t *, tree, tree, bool);
+#define gfc_add_modify_expr(BLOCK, LHS, RHS) \
+ gfc_add_modify ((BLOCK), (LHS), (RHS), false)
+#define gfc_add_modify_stmt(BLOCK, LHS, RHS) \
+ gfc_add_modify ((BLOCK), (LHS), (RHS), true)
/* Initialize a statement block. */
void gfc_init_block (stmtblock_t *);