Mercurial > hg > CbC > CbC_gcc
diff gcc/gimplify.c @ 70:b81903832de2
merge c-decl.c
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 21 Aug 2011 09:24:16 +0900 |
parents | 1b10fe6932e1 |
children | ce75bd9117e4 |
line wrap: on
line diff
--- a/gcc/gimplify.c Sun Aug 21 07:53:12 2011 +0900 +++ b/gcc/gimplify.c Sun Aug 21 09:24:16 2011 +0900 @@ -45,10 +45,6 @@ #include "splay-tree.h" #include "vec.h" #include "gimple.h" -#ifndef noCbC -#include "cbc-tree.h" -#endif - #include "tree-pass.h" #include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name. */ @@ -68,7 +64,7 @@ GOVD_DEBUG_PRIVATE = 256, GOVD_PRIVATE_OUTER_REF = 512, GOVD_DATA_SHARE_CLASS = (GOVD_SHARED | GOVD_PRIVATE | GOVD_FIRSTPRIVATE - | GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LOCAL) + | GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LOCAL) }; @@ -223,7 +219,7 @@ struct gimplify_ctx *c = gimplify_ctxp; gcc_assert (c && (c->bind_expr_stack == NULL - || VEC_empty (gimple, c->bind_expr_stack))); + || VEC_empty (gimple, c->bind_expr_stack))); VEC_free (gimple, heap, c->bind_expr_stack); gimplify_ctxp = c->prev_context; @@ -389,10 +385,10 @@ for (i = 2; i < 8 && len > i; i++) { if (name[len - i] == '.') - { - name[len - i] = '\0'; - break; - } + { + name[len - i] = '\0'; + break; + } } } @@ -432,8 +428,8 @@ TYPE_ATTRIBUTES (new_type) = TYPE_ATTRIBUTES (type); tmp_var = build_decl (input_location, - VAR_DECL, prefix ? create_tmp_var_name (prefix) : NULL, - type); + VAR_DECL, prefix ? create_tmp_var_name (prefix) : NULL, + type); /* The variable was declared by the compiler. */ DECL_ARTIFICIAL (tmp_var) = 1; @@ -522,20 +518,20 @@ elt.val = val; if (gimplify_ctxp->temp_htab == NULL) gimplify_ctxp->temp_htab - = htab_create (1000, gimple_tree_hash, gimple_tree_eq, free); + = htab_create (1000, gimple_tree_hash, gimple_tree_eq, free); slot = htab_find_slot (gimplify_ctxp->temp_htab, (void *)&elt, INSERT); if (*slot == NULL) - { - elt_p = XNEW (elt_t); - elt_p->val = val; - elt_p->temp = ret = create_tmp_from_val (val); - *slot = (void *) elt_p; - } + { + elt_p = XNEW (elt_t); + elt_p->val = val; + elt_p->temp = ret = create_tmp_from_val (val); + *slot = (void *) elt_p; + } else - { - elt_p = (elt_t *) *slot; + { + elt_p = (elt_t *) *slot; ret = elt_p->temp; - } + } } return ret; @@ -551,7 +547,7 @@ is_gimple_reg_rhs_or_call (tree t) { return (get_gimple_rhs_class (TREE_CODE (t)) != GIMPLE_INVALID_RHS - || TREE_CODE (t) == CALL_EXPR); + || TREE_CODE (t) == CALL_EXPR); } /* Return true if T is a valid memory RHS or a CALL_EXPR. Note that @@ -567,7 +563,7 @@ return is_gimple_val (t); else return (is_gimple_val (t) || is_gimple_lvalue (t) - || TREE_CODE (t) == CALL_EXPR); + || TREE_CODE (t) == CALL_EXPR); } /* Helper for get_formal_tmp_var and get_initialized_tmp_var. */ @@ -581,13 +577,13 @@ /* Notice that we explicitly allow VAL to be a CALL_EXPR so that we can create an INIT_EXPR and convert it into a GIMPLE_CALL below. */ gimplify_expr (&val, pre_p, post_p, is_gimple_reg_rhs_or_call, - fb_rvalue); + fb_rvalue); t = lookup_tmp_var (val, is_formal); if (is_formal && (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)) + || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)) DECL_GIMPLE_REG_P (t) = 1; mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val)); @@ -659,20 +655,20 @@ gimple_bind_set_vars (scope, temps); } else - { - /* We need to attach the nodes both to the BIND_EXPR and to its - associated BLOCK for debugging purposes. The key point here - is that the BLOCK_VARS of the BIND_EXPR_BLOCK of a BIND_EXPR - is a subchain of the BIND_EXPR_VARS of the BIND_EXPR. */ - if (BLOCK_VARS (block)) - BLOCK_VARS (block) = chainon (BLOCK_VARS (block), temps); - else - { - gimple_bind_set_vars (scope, - chainon (gimple_bind_vars (scope), temps)); - BLOCK_VARS (block) = temps; - } - } + { + /* We need to attach the nodes both to the BIND_EXPR and to its + associated BLOCK for debugging purposes. The key point here + is that the BLOCK_VARS of the BIND_EXPR_BLOCK of a BIND_EXPR + is a subchain of the BIND_EXPR_VARS of the BIND_EXPR. */ + if (BLOCK_VARS (block)) + BLOCK_VARS (block) = chainon (BLOCK_VARS (block), temps); + else + { + gimple_bind_set_vars (scope, + chainon (gimple_bind_vars (scope), temps)); + BLOCK_VARS (block) = temps; + } + } } } @@ -721,13 +717,13 @@ /* Mark temporaries local within the nearest enclosing parallel. */ if (gimplify_omp_ctxp) - { - struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp; - while (ctx && ctx->region_type == ORT_WORKSHARE) - ctx = ctx->outer_context; - if (ctx) - omp_add_variable (ctx, tmp, GOVD_LOCAL | GOVD_SEEN); - } + { + struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp; + while (ctx && ctx->region_type == ORT_WORKSHARE) + ctx = ctx->outer_context; + if (ctx) + omp_add_variable (ctx, tmp, GOVD_LOCAL | GOVD_SEEN); + } } else if (cfun) record_vars (tmp); @@ -736,7 +732,7 @@ gimple_seq body_seq; /* This case is for nested functions. We need to expose the locals - they create. */ + they create. */ body_seq = gimple_body (current_function_decl); declare_vars (tmp, gimple_seq_first_stmt (body_seq), false); } @@ -795,7 +791,7 @@ static void annotate_all_with_location_after (gimple_seq seq, gimple_stmt_iterator gsi, - location_t location) + location_t location) { if (gsi_end_p (gsi)) gsi = gsi_start (seq); @@ -922,9 +918,9 @@ || TREE_CODE_CLASS (code) == tcc_constant) { if (TREE_VISITED (t)) - *walk_subtrees = 0; + *walk_subtrees = 0; else - TREE_VISITED (t) = 1; + TREE_VISITED (t) = 1; } /* If this node has been visited already, unshare it and don't look @@ -1038,66 +1034,66 @@ tree *p; /* Set p to point to the body of the wrapper. Loop until we find - something that isn't a wrapper. */ + something that isn't a wrapper. */ for (p = &wrapper; p && *p; ) - { - switch (TREE_CODE (*p)) - { - case BIND_EXPR: - TREE_SIDE_EFFECTS (*p) = 1; - TREE_TYPE (*p) = void_type_node; - /* For a BIND_EXPR, the body is operand 1. */ - p = &BIND_EXPR_BODY (*p); - break; - - case CLEANUP_POINT_EXPR: - case TRY_FINALLY_EXPR: - case TRY_CATCH_EXPR: - TREE_SIDE_EFFECTS (*p) = 1; - TREE_TYPE (*p) = void_type_node; - p = &TREE_OPERAND (*p, 0); - break; - - case STATEMENT_LIST: - { - tree_stmt_iterator i = tsi_last (*p); - TREE_SIDE_EFFECTS (*p) = 1; - TREE_TYPE (*p) = void_type_node; - p = tsi_end_p (i) ? NULL : tsi_stmt_ptr (i); - } - break; - - case COMPOUND_EXPR: - /* Advance to the last statement. Set all container types to void. */ - for (; TREE_CODE (*p) == COMPOUND_EXPR; p = &TREE_OPERAND (*p, 1)) - { - TREE_SIDE_EFFECTS (*p) = 1; - TREE_TYPE (*p) = void_type_node; - } - break; - - default: - goto out; - } - } + { + switch (TREE_CODE (*p)) + { + case BIND_EXPR: + TREE_SIDE_EFFECTS (*p) = 1; + TREE_TYPE (*p) = void_type_node; + /* For a BIND_EXPR, the body is operand 1. */ + p = &BIND_EXPR_BODY (*p); + break; + + case CLEANUP_POINT_EXPR: + case TRY_FINALLY_EXPR: + case TRY_CATCH_EXPR: + TREE_SIDE_EFFECTS (*p) = 1; + TREE_TYPE (*p) = void_type_node; + p = &TREE_OPERAND (*p, 0); + break; + + case STATEMENT_LIST: + { + tree_stmt_iterator i = tsi_last (*p); + TREE_SIDE_EFFECTS (*p) = 1; + TREE_TYPE (*p) = void_type_node; + p = tsi_end_p (i) ? NULL : tsi_stmt_ptr (i); + } + break; + + case COMPOUND_EXPR: + /* Advance to the last statement. Set all container types to void. */ + for (; TREE_CODE (*p) == COMPOUND_EXPR; p = &TREE_OPERAND (*p, 1)) + { + TREE_SIDE_EFFECTS (*p) = 1; + TREE_TYPE (*p) = void_type_node; + } + break; + + default: + goto out; + } + } out: if (p == NULL || IS_EMPTY_STMT (*p)) - temp = NULL_TREE; + temp = NULL_TREE; else if (temp) - { - /* The wrapper is on the RHS of an assignment that we're pushing - down. */ - gcc_assert (TREE_CODE (temp) == INIT_EXPR - || TREE_CODE (temp) == MODIFY_EXPR); - TREE_OPERAND (temp, 1) = *p; - *p = temp; - } + { + /* The wrapper is on the RHS of an assignment that we're pushing + down. */ + gcc_assert (TREE_CODE (temp) == INIT_EXPR + || TREE_CODE (temp) == MODIFY_EXPR); + TREE_OPERAND (temp, 1) = *p; + *p = temp; + } else - { - temp = create_tmp_var (type, "retval"); - *p = build2 (INIT_EXPR, type, temp, *p); - } + { + temp = create_tmp_var (type, "retval"); + *p = build2 (INIT_EXPR, type, temp, *p); + } return temp; } @@ -1118,7 +1114,7 @@ gimple_call_set_lhs (*save, tmp_var); *restore = gimple_build_call (implicit_built_in_decls[BUILT_IN_STACK_RESTORE], - 1, tmp_var); + 1, tmp_var); } /* Gimplify a BIND_EXPR. Just voidify and recurse. */ @@ -1138,21 +1134,21 @@ for (t = BIND_EXPR_VARS (bind_expr); t ; t = DECL_CHAIN (t)) { if (TREE_CODE (t) == VAR_DECL) - { - struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp; - - /* Mark variable as local. */ - if (ctx && !is_global_var (t) - && (! DECL_SEEN_IN_BIND_EXPR_P (t) - || splay_tree_lookup (ctx->variables, - (splay_tree_key) t) == NULL)) - omp_add_variable (gimplify_omp_ctxp, t, GOVD_LOCAL | GOVD_SEEN); - - DECL_SEEN_IN_BIND_EXPR_P (t) = 1; - - if (DECL_HARD_REGISTER (t) && !is_global_var (t) && cfun) - cfun->has_local_explicit_reg_vars = true; - } + { + struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp; + + /* Mark variable as local. */ + if (ctx && !is_global_var (t) + && (! DECL_SEEN_IN_BIND_EXPR_P (t) + || splay_tree_lookup (ctx->variables, + (splay_tree_key) t) == NULL)) + omp_add_variable (gimplify_omp_ctxp, t, GOVD_LOCAL | GOVD_SEEN); + + DECL_SEEN_IN_BIND_EXPR_P (t) = 1; + + if (DECL_HARD_REGISTER (t) && !is_global_var (t) && cfun) + cfun->has_local_explicit_reg_vars = true; + } /* Preliminarily mark non-addressed complex variables as eligible for promotion to gimple registers. We'll transform their uses @@ -1182,14 +1178,14 @@ gimple_seq cleanup, new_body; /* Save stack on entry and restore it on exit. Add a try_finally - block to achieve this. Note that mudflap depends on the - format of the emitted code: see mx_register_decls(). */ + block to achieve this. Note that mudflap depends on the + format of the emitted code: see mx_register_decls(). */ build_stack_save_restore (&stack_save, &stack_restore); cleanup = new_body = NULL; gimplify_seq_add_stmt (&cleanup, stack_restore); gs = gimple_build_try (gimple_bind_body (gimple_bind), cleanup, - GIMPLE_TRY_FINALLY); + GIMPLE_TRY_FINALLY); gimplify_seq_add_stmt (&new_body, stack_save); gimplify_seq_add_stmt (&new_body, gs); @@ -1238,16 +1234,7 @@ return GS_ALL_DONE; } - if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))) -#ifndef noCbC - || ( ret_expr - && TREE_CODE(ret_expr)==CALL_EXPR - && CbC_IS_CbC_GOTO(ret_expr) - //&& !CbC_IS_CODE_SEGMENT(TREE_TYPE(current_function_decl))) - && !(current_function_decl&&CbC_IS_CODE_SEGMENT(TREE_TYPE(current_function_decl)))) - //&& !(current_function_decl&&CbC_IS_CODE_SEGMENT(current_function_decl))) -#endif - ) + if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))) result_decl = NULL_TREE; else { @@ -1255,11 +1242,11 @@ /* See through a return by reference. */ if (TREE_CODE (result_decl) == INDIRECT_REF) - result_decl = TREE_OPERAND (result_decl, 0); + result_decl = TREE_OPERAND (result_decl, 0); gcc_assert ((TREE_CODE (ret_expr) == MODIFY_EXPR - || TREE_CODE (ret_expr) == INIT_EXPR) - && TREE_CODE (result_decl) == RESULT_DECL); + || TREE_CODE (ret_expr) == INIT_EXPR) + && TREE_CODE (result_decl) == RESULT_DECL); } /* If aggregate_value_p is true, then we can return the bare RESULT_DECL. @@ -1293,9 +1280,9 @@ result = create_tmp_reg (TREE_TYPE (result_decl), NULL); /* ??? With complex control flow (usually involving abnormal edges), - we can wind up warning about an uninitialized value for this. Due - to how this variable is constructed and initialized, this is never - true. Give up and never warn. */ + we can wind up warning about an uninitialized value for this. Due + to how this variable is constructed and initialized, this is never + true. Give up and never warn. */ TREE_NO_WARNING (result) = 1; gimplify_ctxp->return_temp = result; @@ -1377,11 +1364,11 @@ tree init = DECL_INITIAL (decl); if (TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST - || (!TREE_STATIC (decl) - && flag_stack_check == GENERIC_STACK_CHECK - && compare_tree_int (DECL_SIZE_UNIT (decl), - STACK_CHECK_MAX_VAR_SIZE) > 0)) - gimplify_vla_decl (decl, seq_p); + || (!TREE_STATIC (decl) + && flag_stack_check == GENERIC_STACK_CHECK + && compare_tree_int (DECL_SIZE_UNIT (decl), + STACK_CHECK_MAX_VAR_SIZE) > 0)) + gimplify_vla_decl (decl, seq_p); /* Some front ends do not explicitly declare all anonymous artificial variables. We compensate here by declaring the @@ -1515,7 +1502,7 @@ gimple gimple_switch; /* If someone can be bothered to fill in the labels, they can - be bothered to null out the body too. */ + be bothered to null out the body too. */ gcc_assert (!SWITCH_LABELS (switch_expr)); /* save old labels, get new ones from body, then restore the old @@ -1529,91 +1516,91 @@ i = 0; while (i < VEC_length (tree, labels)) - { - tree elt = VEC_index (tree, labels, i); - tree low = CASE_LOW (elt); - bool remove_element = FALSE; - - if (low) - { - /* Discard empty ranges. */ - tree high = CASE_HIGH (elt); - if (high && tree_int_cst_lt (high, low)) - remove_element = TRUE; - } - else - { - /* The default case must be the last label in the list. */ - gcc_assert (!default_case); - default_case = elt; - remove_element = TRUE; - } - - if (remove_element) - VEC_ordered_remove (tree, labels, i); - else - i++; - } + { + tree elt = VEC_index (tree, labels, i); + tree low = CASE_LOW (elt); + bool remove_element = FALSE; + + if (low) + { + /* Discard empty ranges. */ + tree high = CASE_HIGH (elt); + if (high && tree_int_cst_lt (high, low)) + remove_element = TRUE; + } + else + { + /* The default case must be the last label in the list. */ + gcc_assert (!default_case); + default_case = elt; + remove_element = TRUE; + } + + if (remove_element) + VEC_ordered_remove (tree, labels, i); + else + i++; + } len = i; if (!VEC_empty (tree, labels)) - sort_case_labels (labels); + sort_case_labels (labels); if (!default_case) - { - tree type = TREE_TYPE (switch_expr); - - /* If the switch has no default label, add one, so that we jump - around the switch body. If the labels already cover the whole - range of type, add the default label pointing to one of the - existing labels. */ - if (type == void_type_node) - type = TREE_TYPE (SWITCH_COND (switch_expr)); - if (len - && INTEGRAL_TYPE_P (type) - && TYPE_MIN_VALUE (type) - && TYPE_MAX_VALUE (type) - && tree_int_cst_equal (CASE_LOW (VEC_index (tree, labels, 0)), - TYPE_MIN_VALUE (type))) - { - tree low, high = CASE_HIGH (VEC_index (tree, labels, len - 1)); - if (!high) - high = CASE_LOW (VEC_index (tree, labels, len - 1)); - if (tree_int_cst_equal (high, TYPE_MAX_VALUE (type))) - { - for (i = 1; i < len; i++) - { - high = CASE_LOW (VEC_index (tree, labels, i)); - low = CASE_HIGH (VEC_index (tree, labels, i - 1)); - if (!low) - low = CASE_LOW (VEC_index (tree, labels, i - 1)); - if ((TREE_INT_CST_LOW (low) + 1 - != TREE_INT_CST_LOW (high)) - || (TREE_INT_CST_HIGH (low) - + (TREE_INT_CST_LOW (high) == 0) - != TREE_INT_CST_HIGH (high))) - break; - } - if (i == len) - default_case = build3 (CASE_LABEL_EXPR, void_type_node, - NULL_TREE, NULL_TREE, - CASE_LABEL (VEC_index (tree, - labels, 0))); - } - } - - if (!default_case) - { - gimple new_default; - - default_case - = build3 (CASE_LABEL_EXPR, void_type_node, - NULL_TREE, NULL_TREE, - create_artificial_label (UNKNOWN_LOCATION)); - new_default = gimple_build_label (CASE_LABEL (default_case)); - gimplify_seq_add_stmt (&switch_body_seq, new_default); - } - } + { + tree type = TREE_TYPE (switch_expr); + + /* If the switch has no default label, add one, so that we jump + around the switch body. If the labels already cover the whole + range of type, add the default label pointing to one of the + existing labels. */ + if (type == void_type_node) + type = TREE_TYPE (SWITCH_COND (switch_expr)); + if (len + && INTEGRAL_TYPE_P (type) + && TYPE_MIN_VALUE (type) + && TYPE_MAX_VALUE (type) + && tree_int_cst_equal (CASE_LOW (VEC_index (tree, labels, 0)), + TYPE_MIN_VALUE (type))) + { + tree low, high = CASE_HIGH (VEC_index (tree, labels, len - 1)); + if (!high) + high = CASE_LOW (VEC_index (tree, labels, len - 1)); + if (tree_int_cst_equal (high, TYPE_MAX_VALUE (type))) + { + for (i = 1; i < len; i++) + { + high = CASE_LOW (VEC_index (tree, labels, i)); + low = CASE_HIGH (VEC_index (tree, labels, i - 1)); + if (!low) + low = CASE_LOW (VEC_index (tree, labels, i - 1)); + if ((TREE_INT_CST_LOW (low) + 1 + != TREE_INT_CST_LOW (high)) + || (TREE_INT_CST_HIGH (low) + + (TREE_INT_CST_LOW (high) == 0) + != TREE_INT_CST_HIGH (high))) + break; + } + if (i == len) + default_case = build3 (CASE_LABEL_EXPR, void_type_node, + NULL_TREE, NULL_TREE, + CASE_LABEL (VEC_index (tree, + labels, 0))); + } + } + + if (!default_case) + { + gimple new_default; + + default_case + = build3 (CASE_LABEL_EXPR, void_type_node, + NULL_TREE, NULL_TREE, + create_artificial_label (UNKNOWN_LOCATION)); + new_default = gimple_build_label (CASE_LABEL (default_case)); + gimplify_seq_add_stmt (&switch_body_seq, new_default); + } + } gimple_switch = gimple_build_switch_vec (SWITCH_COND (switch_expr), default_case, labels); @@ -1732,18 +1719,18 @@ int type_quals; /* We need to preserve qualifiers and propagate them from - operand 0. */ + operand 0. */ type_quals = TYPE_QUALS (type) - | TYPE_QUALS (TREE_TYPE (TREE_OPERAND (expr, 0))); + | TYPE_QUALS (TREE_TYPE (TREE_OPERAND (expr, 0))); if (TYPE_QUALS (type) != type_quals) - type = build_qualified_type (TYPE_MAIN_VARIANT (type), type_quals); + type = build_qualified_type (TYPE_MAIN_VARIANT (type), type_quals); /* Set the type of the COMPONENT_REF to the underlying type. */ TREE_TYPE (expr) = type; #ifdef ENABLE_TYPES_CHECKING /* It is now a FE error, if the conversion from the canonical - type to the original expression type is not useless. */ + type to the original expression type is not useless. */ gcc_assert (useless_type_conversion_p (old_type, type)); #endif } @@ -1782,7 +1769,7 @@ ddatype = TREE_TYPE (datype); pddatype = build_pointer_type (ddatype); if (!useless_type_conversion_p (TYPE_MAIN_VARIANT (TREE_TYPE (expr)), - pddatype)) + pddatype)) return; /* The lower bound and element sizes must be constant. */ @@ -1794,8 +1781,8 @@ /* All checks succeeded. Build a new node to merge the cast. */ *expr_p = build4 (ARRAY_REF, ddatype, TREE_OPERAND (addr_expr, 0), - TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), - NULL_TREE, NULL_TREE); + TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), + NULL_TREE, NULL_TREE); *expr_p = build1 (ADDR_EXPR, pddatype, *expr_p); /* We can have stripped a required restrict qualifier above. */ @@ -1827,8 +1814,8 @@ && POINTER_TYPE_P (TREE_TYPE (*expr_p)) && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (*expr_p, 0))) && (tem = maybe_fold_offset_to_address - (EXPR_LOCATION (*expr_p), TREE_OPERAND (*expr_p, 0), - integer_zero_node, TREE_TYPE (*expr_p))) != NULL_TREE) + (EXPR_LOCATION (*expr_p), TREE_OPERAND (*expr_p, 0), + integer_zero_node, TREE_TYPE (*expr_p))) != NULL_TREE) *expr_p = tem; /* If we still have a conversion at the toplevel, @@ -1838,22 +1825,22 @@ tree sub = TREE_OPERAND (*expr_p, 0); /* If a NOP conversion is changing the type of a COMPONENT_REF - expression, then canonicalize its type now in order to expose more - redundant conversions. */ + expression, then canonicalize its type now in order to expose more + redundant conversions. */ if (TREE_CODE (sub) == COMPONENT_REF) - canonicalize_component_ref (&TREE_OPERAND (*expr_p, 0)); + canonicalize_component_ref (&TREE_OPERAND (*expr_p, 0)); /* If a NOP conversion is changing a pointer to array of foo - to a pointer to foo, embed that change in the ADDR_EXPR. */ + to a pointer to foo, embed that change in the ADDR_EXPR. */ else if (TREE_CODE (sub) == ADDR_EXPR) - canonicalize_addr_expr (expr_p); + canonicalize_addr_expr (expr_p); } /* If we have a conversion to a non-register type force the use of a VIEW_CONVERT_EXPR instead. */ if (CONVERT_EXPR_P (*expr_p) && !is_gimple_reg_type (TREE_TYPE (*expr_p))) *expr_p = fold_build1_loc (loc, VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p), - TREE_OPERAND (*expr_p, 0)); + TREE_OPERAND (*expr_p, 0)); return GS_OK; } @@ -1894,7 +1881,7 @@ tree value_expr = DECL_VALUE_EXPR (decl); /* For referenced nonlocal VLAs add a decl for debugging purposes - to the current function. */ + to the current function. */ if (TREE_CODE (decl) == VAR_DECL && TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST && nonlocal_vlas != NULL @@ -1932,10 +1919,10 @@ node *EXPR_P. compound_lval - : min_lval '[' val ']' - | min_lval '.' ID - | compound_lval '[' val ']' - | compound_lval '.' ID + : min_lval '[' val ']' + | min_lval '.' ID + | compound_lval '[' val ']' + | compound_lval '.' ID This is not part of the original SIMPLE definition, which separates array and member references, but it seems reasonable to handle them @@ -1952,7 +1939,7 @@ static enum gimplify_status gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, - fallback_t fallback) + fallback_t fallback) { tree *p; VEC(tree,heap) *stack; @@ -1971,17 +1958,17 @@ restart: /* Fold INDIRECT_REFs now to turn them into ARRAY_REFs. */ if (TREE_CODE (*p) == INDIRECT_REF) - *p = fold_indirect_ref_loc (loc, *p); + *p = fold_indirect_ref_loc (loc, *p); if (handled_component_p (*p)) - ; + ; /* Expand DECL_VALUE_EXPR now. In some cases that may expose - additional COMPONENT_REFs. */ + additional COMPONENT_REFs. */ else if ((TREE_CODE (*p) == VAR_DECL || TREE_CODE (*p) == PARM_DECL) - && gimplify_var_or_parm_decl (p) == GS_OK) - goto restart; + && gimplify_var_or_parm_decl (p) == GS_OK) + goto restart; else - break; + break; VEC_safe_push (tree, heap, stack, *p); } @@ -2005,73 +1992,73 @@ tree t = VEC_index (tree, stack, i); if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF) - { - /* Gimplify the low bound and element type size and put them into - the ARRAY_REF. If these values are set, they have already been - gimplified. */ - if (TREE_OPERAND (t, 2) == NULL_TREE) - { - tree low = unshare_expr (array_ref_low_bound (t)); - if (!is_gimple_min_invariant (low)) - { - TREE_OPERAND (t, 2) = low; - tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, - post_p, is_gimple_reg, - fb_rvalue); - ret = MIN (ret, tret); - } - } - - if (!TREE_OPERAND (t, 3)) - { - tree elmt_type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0))); - tree elmt_size = unshare_expr (array_ref_element_size (t)); - tree factor = size_int (TYPE_ALIGN_UNIT (elmt_type)); - - /* Divide the element size by the alignment of the element - type (above). */ - elmt_size = size_binop_loc (loc, EXACT_DIV_EXPR, elmt_size, factor); - - if (!is_gimple_min_invariant (elmt_size)) - { - TREE_OPERAND (t, 3) = elmt_size; - tret = gimplify_expr (&TREE_OPERAND (t, 3), pre_p, - post_p, is_gimple_reg, - fb_rvalue); - ret = MIN (ret, tret); - } - } - } + { + /* Gimplify the low bound and element type size and put them into + the ARRAY_REF. If these values are set, they have already been + gimplified. */ + if (TREE_OPERAND (t, 2) == NULL_TREE) + { + tree low = unshare_expr (array_ref_low_bound (t)); + if (!is_gimple_min_invariant (low)) + { + TREE_OPERAND (t, 2) = low; + tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, + post_p, is_gimple_reg, + fb_rvalue); + ret = MIN (ret, tret); + } + } + + if (!TREE_OPERAND (t, 3)) + { + tree elmt_type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0))); + tree elmt_size = unshare_expr (array_ref_element_size (t)); + tree factor = size_int (TYPE_ALIGN_UNIT (elmt_type)); + + /* Divide the element size by the alignment of the element + type (above). */ + elmt_size = size_binop_loc (loc, EXACT_DIV_EXPR, elmt_size, factor); + + if (!is_gimple_min_invariant (elmt_size)) + { + TREE_OPERAND (t, 3) = elmt_size; + tret = gimplify_expr (&TREE_OPERAND (t, 3), pre_p, + post_p, is_gimple_reg, + fb_rvalue); + ret = MIN (ret, tret); + } + } + } else if (TREE_CODE (t) == COMPONENT_REF) - { - /* Set the field offset into T and gimplify it. */ - if (!TREE_OPERAND (t, 2)) - { - tree offset = unshare_expr (component_ref_field_offset (t)); - tree field = TREE_OPERAND (t, 1); - tree factor - = size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT); - - /* Divide the offset by its alignment. */ - offset = size_binop_loc (loc, EXACT_DIV_EXPR, offset, factor); - - if (!is_gimple_min_invariant (offset)) - { - TREE_OPERAND (t, 2) = offset; - tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, - post_p, is_gimple_reg, - fb_rvalue); - ret = MIN (ret, tret); - } - } - } + { + /* Set the field offset into T and gimplify it. */ + if (!TREE_OPERAND (t, 2)) + { + tree offset = unshare_expr (component_ref_field_offset (t)); + tree field = TREE_OPERAND (t, 1); + tree factor + = size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT); + + /* Divide the offset by its alignment. */ + offset = size_binop_loc (loc, EXACT_DIV_EXPR, offset, factor); + + if (!is_gimple_min_invariant (offset)) + { + TREE_OPERAND (t, 2) = offset; + tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, + post_p, is_gimple_reg, + fb_rvalue); + ret = MIN (ret, tret); + } + } + } } /* Step 2 is to gimplify the base expression. Make sure lvalue is set so as to match the min_lval predicate. Failure to do so may result in the creation of large aggregate temporaries. */ tret = gimplify_expr (p, pre_p, post_p, is_gimple_min_lval, - fallback | fb_lvalue); + fallback | fb_lvalue); ret = MIN (ret, tret); /* And finally, the indices and operands to BIT_FIELD_REF. During this @@ -2081,31 +2068,31 @@ tree t = VEC_pop (tree, stack); if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF) - { - /* Gimplify the dimension. */ - if (!is_gimple_min_invariant (TREE_OPERAND (t, 1))) - { - tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p, - is_gimple_val, fb_rvalue); - ret = MIN (ret, tret); - } - } + { + /* Gimplify the dimension. */ + if (!is_gimple_min_invariant (TREE_OPERAND (t, 1))) + { + tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p, + is_gimple_val, fb_rvalue); + ret = MIN (ret, tret); + } + } else if (TREE_CODE (t) == BIT_FIELD_REF) - { - tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p, - is_gimple_val, fb_rvalue); - ret = MIN (ret, tret); - tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p, - is_gimple_val, fb_rvalue); - ret = MIN (ret, tret); - } + { + tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p, + is_gimple_val, fb_rvalue); + ret = MIN (ret, tret); + tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p, + is_gimple_val, fb_rvalue); + ret = MIN (ret, tret); + } STRIP_USELESS_TYPE_CONVERSION (TREE_OPERAND (t, 0)); /* The innermost expression P may have originally had - TREE_SIDE_EFFECTS set which would have caused all the outer - expressions in *EXPR_P leading to P to also have had - TREE_SIDE_EFFECTS set. */ + TREE_SIDE_EFFECTS set which would have caused all the outer + expressions in *EXPR_P leading to P to also have had + TREE_SIDE_EFFECTS set. */ recalculate_side_effects (t); } @@ -2126,17 +2113,17 @@ (++, --, +=, -=). PRE_P points to the list where side effects that must happen before - *EXPR_P should be stored. + *EXPR_P should be stored. POST_P points to the list where side effects that must happen after - *EXPR_P should be stored. + *EXPR_P should be stored. WANT_VALUE is nonzero iff we want to use the value of this expression - in another expression. */ + in another expression. */ static enum gimplify_status gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, - bool want_value) + bool want_value) { enum tree_code code; tree lhs, lvalue, rhs, t1; @@ -2149,7 +2136,7 @@ code = TREE_CODE (*expr_p); gcc_assert (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR - || code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR); + || code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR); /* Prefix or postfix? */ if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR) @@ -2186,15 +2173,15 @@ if (postfix) { if (!is_gimple_min_lval (lvalue)) - { - mark_addressable (lvalue); - lvalue = build_fold_addr_expr_loc (input_location, lvalue); - gimplify_expr (&lvalue, pre_p, post_p, is_gimple_val, fb_rvalue); - lvalue = build_fold_indirect_ref_loc (input_location, lvalue); - } + { + mark_addressable (lvalue); + lvalue = build_fold_addr_expr_loc (input_location, lvalue); + gimplify_expr (&lvalue, pre_p, post_p, is_gimple_val, fb_rvalue); + lvalue = build_fold_indirect_ref_loc (input_location, lvalue); + } ret = gimplify_expr (&lhs, pre_p, post_p, is_gimple_val, fb_rvalue); if (ret == GS_ERROR) - return ret; + return ret; } /* For POINTERs increment, use POINTER_PLUS_EXPR. */ @@ -2202,7 +2189,7 @@ { rhs = fold_convert_loc (loc, sizetype, rhs); if (arith_code == MINUS_EXPR) - rhs = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (rhs), rhs); + rhs = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (rhs), rhs); arith_code = POINTER_PLUS_EXPR; } @@ -2324,38 +2311,38 @@ tree new_tree = fold_call_expr (input_location, *expr_p, !want_value); if (new_tree && new_tree != *expr_p) - { - /* There was a transformation of this call which computes the - same value, but in a more efficient way. Return and try - again. */ - *expr_p = new_tree; - return GS_OK; - } + { + /* There was a transformation of this call which computes the + same value, but in a more efficient way. Return and try + again. */ + *expr_p = new_tree; + return GS_OK; + } if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL - && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_VA_START) - { - builtin_va_start_p = TRUE; - if (call_expr_nargs (*expr_p) < 2) + && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_VA_START) { - error ("too few arguments to function %<va_start%>"); - *expr_p = build_empty_stmt (EXPR_LOCATION (*expr_p)); - return GS_OK; - } - - if (fold_builtin_next_arg (*expr_p, true)) - { - *expr_p = build_empty_stmt (EXPR_LOCATION (*expr_p)); - return GS_OK; - } - } + builtin_va_start_p = TRUE; + if (call_expr_nargs (*expr_p) < 2) + { + error ("too few arguments to function %<va_start%>"); + *expr_p = build_empty_stmt (EXPR_LOCATION (*expr_p)); + return GS_OK; + } + + if (fold_builtin_next_arg (*expr_p, true)) + { + *expr_p = build_empty_stmt (EXPR_LOCATION (*expr_p)); + return GS_OK; + } + } } /* There is a sequence point before the call, so any side effects in the calling expression must occur before the actual call. Force gimplify_expr to use an internal post queue. */ ret = gimplify_expr (&CALL_EXPR_FN (*expr_p), pre_p, NULL, - is_gimple_call_addr, fb_rvalue); + is_gimple_call_addr, fb_rvalue); nargs = call_expr_nargs (*expr_p); @@ -2387,31 +2374,31 @@ tree last_arg_fndecl = get_callee_fndecl (last_arg); if (last_arg_fndecl - && TREE_CODE (last_arg_fndecl) == FUNCTION_DECL - && DECL_BUILT_IN_CLASS (last_arg_fndecl) == BUILT_IN_NORMAL - && DECL_FUNCTION_CODE (last_arg_fndecl) == BUILT_IN_VA_ARG_PACK) - { - tree call = *expr_p; - - --nargs; - *expr_p = build_call_array_loc (loc, TREE_TYPE (call), - CALL_EXPR_FN (call), - nargs, CALL_EXPR_ARGP (call)); - - /* Copy all CALL_EXPR flags, location and block, except - CALL_EXPR_VA_ARG_PACK flag. */ - CALL_EXPR_STATIC_CHAIN (*expr_p) = CALL_EXPR_STATIC_CHAIN (call); - CALL_EXPR_TAILCALL (*expr_p) = CALL_EXPR_TAILCALL (call); - CALL_EXPR_RETURN_SLOT_OPT (*expr_p) - = CALL_EXPR_RETURN_SLOT_OPT (call); - CALL_FROM_THUNK_P (*expr_p) = CALL_FROM_THUNK_P (call); - CALL_CANNOT_INLINE_P (*expr_p) = CALL_CANNOT_INLINE_P (call); - SET_EXPR_LOCATION (*expr_p, EXPR_LOCATION (call)); - TREE_BLOCK (*expr_p) = TREE_BLOCK (call); - - /* Set CALL_EXPR_VA_ARG_PACK. */ - CALL_EXPR_VA_ARG_PACK (*expr_p) = 1; - } + && TREE_CODE (last_arg_fndecl) == FUNCTION_DECL + && DECL_BUILT_IN_CLASS (last_arg_fndecl) == BUILT_IN_NORMAL + && DECL_FUNCTION_CODE (last_arg_fndecl) == BUILT_IN_VA_ARG_PACK) + { + tree call = *expr_p; + + --nargs; + *expr_p = build_call_array_loc (loc, TREE_TYPE (call), + CALL_EXPR_FN (call), + nargs, CALL_EXPR_ARGP (call)); + + /* Copy all CALL_EXPR flags, location and block, except + CALL_EXPR_VA_ARG_PACK flag. */ + CALL_EXPR_STATIC_CHAIN (*expr_p) = CALL_EXPR_STATIC_CHAIN (call); + CALL_EXPR_TAILCALL (*expr_p) = CALL_EXPR_TAILCALL (call); + CALL_EXPR_RETURN_SLOT_OPT (*expr_p) + = CALL_EXPR_RETURN_SLOT_OPT (call); + CALL_FROM_THUNK_P (*expr_p) = CALL_FROM_THUNK_P (call); + CALL_CANNOT_INLINE_P (*expr_p) = CALL_CANNOT_INLINE_P (call); + SET_EXPR_LOCATION (*expr_p, EXPR_LOCATION (call)); + TREE_BLOCK (*expr_p) = TREE_BLOCK (call); + + /* Set CALL_EXPR_VA_ARG_PACK. */ + CALL_EXPR_VA_ARG_PACK (*expr_p) = 1; + } } /* Finally, gimplify the function arguments. */ @@ -2428,7 +2415,7 @@ if ((i != 1) || !builtin_va_start_p) { t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p, - EXPR_LOCATION (*expr_p)); + EXPR_LOCATION (*expr_p)); if (t == GS_ERROR) ret = GS_ERROR; @@ -2450,13 +2437,13 @@ tree new_tree = fold_call_expr (input_location, *expr_p, !want_value); if (new_tree && new_tree != *expr_p) - { - /* There was a transformation of this call which computes the - same value, but in a more efficient way. Return and try - again. */ - *expr_p = new_tree; - return GS_OK; - } + { + /* There was a transformation of this call which computes the + same value, but in a more efficient way. Return and try + again. */ + *expr_p = new_tree; + return GS_OK; + } } else { @@ -2471,9 +2458,9 @@ { int flags = call_expr_flags (*expr_p); if (flags & (ECF_CONST | ECF_PURE) - /* An infinite loop is considered a side effect. */ - && !(flags & (ECF_LOOPING_CONST_OR_PURE))) - TREE_SIDE_EFFECTS (*expr_p) = 0; + /* An infinite loop is considered a side effect. */ + && !(flags & (ECF_LOOPING_CONST_OR_PURE))) + TREE_SIDE_EFFECTS (*expr_p) = 0; } /* If the value is not needed by the caller, emit a new GIMPLE_CALL @@ -2514,7 +2501,7 @@ static tree shortcut_cond_r (tree pred, tree *true_label_p, tree *false_label_p, - location_t locus) + location_t locus) { tree local_label = NULL_TREE; tree t, expr = NULL; @@ -2528,12 +2515,12 @@ /* Turn if (a && b) into - if (a); else goto no; - if (b) goto yes; else goto no; - (no:) */ + if (a); else goto no; + if (b) goto yes; else goto no; + (no:) */ if (false_label_p == NULL) - false_label_p = &local_label; + false_label_p = &local_label; /* Keep the original source location on the first 'if'. */ t = shortcut_cond_r (TREE_OPERAND (pred, 0), NULL, false_label_p, locus); @@ -2542,7 +2529,7 @@ /* Set the source location of the && on the second 'if'. */ new_locus = EXPR_HAS_LOCATION (pred) ? EXPR_LOCATION (pred) : locus; t = shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p, false_label_p, - new_locus); + new_locus); append_to_statement_list (t, &expr); } else if (TREE_CODE (pred) == TRUTH_ORIF_EXPR) @@ -2551,12 +2538,12 @@ /* Turn if (a || b) into - if (a) goto yes; - if (b) goto yes; else goto no; - (yes:) */ + if (a) goto yes; + if (b) goto yes; else goto no; + (yes:) */ if (true_label_p == NULL) - true_label_p = &local_label; + true_label_p = &local_label; /* Keep the original source location on the first 'if'. */ t = shortcut_cond_r (TREE_OPERAND (pred, 0), true_label_p, NULL, locus); @@ -2565,7 +2552,7 @@ /* Set the source location of the || on the second 'if'. */ new_locus = EXPR_HAS_LOCATION (pred) ? EXPR_LOCATION (pred) : locus; t = shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p, false_label_p, - new_locus); + new_locus); append_to_statement_list (t, &expr); } else if (TREE_CODE (pred) == COND_EXPR) @@ -2573,25 +2560,25 @@ location_t new_locus; /* As long as we're messing with gotos, turn if (a ? b : c) into - if (a) - if (b) goto yes; else goto no; - else - if (c) goto yes; else goto no; */ + if (a) + if (b) goto yes; else goto no; + else + if (c) goto yes; else goto no; */ /* Keep the original source location on the first 'if'. Set the source - location of the ? on the second 'if'. */ + location of the ? on the second 'if'. */ new_locus = EXPR_HAS_LOCATION (pred) ? EXPR_LOCATION (pred) : locus; expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (pred, 0), - shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p, - false_label_p, locus), - shortcut_cond_r (TREE_OPERAND (pred, 2), true_label_p, - false_label_p, new_locus)); + shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p, + false_label_p, locus), + shortcut_cond_r (TREE_OPERAND (pred, 2), true_label_p, + false_label_p, new_locus)); } else { expr = build3 (COND_EXPR, void_type_node, pred, - build_and_jump (true_label_p), - build_and_jump (false_label_p)); + build_and_jump (true_label_p), + build_and_jump (false_label_p)); SET_EXPR_LOCATION (expr, locus); } @@ -2625,9 +2612,9 @@ if (!else_se) { /* If there is no 'else', turn - if (a && b) then c - into - if (a) if (b) then c. */ + if (a && b) then c + into + if (a) if (b) then c. */ while (TREE_CODE (pred) == TRUTH_ANDIF_EXPR) { /* Keep the original source location on the first 'if'. */ @@ -2647,9 +2634,9 @@ if (!then_se) { /* If there is no 'then', turn - if (a || b); else d - into - if (a); else if (b); else d. */ + if (a || b); else d + into + if (a); else if (b); else d. */ while (TREE_CODE (pred) == TRUTH_ORIF_EXPR) { /* Keep the original source location on the first 'if'. */ @@ -2758,18 +2745,18 @@ if (else_se) { if (jump_over_else) - { - tree last = expr_last (expr); - t = build_and_jump (&end_label); - if (EXPR_HAS_LOCATION (last)) - SET_EXPR_LOCATION (t, EXPR_LOCATION (last)); - append_to_statement_list (t, &expr); - } + { + tree last = expr_last (expr); + t = build_and_jump (&end_label); + if (EXPR_HAS_LOCATION (last)) + SET_EXPR_LOCATION (t, EXPR_LOCATION (last)); + append_to_statement_list (t, &expr); + } if (emit_false) - { - t = build1 (LABEL_EXPR, void_type_node, false_label); - append_to_statement_list (t, &expr); - } + { + t = build1 (LABEL_EXPR, void_type_node, false_label); + append_to_statement_list (t, &expr); + } append_to_statement_list (else_, &expr); } if (emit_end && end_label) @@ -2845,7 +2832,7 @@ default: /* Other expressions that get here must have boolean values, but - might need to be converted to the appropriate mode. */ + might need to be converted to the appropriate mode. */ return fold_convert_loc (loc, boolean_type_node, expr); } } @@ -2873,10 +2860,10 @@ COND_EXPR_COND (*expr_p) = cond; tret = gimplify_expr (&COND_EXPR_THEN (expr), pre_p, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); ret = MIN (ret, tret); tret = gimplify_expr (&COND_EXPR_ELSE (expr), pre_p, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); return MIN (ret, tret); } @@ -2907,10 +2894,10 @@ /* Convert the conditional expression pointed to by EXPR_P '(p) ? a : b;' into - if (p) if (p) - t1 = a; a; - else or else - t1 = b; b; + if (p) if (p) + t1 = a; a; + else or else + t1 = b; b; t1; The second form is used when *EXPR_P is of type void. @@ -3004,27 +2991,27 @@ expr = shortcut_cond_expr (expr); if (expr != *expr_p) - { - *expr_p = expr; - - /* We can't rely on gimplify_expr to re-gimplify the expanded - form properly, as cleanups might cause the target labels to be - wrapped in a TRY_FINALLY_EXPR. To prevent that, we need to - set up a conditional context. */ - gimple_push_condition (); - gimplify_stmt (expr_p, &seq); - gimple_pop_condition (pre_p); - gimple_seq_add_seq (pre_p, seq); - - return GS_ALL_DONE; - } + { + *expr_p = expr; + + /* We can't rely on gimplify_expr to re-gimplify the expanded + form properly, as cleanups might cause the target labels to be + wrapped in a TRY_FINALLY_EXPR. To prevent that, we need to + set up a conditional context. */ + gimple_push_condition (); + gimplify_stmt (expr_p, &seq); + gimple_pop_condition (pre_p); + gimple_seq_add_seq (pre_p, seq); + + return GS_ALL_DONE; + } } /* Now do the normal gimplification. */ /* Gimplify condition. */ ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, NULL, is_gimple_condexpr, - fb_rvalue); + fb_rvalue); if (ret == GS_ERROR) return GS_ERROR; gcc_assert (TREE_OPERAND (expr, 0) != NULL_TREE); @@ -3036,14 +3023,14 @@ && TREE_CODE (TREE_OPERAND (expr, 1)) == GOTO_EXPR && TREE_CODE (GOTO_DESTINATION (TREE_OPERAND (expr, 1))) == LABEL_DECL && (DECL_CONTEXT (GOTO_DESTINATION (TREE_OPERAND (expr, 1))) - == current_function_decl) + == current_function_decl) /* For -O0 avoid this optimization if the COND_EXPR and GOTO_EXPR - have different locations, otherwise we end up with incorrect - location information on the branches. */ + have different locations, otherwise we end up with incorrect + location information on the branches. */ && (optimize - || !EXPR_HAS_LOCATION (expr) - || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 1)) - || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 1)))) + || !EXPR_HAS_LOCATION (expr) + || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 1)) + || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 1)))) { label_true = GOTO_DESTINATION (TREE_OPERAND (expr, 1)); have_then_clause_p = true; @@ -3054,14 +3041,14 @@ && TREE_CODE (TREE_OPERAND (expr, 2)) == GOTO_EXPR && TREE_CODE (GOTO_DESTINATION (TREE_OPERAND (expr, 2))) == LABEL_DECL && (DECL_CONTEXT (GOTO_DESTINATION (TREE_OPERAND (expr, 2))) - == current_function_decl) + == current_function_decl) /* For -O0 avoid this optimization if the COND_EXPR and GOTO_EXPR - have different locations, otherwise we end up with incorrect - location information on the branches. */ + have different locations, otherwise we end up with incorrect + location information on the branches. */ && (optimize - || !EXPR_HAS_LOCATION (expr) - || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 2)) - || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 2)))) + || !EXPR_HAS_LOCATION (expr) + || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 2)) + || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 2)))) { label_false = GOTO_DESTINATION (TREE_OPERAND (expr, 2)); have_else_clause_p = true; @@ -3070,7 +3057,7 @@ label_false = create_artificial_label (UNKNOWN_LOCATION); gimple_cond_get_ops_from_tree (COND_EXPR_COND (expr), &pred_code, &arm1, - &arm2); + &arm2); gimple_cond = gimple_build_cond (pred_code, arm1, arm2, label_true, label_false); @@ -3080,39 +3067,39 @@ if (!have_then_clause_p) { /* For if (...) {} else { code; } put label_true after - the else block. */ + the else block. */ if (TREE_OPERAND (expr, 1) == NULL_TREE - && !have_else_clause_p - && TREE_OPERAND (expr, 2) != NULL_TREE) - label_cont = label_true; + && !have_else_clause_p + && TREE_OPERAND (expr, 2) != NULL_TREE) + label_cont = label_true; else - { - gimplify_seq_add_stmt (&seq, gimple_build_label (label_true)); - have_then_clause_p = gimplify_stmt (&TREE_OPERAND (expr, 1), &seq); - /* For if (...) { code; } else {} or - if (...) { code; } else goto label; or - if (...) { code; return; } else { ... } - label_cont isn't needed. */ - if (!have_else_clause_p - && TREE_OPERAND (expr, 2) != NULL_TREE - && gimple_seq_may_fallthru (seq)) - { - gimple g; - label_cont = create_artificial_label (UNKNOWN_LOCATION); - - g = gimple_build_goto (label_cont); - - /* GIMPLE_COND's are very low level; they have embedded - gotos. This particular embedded goto should not be marked - with the location of the original COND_EXPR, as it would - correspond to the COND_EXPR's condition, not the ELSE or the - THEN arms. To avoid marking it with the wrong location, flag - it as "no location". */ - gimple_set_do_not_emit_location (g); - - gimplify_seq_add_stmt (&seq, g); - } - } + { + gimplify_seq_add_stmt (&seq, gimple_build_label (label_true)); + have_then_clause_p = gimplify_stmt (&TREE_OPERAND (expr, 1), &seq); + /* For if (...) { code; } else {} or + if (...) { code; } else goto label; or + if (...) { code; return; } else { ... } + label_cont isn't needed. */ + if (!have_else_clause_p + && TREE_OPERAND (expr, 2) != NULL_TREE + && gimple_seq_may_fallthru (seq)) + { + gimple g; + label_cont = create_artificial_label (UNKNOWN_LOCATION); + + g = gimple_build_goto (label_cont); + + /* GIMPLE_COND's are very low level; they have embedded + gotos. This particular embedded goto should not be marked + with the location of the original COND_EXPR, as it would + correspond to the COND_EXPR's condition, not the ELSE or the + THEN arms. To avoid marking it with the wrong location, flag + it as "no location". */ + gimple_set_do_not_emit_location (g); + + gimplify_seq_add_stmt (&seq, g); + } + } } if (!have_else_clause_p) { @@ -3164,7 +3151,7 @@ static enum gimplify_status gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value, - gimple_seq *seq_p) + gimple_seq *seq_p) { tree t, to, to_ptr, from, from_ptr; gimple gs; @@ -3211,7 +3198,7 @@ static enum gimplify_status gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value, - gimple_seq *seq_p) + gimple_seq *seq_p) { tree t, from, to, to_ptr; gimple gs; @@ -3225,7 +3212,7 @@ from = TREE_OPERAND (from, 0); gcc_assert (TREE_CODE (from) == CONSTRUCTOR - && VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (from))); + && VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (from))); /* Now proceed. */ to = TREE_OPERAND (*expr_p, 0); @@ -3295,12 +3282,12 @@ tree type, fntype = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (t))); for (type = TYPE_ARG_TYPES (fntype); type; type = TREE_CHAIN (type)) - if (POINTER_TYPE_P (TREE_VALUE (type)) - && (!data->lhs_base_decl || TREE_ADDRESSABLE (data->lhs_base_decl)) - && alias_sets_conflict_p (data->lhs_alias_set, - get_alias_set - (TREE_TYPE (TREE_VALUE (type))))) - return t; + if (POINTER_TYPE_P (TREE_VALUE (type)) + && (!data->lhs_base_decl || TREE_ADDRESSABLE (data->lhs_base_decl)) + && alias_sets_conflict_p (data->lhs_alias_set, + get_alias_set + (TREE_TYPE (TREE_VALUE (type))))) + return t; } if (IS_TYPE_OR_DECL_P (t)) @@ -3314,7 +3301,7 @@ static void gimplify_init_ctor_preeval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, - struct gimplify_init_ctor_preeval_data *data) + struct gimplify_init_ctor_preeval_data *data) { enum gimplify_status one; @@ -3322,7 +3309,7 @@ if (TREE_CONSTANT (*expr_p)) { /* Ensure it does not have side effects, it might contain a reference to - the object we're initializing. */ + the object we're initializing. */ gcc_assert (!TREE_SIDE_EFFECTS (*expr_p)); return; } @@ -3387,7 +3374,7 @@ loop_entry: object[var] = value; if (var == upper) - goto loop_exit; + goto loop_exit; var = var + 1; goto loop_entry; loop_exit: @@ -3399,12 +3386,12 @@ already been taken care of for us, in gimplify_init_ctor_preeval(). */ static void gimplify_init_ctor_eval (tree, VEC(constructor_elt,gc) *, - gimple_seq *, bool); + gimple_seq *, bool); static void gimplify_init_ctor_eval_range (tree object, tree lower, tree upper, - tree value, tree array_elt_type, - gimple_seq *pre_p, bool cleared) + tree value, tree array_elt_type, + gimple_seq *pre_p, bool cleared) { tree loop_entry_label, loop_exit_label, fall_thru_label; tree var, var_type, cref, tmp; @@ -3423,7 +3410,7 @@ /* Build the reference. */ cref = build4 (ARRAY_REF, array_elt_type, unshare_expr (object), - var, NULL_TREE, NULL_TREE); + var, NULL_TREE, NULL_TREE); /* If we are a constructor, just call gimplify_init_ctor_eval to do the store. Otherwise just assign value to the reference. */ @@ -3432,20 +3419,20 @@ /* NB we might have to call ourself recursively through gimplify_init_ctor_eval if the value is a constructor. */ gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value), - pre_p, cleared); + pre_p, cleared); else gimplify_seq_add_stmt (pre_p, gimple_build_assign (cref, value)); /* We exit the loop when the index var is equal to the upper bound. */ gimplify_seq_add_stmt (pre_p, - gimple_build_cond (EQ_EXPR, var, upper, - loop_exit_label, fall_thru_label)); + gimple_build_cond (EQ_EXPR, var, upper, + loop_exit_label, fall_thru_label)); gimplify_seq_add_stmt (pre_p, gimple_build_label (fall_thru_label)); /* Otherwise, increment the index var... */ tmp = build2 (PLUS_EXPR, var_type, var, - fold_convert (var_type, integer_one_node)); + fold_convert (var_type, integer_one_node)); gimplify_seq_add_stmt (pre_p, gimple_build_assign (var, tmp)); /* ...and jump back to the loop entry. */ @@ -3485,7 +3472,7 @@ static void gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts, - gimple_seq *pre_p, bool cleared) + gimple_seq *pre_p, bool cleared) { tree array_elt_type = NULL; unsigned HOST_WIDE_INT ix; @@ -3500,68 +3487,68 @@ /* NULL values are created above for gimplification errors. */ if (value == NULL) - continue; + continue; if (cleared && initializer_zerop (value)) - continue; + continue; /* ??? Here's to hoping the front end fills in all of the indices, - so we don't have to figure out what's missing ourselves. */ + so we don't have to figure out what's missing ourselves. */ gcc_assert (purpose); /* Skip zero-sized fields, unless value has side-effects. This can - happen with calls to functions returning a zero-sized type, which - we shouldn't discard. As a number of downstream passes don't - expect sets of zero-sized fields, we rely on the gimplification of - the MODIFY_EXPR we make below to drop the assignment statement. */ + happen with calls to functions returning a zero-sized type, which + we shouldn't discard. As a number of downstream passes don't + expect sets of zero-sized fields, we rely on the gimplification of + the MODIFY_EXPR we make below to drop the assignment statement. */ if (! TREE_SIDE_EFFECTS (value) && zero_sized_field_decl (purpose)) - continue; + continue; /* If we have a RANGE_EXPR, we have to build a loop to assign the - whole range. */ + whole range. */ if (TREE_CODE (purpose) == RANGE_EXPR) - { - tree lower = TREE_OPERAND (purpose, 0); - tree upper = TREE_OPERAND (purpose, 1); - - /* If the lower bound is equal to upper, just treat it as if - upper was the index. */ - if (simple_cst_equal (lower, upper)) - purpose = upper; - else - { - gimplify_init_ctor_eval_range (object, lower, upper, value, - array_elt_type, pre_p, cleared); - continue; - } - } + { + tree lower = TREE_OPERAND (purpose, 0); + tree upper = TREE_OPERAND (purpose, 1); + + /* If the lower bound is equal to upper, just treat it as if + upper was the index. */ + if (simple_cst_equal (lower, upper)) + purpose = upper; + else + { + gimplify_init_ctor_eval_range (object, lower, upper, value, + array_elt_type, pre_p, cleared); + continue; + } + } if (array_elt_type) - { - /* Do not use bitsizetype for ARRAY_REF indices. */ - if (TYPE_DOMAIN (TREE_TYPE (object))) - purpose = fold_convert (TREE_TYPE (TYPE_DOMAIN (TREE_TYPE (object))), - purpose); - cref = build4 (ARRAY_REF, array_elt_type, unshare_expr (object), - purpose, NULL_TREE, NULL_TREE); - } + { + /* Do not use bitsizetype for ARRAY_REF indices. */ + if (TYPE_DOMAIN (TREE_TYPE (object))) + purpose = fold_convert (TREE_TYPE (TYPE_DOMAIN (TREE_TYPE (object))), + purpose); + cref = build4 (ARRAY_REF, array_elt_type, unshare_expr (object), + purpose, NULL_TREE, NULL_TREE); + } else - { - gcc_assert (TREE_CODE (purpose) == FIELD_DECL); - cref = build3 (COMPONENT_REF, TREE_TYPE (purpose), - unshare_expr (object), purpose, NULL_TREE); - } + { + gcc_assert (TREE_CODE (purpose) == FIELD_DECL); + cref = build3 (COMPONENT_REF, TREE_TYPE (purpose), + unshare_expr (object), purpose, NULL_TREE); + } if (TREE_CODE (value) == CONSTRUCTOR - && TREE_CODE (TREE_TYPE (value)) != VECTOR_TYPE) - gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value), - pre_p, cleared); + && TREE_CODE (TREE_TYPE (value)) != VECTOR_TYPE) + gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value), + pre_p, cleared); else - { - tree init = build2 (INIT_EXPR, TREE_TYPE (cref), cref, value); - gimplify_and_add (init, pre_p); - ggc_free (init); - } + { + tree init = build2 (INIT_EXPR, TREE_TYPE (cref), cref, value); + gimplify_and_add (init, pre_p); + ggc_free (init); + } } } @@ -3627,27 +3614,27 @@ tree value = VEC_index (constructor_elt, elts, idx)->value; tree newval = value; if (TREE_CODE (value) == CONSTRUCTOR) - newval = optimize_compound_literals_in_ctor (value); + newval = optimize_compound_literals_in_ctor (value); else if (TREE_CODE (value) == COMPOUND_LITERAL_EXPR) - { - tree decl_s = COMPOUND_LITERAL_EXPR_DECL_EXPR (value); - tree decl = DECL_EXPR_DECL (decl_s); - tree init = DECL_INITIAL (decl); - - if (!TREE_ADDRESSABLE (value) - && !TREE_ADDRESSABLE (decl) - && init) - newval = optimize_compound_literals_in_ctor (init); - } + { + tree decl_s = COMPOUND_LITERAL_EXPR_DECL_EXPR (value); + tree decl = DECL_EXPR_DECL (decl_s); + tree init = DECL_INITIAL (decl); + + if (!TREE_ADDRESSABLE (value) + && !TREE_ADDRESSABLE (decl) + && init) + newval = optimize_compound_literals_in_ctor (init); + } if (newval == value) - continue; + continue; if (ctor == orig_ctor) - { - ctor = copy_node (orig_ctor); - CONSTRUCTOR_ELTS (ctor) = VEC_copy (constructor_elt, gc, elts); - elts = CONSTRUCTOR_ELTS (ctor); - } + { + ctor = copy_node (orig_ctor); + CONSTRUCTOR_ELTS (ctor) = VEC_copy (constructor_elt, gc, elts); + elts = CONSTRUCTOR_ELTS (ctor); + } VEC_index (constructor_elt, elts, idx)->value = newval; } return ctor; @@ -3670,7 +3657,7 @@ static enum gimplify_status gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, - bool want_value, bool notify_temp_creation) + bool want_value, bool notify_temp_creation) { tree object, ctor, type; enum gimplify_status ret; @@ -3681,9 +3668,9 @@ if (!notify_temp_creation) { ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, - is_gimple_lvalue, fb_lvalue); + is_gimple_lvalue, fb_lvalue); if (ret == GS_ERROR) - return ret; + return ret; } object = TREE_OPERAND (*expr_p, 0); @@ -3996,15 +3983,15 @@ else { /* If we have gimplified both sides of the initializer but have - not emitted an assignment, do so now. */ + not emitted an assignment, do so now. */ if (*expr_p) - { - tree lhs = TREE_OPERAND (*expr_p, 0); - tree rhs = TREE_OPERAND (*expr_p, 1); - gimple init = gimple_build_assign (lhs, rhs); - gimplify_seq_add_stmt (pre_p, init); - *expr_p = NULL; - } + { + tree lhs = TREE_OPERAND (*expr_p, 0); + tree rhs = TREE_OPERAND (*expr_p, 1); + gimple init = gimple_build_assign (lhs, rhs); + gimplify_seq_add_stmt (pre_p, init); + *expr_p = NULL; + } return GS_ALL_DONE; } @@ -4120,7 +4107,7 @@ tree osub = sub; sub = gimple_fold_indirect_ref (sub); if (! sub) - sub = build1 (INDIRECT_REF, TREE_TYPE (subtype), osub); + sub = build1 (INDIRECT_REF, TREE_TYPE (subtype), osub); type_domain = TYPE_DOMAIN (TREE_TYPE (sub)); if (type_domain && TYPE_MIN_VALUE (type_domain)) min_val = TYPE_MIN_VALUE (type_domain); @@ -4150,8 +4137,8 @@ static enum gimplify_status gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, - gimple_seq *pre_p, gimple_seq *post_p, - bool want_value) + gimple_seq *pre_p, gimple_seq *post_p, + bool want_value) { enum gimplify_status ret = GS_UNHANDLED; bool changed; @@ -4466,21 +4453,21 @@ /* Gimplify the MODIFY_EXPR node pointed to by EXPR_P. modify_expr - : varname '=' rhs - | '*' ID '=' rhs + : varname '=' rhs + | '*' ID '=' rhs PRE_P points to the list where side effects that must happen before - *EXPR_P should be stored. + *EXPR_P should be stored. POST_P points to the list where side effects that must happen after - *EXPR_P should be stored. + *EXPR_P should be stored. WANT_VALUE is nonzero iff we want to use the value of this expression - in another expression. */ + in another expression. */ static enum gimplify_status gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, - bool want_value) + bool want_value) { tree *from_p = &TREE_OPERAND (*expr_p, 1); tree *to_p = &TREE_OPERAND (*expr_p, 0); @@ -4489,7 +4476,7 @@ location_t loc = EXPR_LOCATION (*expr_p); gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR - || TREE_CODE (*expr_p) == INIT_EXPR); + || TREE_CODE (*expr_p) == INIT_EXPR); /* Insert pointer conversions required by the middle-end that are not required by the frontend. This fixes middle-end type checking for @@ -4498,12 +4485,12 @@ { STRIP_USELESS_TYPE_CONVERSION (*from_p); if (!useless_type_conversion_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p))) - *from_p = fold_convert_loc (loc, TREE_TYPE (*to_p), *from_p); + *from_p = fold_convert_loc (loc, TREE_TYPE (*to_p), *from_p); } /* See if any simplifications can be done based on what the RHS is. */ ret = gimplify_modify_expr_rhs (expr_p, from_p, to_p, pre_p, post_p, - want_value); + want_value); if (ret != GS_UNHANDLED) return ret; @@ -4544,13 +4531,13 @@ created GIMPLE_CALL <foo> will be the last statement in *PRE_P and all we need to do here is set 'a' to be its LHS. */ ret = gimplify_expr (from_p, pre_p, post_p, rhs_predicate_for (*to_p), - fb_rvalue); + fb_rvalue); if (ret == GS_ERROR) return ret; /* Now see if the above changed *from_p to something we handle specially. */ ret = gimplify_modify_expr_rhs (expr_p, from_p, to_p, pre_p, post_p, - want_value); + want_value); if (ret != GS_UNHANDLED) return ret; @@ -4563,14 +4550,14 @@ tree size = TREE_OPERAND (*from_p, 1); if (TREE_CODE (from) == CONSTRUCTOR) - return gimplify_modify_expr_to_memset (expr_p, size, want_value, pre_p); + return gimplify_modify_expr_to_memset (expr_p, size, want_value, pre_p); if (is_gimple_addressable (from)) - { - *from_p = from; - return gimplify_modify_expr_to_memcpy (expr_p, size, want_value, - pre_p); - } + { + *from_p = from; + return gimplify_modify_expr_to_memcpy (expr_p, size, want_value, + pre_p); + } } /* Transform partial stores to non-addressable complex variables into @@ -4590,8 +4577,8 @@ && !DECL_IGNORED_P (*to_p)) { if (!DECL_NAME (*from_p) && DECL_NAME (*to_p)) - DECL_NAME (*from_p) - = create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (*to_p))); + DECL_NAME (*from_p) + = create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (*to_p))); DECL_DEBUG_EXPR_IS_FROM (*from_p) = 1; SET_DECL_DEBUG_EXPR (*from_p, *to_p); } @@ -4602,7 +4589,7 @@ if (TREE_CODE (*from_p) == CALL_EXPR) { /* Since the RHS is a CALL_EXPR, we need to create a GIMPLE_CALL - instead of a GIMPLE_ASSIGN. */ + instead of a GIMPLE_ASSIGN. */ assign = gimple_build_call_from_tree (*from_p); if (!gimple_call_noreturn_p (assign)) gimple_call_set_lhs (assign, *to_p); @@ -4618,7 +4605,7 @@ if (gimplify_ctxp->into_ssa && is_gimple_reg (*to_p)) { /* If we've somehow already got an SSA_NAME on the LHS, then - we've probably modified it twice. Not good. */ + we've probably modified it twice. Not good. */ gcc_assert (TREE_CODE (*to_p) != SSA_NAME); *to_p = make_ssa_name (*to_p, assign); gimple_set_lhs (assign, *to_p); @@ -4689,7 +4676,7 @@ Expressions of the form 'a && b' are gimplified to: - a && b ? true : false + a && b ? true : false LOCUS is the source location to be put on the generated COND_EXPR. gimplify_cond_expr will do the rest. */ @@ -4701,8 +4688,8 @@ tree type = TREE_TYPE (*expr_p); *expr_p = build3 (COND_EXPR, type, *expr_p, - fold_convert_loc (locus, type, boolean_true_node), - fold_convert_loc (locus, type, boolean_false_node)); + fold_convert_loc (locus, type, boolean_true_node), + fold_convert_loc (locus, type, boolean_false_node)); SET_EXPR_LOCATION (*expr_p, locus); @@ -4728,9 +4715,9 @@ tree *sub_p = &TREE_OPERAND (t, 0); if (TREE_CODE (*sub_p) == COMPOUND_EXPR) - gimplify_compound_expr (sub_p, pre_p, false); + gimplify_compound_expr (sub_p, pre_p, false); else - gimplify_stmt (sub_p, pre_p); + gimplify_stmt (sub_p, pre_p); t = TREE_OPERAND (t, 1); } @@ -4767,16 +4754,16 @@ if (!SAVE_EXPR_RESOLVED_P (*expr_p)) { /* The operand may be a void-valued expression such as SAVE_EXPRs - generated by the Java frontend for class initialization. It is - being executed only for its side-effects. */ + generated by the Java frontend for class initialization. It is + being executed only for its side-effects. */ if (TREE_TYPE (val) == void_type_node) - { - ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, - is_gimple_stmt, fb_none); - val = NULL; - } + { + ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, + is_gimple_stmt, fb_none); + val = NULL; + } else - val = get_initialized_tmp_var (val, pre_p, post_p); + val = get_initialized_tmp_var (val, pre_p, post_p); TREE_OPERAND (*expr_p, 0) = val; SAVE_EXPR_RESOLVED_P (*expr_p) = 1; @@ -4790,15 +4777,15 @@ /* Re-write the ADDR_EXPR node pointed to by EXPR_P unary_expr - : ... - | '&' varname - ... + : ... + | '&' varname + ... PRE_P points to the list where side effects that must happen before - *EXPR_P should be stored. + *EXPR_P should be stored. POST_P points to the list where side effects that must happen after - *EXPR_P should be stored. */ + *EXPR_P should be stored. */ static enum gimplify_status gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) @@ -4813,21 +4800,21 @@ case INDIRECT_REF: do_indirect_ref: /* Check if we are dealing with an expression of the form '&*ptr'. - While the front end folds away '&*ptr' into 'ptr', these - expressions may be generated internally by the compiler (e.g., - builtins like __builtin_va_end). */ + While the front end folds away '&*ptr' into 'ptr', these + expressions may be generated internally by the compiler (e.g., + builtins like __builtin_va_end). */ /* Caution: the silent array decomposition semantics we allow for - ADDR_EXPR means we can't always discard the pair. */ + ADDR_EXPR means we can't always discard the pair. */ /* Gimplification of the ADDR_EXPR operand may drop - cv-qualification conversions, so make sure we add them if - needed. */ + cv-qualification conversions, so make sure we add them if + needed. */ { - tree op00 = TREE_OPERAND (op0, 0); - tree t_expr = TREE_TYPE (expr); - tree t_op00 = TREE_TYPE (op00); + tree op00 = TREE_OPERAND (op0, 0); + tree t_expr = TREE_TYPE (expr); + tree t_op00 = TREE_TYPE (op00); if (!useless_type_conversion_p (t_expr, t_op00)) - op00 = fold_convert_loc (loc, TREE_TYPE (expr), op00); + op00 = fold_convert_loc (loc, TREE_TYPE (expr), op00); *expr_p = op00; ret = GS_OK; } @@ -4835,53 +4822,53 @@ case VIEW_CONVERT_EXPR: /* Take the address of our operand and then convert it to the type of - this ADDR_EXPR. - - ??? The interactions of VIEW_CONVERT_EXPR and aliasing is not at - all clear. The impact of this transformation is even less clear. */ + this ADDR_EXPR. + + ??? The interactions of VIEW_CONVERT_EXPR and aliasing is not at + all clear. The impact of this transformation is even less clear. */ /* If the operand is a useless conversion, look through it. Doing so - guarantees that the ADDR_EXPR and its operand will remain of the - same type. */ + guarantees that the ADDR_EXPR and its operand will remain of the + same type. */ if (tree_ssa_useless_type_conversion (TREE_OPERAND (op0, 0))) - op0 = TREE_OPERAND (op0, 0); + op0 = TREE_OPERAND (op0, 0); *expr_p = fold_convert_loc (loc, TREE_TYPE (expr), - build_fold_addr_expr_loc (loc, - TREE_OPERAND (op0, 0))); + build_fold_addr_expr_loc (loc, + TREE_OPERAND (op0, 0))); ret = GS_OK; break; default: /* We use fb_either here because the C frontend sometimes takes - the address of a call that returns a struct; see - gcc.dg/c99-array-lval-1.c. The gimplifier will correctly make - the implied temporary explicit. */ + the address of a call that returns a struct; see + gcc.dg/c99-array-lval-1.c. The gimplifier will correctly make + the implied temporary explicit. */ /* Make the operand addressable. */ ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, post_p, - is_gimple_addressable, fb_either); + is_gimple_addressable, fb_either); if (ret == GS_ERROR) - break; + break; /* Then mark it. Beware that it may not be possible to do so directly - if a temporary has been created by the gimplification. */ + if a temporary has been created by the gimplification. */ prepare_gimple_addressable (&TREE_OPERAND (expr, 0), pre_p); op0 = TREE_OPERAND (expr, 0); /* For various reasons, the gimplification of the expression - may have made a new INDIRECT_REF. */ + may have made a new INDIRECT_REF. */ if (TREE_CODE (op0) == INDIRECT_REF) - goto do_indirect_ref; + goto do_indirect_ref; mark_addressable (TREE_OPERAND (expr, 0)); /* The FEs may end up building ADDR_EXPRs early on a decl with - an incomplete type. Re-build ADDR_EXPRs in canonical form - here. */ + an incomplete type. Re-build ADDR_EXPRs in canonical form + here. */ if (!types_compatible_p (TREE_TYPE (op0), TREE_TYPE (TREE_TYPE (expr)))) - *expr_p = build_fold_addr_expr (op0); + *expr_p = build_fold_addr_expr (op0); /* Make sure TREE_CONSTANT and TREE_SIDE_EFFECTS are set properly. */ recompute_tree_invariant_for_addr_expr (*expr_p); @@ -4889,7 +4876,7 @@ /* If we re-built the ADDR_EXPR add a conversion to the original type if required. */ if (!useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (*expr_p))) - *expr_p = fold_convert (TREE_TYPE (expr), *expr_p); + *expr_p = fold_convert (TREE_TYPE (expr), *expr_p); break; } @@ -4934,126 +4921,126 @@ link_next = TREE_CHAIN (link); oconstraints[i] - = constraint - = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); + = constraint + = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); constraint_len = strlen (constraint); if (constraint_len == 0) continue; ok = parse_output_constraint (&constraint, i, 0, 0, - &allows_mem, &allows_reg, &is_inout); + &allows_mem, &allows_reg, &is_inout); if (!ok) - { - ret = GS_ERROR; - is_inout = false; - } + { + ret = GS_ERROR; + is_inout = false; + } if (!allows_reg && allows_mem) - mark_addressable (TREE_VALUE (link)); + mark_addressable (TREE_VALUE (link)); tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p, - is_inout ? is_gimple_min_lval : is_gimple_lvalue, - fb_lvalue | fb_mayfail); + is_inout ? is_gimple_min_lval : is_gimple_lvalue, + fb_lvalue | fb_mayfail); if (tret == GS_ERROR) - { - error ("invalid lvalue in asm output %d", i); - ret = tret; - } + { + error ("invalid lvalue in asm output %d", i); + ret = tret; + } VEC_safe_push (tree, gc, outputs, link); TREE_CHAIN (link) = NULL_TREE; if (is_inout) - { - /* An input/output operand. To give the optimizers more - flexibility, split it into separate input and output - operands. */ - tree input; - char buf[10]; - - /* Turn the in/out constraint into an output constraint. */ - char *p = xstrdup (constraint); - p[0] = '='; - TREE_VALUE (TREE_PURPOSE (link)) = build_string (constraint_len, p); - - /* And add a matching input constraint. */ - if (allows_reg) - { - sprintf (buf, "%d", i); - - /* If there are multiple alternatives in the constraint, - handle each of them individually. Those that allow register - will be replaced with operand number, the others will stay - unchanged. */ - if (strchr (p, ',') != NULL) - { - size_t len = 0, buflen = strlen (buf); - char *beg, *end, *str, *dst; - - for (beg = p + 1;;) - { - end = strchr (beg, ','); - if (end == NULL) - end = strchr (beg, '\0'); - if ((size_t) (end - beg) < buflen) - len += buflen + 1; - else - len += end - beg + 1; - if (*end) - beg = end + 1; - else - break; - } - - str = (char *) alloca (len); - for (beg = p + 1, dst = str;;) - { - const char *tem; - bool mem_p, reg_p, inout_p; - - end = strchr (beg, ','); - if (end) - *end = '\0'; - beg[-1] = '='; - tem = beg - 1; - parse_output_constraint (&tem, i, 0, 0, - &mem_p, ®_p, &inout_p); - if (dst != str) - *dst++ = ','; - if (reg_p) - { - memcpy (dst, buf, buflen); - dst += buflen; - } - else - { - if (end) - len = end - beg; - else - len = strlen (beg); - memcpy (dst, beg, len); - dst += len; - } - if (end) - beg = end + 1; - else - break; - } - *dst = '\0'; - input = build_string (dst - str, str); - } - else - input = build_string (strlen (buf), buf); - } - else - input = build_string (constraint_len - 1, constraint + 1); - - free (p); - - input = build_tree_list (build_tree_list (NULL_TREE, input), - unshare_expr (TREE_VALUE (link))); - ASM_INPUTS (expr) = chainon (ASM_INPUTS (expr), input); - } + { + /* An input/output operand. To give the optimizers more + flexibility, split it into separate input and output + operands. */ + tree input; + char buf[10]; + + /* Turn the in/out constraint into an output constraint. */ + char *p = xstrdup (constraint); + p[0] = '='; + TREE_VALUE (TREE_PURPOSE (link)) = build_string (constraint_len, p); + + /* And add a matching input constraint. */ + if (allows_reg) + { + sprintf (buf, "%d", i); + + /* If there are multiple alternatives in the constraint, + handle each of them individually. Those that allow register + will be replaced with operand number, the others will stay + unchanged. */ + if (strchr (p, ',') != NULL) + { + size_t len = 0, buflen = strlen (buf); + char *beg, *end, *str, *dst; + + for (beg = p + 1;;) + { + end = strchr (beg, ','); + if (end == NULL) + end = strchr (beg, '\0'); + if ((size_t) (end - beg) < buflen) + len += buflen + 1; + else + len += end - beg + 1; + if (*end) + beg = end + 1; + else + break; + } + + str = (char *) alloca (len); + for (beg = p + 1, dst = str;;) + { + const char *tem; + bool mem_p, reg_p, inout_p; + + end = strchr (beg, ','); + if (end) + *end = '\0'; + beg[-1] = '='; + tem = beg - 1; + parse_output_constraint (&tem, i, 0, 0, + &mem_p, ®_p, &inout_p); + if (dst != str) + *dst++ = ','; + if (reg_p) + { + memcpy (dst, buf, buflen); + dst += buflen; + } + else + { + if (end) + len = end - beg; + else + len = strlen (beg); + memcpy (dst, beg, len); + dst += len; + } + if (end) + beg = end + 1; + else + break; + } + *dst = '\0'; + input = build_string (dst - str, str); + } + else + input = build_string (strlen (buf), buf); + } + else + input = build_string (constraint_len - 1, constraint + 1); + + free (p); + + input = build_tree_list (build_tree_list (NULL_TREE, input), + unshare_expr (TREE_VALUE (link))); + ASM_INPUTS (expr) = chainon (ASM_INPUTS (expr), input); + } } link_next = NULL_TREE; @@ -5062,20 +5049,20 @@ link_next = TREE_CHAIN (link); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); parse_input_constraint (&constraint, 0, 0, noutputs, 0, - oconstraints, &allows_mem, &allows_reg); + oconstraints, &allows_mem, &allows_reg); /* If we can't make copies, we can only accept memory. */ if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (link)))) - { - if (allows_mem) - allows_reg = 0; - else - { - error ("impossible constraint in %<asm%>"); - error ("non-memory input %d must stay in memory", i); - return GS_ERROR; - } - } + { + if (allows_mem) + allows_reg = 0; + else + { + error ("impossible constraint in %<asm%>"); + error ("non-memory input %d must stay in memory", i); + return GS_ERROR; + } + } /* If the operand is a memory input, it should be an lvalue. */ if (!allows_reg && allows_mem) @@ -5099,12 +5086,12 @@ } } else - { - tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p, - is_gimple_asm_val, fb_rvalue); - if (tret == GS_ERROR) - ret = tret; - } + { + tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p, + is_gimple_asm_val, fb_rvalue); + if (tret == GS_ERROR) + ret = tret; + } TREE_CHAIN (link) = NULL_TREE; VEC_safe_push (tree, gc, inputs, link); @@ -5120,7 +5107,7 @@ if (ret != GS_ERROR) { stmt = gimple_build_asm_vec (TREE_STRING_POINTER (ASM_STRING (expr)), - inputs, outputs, clobbers, labels); + inputs, outputs, clobbers, labels); gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr)); gimple_asm_set_input (stmt, ASM_INPUT_P (expr)); @@ -5171,9 +5158,9 @@ gimple wce = gsi_stmt (iter); if (gimple_code (wce) == GIMPLE_WITH_CLEANUP_EXPR) - { - if (gsi_one_before_end_p (iter)) - { + { + if (gsi_one_before_end_p (iter)) + { /* Note that gsi_insert_seq_before and gsi_remove do not scan operands, unlike some other sequence mutators. */ if (!gimple_wce_cleanup_eh_only (wce)) @@ -5199,11 +5186,11 @@ /* Do not use gsi_replace here, as it may scan operands. We want to do a simple structural modification only. */ *gsi_stmt_ptr (&iter) = gtry; - iter = gsi_start (seq); - } - } + iter = gsi_start (seq); + } + } else - gsi_next (&iter); + gsi_next (&iter); } gimplify_seq_add_seq (pre_p, body_sequence); @@ -5237,24 +5224,24 @@ if (gimple_conditional_context ()) { /* If we're in a conditional context, this is more complex. We only - want to run the cleanup if we actually ran the initialization that - necessitates it, but we want to run it after the end of the - conditional context. So we wrap the try/finally around the - condition and use a flag to determine whether or not to actually - run the destructor. Thus - - test ? f(A()) : 0 - - becomes (approximately) - - flag = 0; - try { - if (test) { A::A(temp); flag = 1; val = f(temp); } - else { val = 0; } - } finally { - if (flag) A::~A(temp); - } - val + want to run the cleanup if we actually ran the initialization that + necessitates it, but we want to run it after the end of the + conditional context. So we wrap the try/finally around the + condition and use a flag to determine whether or not to actually + run the destructor. Thus + + test ? f(A()) : 0 + + becomes (approximately) + + flag = 0; + try { + if (test) { A::A(temp); flag = 1; val = f(temp); } + else { val = 0; } + } finally { + if (flag) A::~A(temp); + } + val */ tree flag = create_tmp_var (boolean_type_node, "cleanup"); gimple ffalse = gimple_build_assign (flag, boolean_false_node); @@ -5269,8 +5256,8 @@ gimplify_seq_add_stmt (pre_p, ftrue); /* Because of this manipulation, and the EH edges that jump - threading cannot redirect, the temporary (VAR) will appear - to be used uninitialized. Don't warn. */ + threading cannot redirect, the temporary (VAR) will appear + to be used uninitialized. Don't warn. */ TREE_NO_WARNING (var) = 1; } else @@ -5295,41 +5282,41 @@ if (init) { /* TARGET_EXPR temps aren't part of the enclosing block, so add it - to the temps list. Handle also variable length TARGET_EXPRs. */ + to the temps list. Handle also variable length TARGET_EXPRs. */ if (TREE_CODE (DECL_SIZE (temp)) != INTEGER_CST) - { - if (!TYPE_SIZES_GIMPLIFIED (TREE_TYPE (temp))) - gimplify_type_sizes (TREE_TYPE (temp), pre_p); - gimplify_vla_decl (temp, pre_p); - } + { + if (!TYPE_SIZES_GIMPLIFIED (TREE_TYPE (temp))) + gimplify_type_sizes (TREE_TYPE (temp), pre_p); + gimplify_vla_decl (temp, pre_p); + } else - gimple_add_tmp_var (temp); + gimple_add_tmp_var (temp); /* If TARGET_EXPR_INITIAL is void, then the mere evaluation of the - expression is supposed to initialize the slot. */ + expression is supposed to initialize the slot. */ if (VOID_TYPE_P (TREE_TYPE (init))) - ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none); + ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none); else - { - tree init_expr = build2 (INIT_EXPR, void_type_node, temp, init); - init = init_expr; - ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none); - init = NULL; - ggc_free (init_expr); - } + { + tree init_expr = build2 (INIT_EXPR, void_type_node, temp, init); + init = init_expr; + ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none); + init = NULL; + ggc_free (init_expr); + } if (ret == GS_ERROR) - { - /* PR c++/28266 Make sure this is expanded only once. */ - TARGET_EXPR_INITIAL (targ) = NULL_TREE; - return GS_ERROR; - } + { + /* PR c++/28266 Make sure this is expanded only once. */ + TARGET_EXPR_INITIAL (targ) = NULL_TREE; + return GS_ERROR; + } if (init) - gimplify_and_add (init, pre_p); + gimplify_and_add (init, pre_p); /* If needed, push the cleanup for the temp. */ if (TARGET_EXPR_CLEANUP (targ)) - gimple_push_cleanup (temp, TARGET_EXPR_CLEANUP (targ), - CLEANUP_EH_ONLY (targ), pre_p); + gimple_push_cleanup (temp, TARGET_EXPR_CLEANUP (targ), + CLEANUP_EH_ONLY (targ), pre_p); /* Only expand this once. */ TREE_OPERAND (targ, 3) = init; @@ -5381,14 +5368,14 @@ { n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl); if (n != NULL) - { - if (n->value & GOVD_SHARED) - n->value = GOVD_FIRSTPRIVATE | (n->value & GOVD_SEEN); - else - return; - } + { + if (n->value & GOVD_SHARED) + n->value = GOVD_FIRSTPRIVATE | (n->value & GOVD_SEEN); + else + return; + } else if (ctx->region_type != ORT_WORKSHARE) - omp_add_variable (ctx, decl, GOVD_FIRSTPRIVATE); + omp_add_variable (ctx, decl, GOVD_FIRSTPRIVATE); ctx = ctx->outer_context; } @@ -5473,13 +5460,13 @@ if (n != NULL) { /* We shouldn't be re-adding the decl with the same data - sharing class. */ + sharing class. */ gcc_assert ((n->value & GOVD_DATA_SHARE_CLASS & flags) == 0); /* The only combination of data sharing classes we should see is - FIRSTPRIVATE and LASTPRIVATE. */ + FIRSTPRIVATE and LASTPRIVATE. */ nflags = n->value | flags; gcc_assert ((nflags & GOVD_DATA_SHARE_CLASS) - == (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE)); + == (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE)); n->value = nflags; return; } @@ -5490,32 +5477,32 @@ if (DECL_SIZE (decl) && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST) { /* Add the pointer replacement variable as PRIVATE if the variable - replacement is private, else FIRSTPRIVATE since we'll need the - address of the original variable either for SHARED, or for the - copy into or out of the context. */ + replacement is private, else FIRSTPRIVATE since we'll need the + address of the original variable either for SHARED, or for the + copy into or out of the context. */ if (!(flags & GOVD_LOCAL)) - { - nflags = flags & GOVD_PRIVATE ? GOVD_PRIVATE : GOVD_FIRSTPRIVATE; - nflags |= flags & GOVD_SEEN; - t = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (t) == INDIRECT_REF); - t = TREE_OPERAND (t, 0); - gcc_assert (DECL_P (t)); - omp_add_variable (ctx, t, nflags); - } + { + nflags = flags & GOVD_PRIVATE ? GOVD_PRIVATE : GOVD_FIRSTPRIVATE; + nflags |= flags & GOVD_SEEN; + t = DECL_VALUE_EXPR (decl); + gcc_assert (TREE_CODE (t) == INDIRECT_REF); + t = TREE_OPERAND (t, 0); + gcc_assert (DECL_P (t)); + omp_add_variable (ctx, t, nflags); + } /* Add all of the variable and type parameters (which should have - been gimplified to a formal temporary) as FIRSTPRIVATE. */ + been gimplified to a formal temporary) as FIRSTPRIVATE. */ omp_firstprivatize_variable (ctx, DECL_SIZE_UNIT (decl)); omp_firstprivatize_variable (ctx, DECL_SIZE (decl)); omp_firstprivatize_type_sizes (ctx, TREE_TYPE (decl)); /* The variable-sized variable itself is never SHARED, only some form - of PRIVATE. The sharing would take place via the pointer variable - which we remapped above. */ + of PRIVATE. The sharing would take place via the pointer variable + which we remapped above. */ if (flags & GOVD_SHARED) - flags = GOVD_PRIVATE | GOVD_DEBUG_PRIVATE - | (flags & (GOVD_SEEN | GOVD_EXPLICIT)); + flags = GOVD_PRIVATE | GOVD_DEBUG_PRIVATE + | (flags & (GOVD_SEEN | GOVD_EXPLICIT)); /* We're going to make use of the TYPE_SIZE_UNIT at least in the alloca statement we generate for the variable, so make sure it @@ -5534,13 +5521,13 @@ omp_firstprivatize_type_sizes (ctx, TREE_TYPE (decl)); /* Similar to the direct variable sized case above, we'll need the - size of references being privatized. */ + size of references being privatized. */ if ((flags & GOVD_SHARED) == 0) - { - t = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl))); - if (TREE_CODE (t) != INTEGER_CST) - omp_notice_variable (ctx, t, true); - } + { + t = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl))); + if (TREE_CODE (t) != INTEGER_CST) + omp_notice_variable (ctx, t, true); + } } splay_tree_insert (ctx->variables, (splay_tree_key)decl, flags); @@ -5609,15 +5596,15 @@ struct gimplify_omp_ctx *octx; if (ctx->region_type == ORT_WORKSHARE) - goto do_outer; + goto do_outer; /* ??? Some compiler-generated variables (like SAVE_EXPRs) could be - remapped firstprivate instead of shared. To some extent this is - addressed in omp_firstprivatize_type_sizes, but not effectively. */ + remapped firstprivate instead of shared. To some extent this is + addressed in omp_firstprivatize_type_sizes, but not effectively. */ default_kind = ctx->default_kind; kind = lang_hooks.decls.omp_predetermined_sharing (decl); if (kind != OMP_CLAUSE_DEFAULT_UNSPECIFIED) - default_kind = kind; + default_kind = kind; switch (default_kind) { @@ -5673,8 +5660,8 @@ } if ((flags & GOVD_PRIVATE) - && lang_hooks.decls.omp_private_outer_ref (decl)) - flags |= GOVD_PRIVATE_OUTER_REF; + && lang_hooks.decls.omp_private_outer_ref (decl)) + flags |= GOVD_PRIVATE_OUTER_REF; omp_add_variable (ctx, decl, flags); @@ -5729,32 +5716,32 @@ if (n != NULL) { if (n->value & GOVD_SHARED) - { - if (ctx == gimplify_omp_ctxp) - { - error ("iteration variable %qE should be private", - DECL_NAME (decl)); - n->value = GOVD_PRIVATE; - return true; - } - else - return false; - } + { + if (ctx == gimplify_omp_ctxp) + { + error ("iteration variable %qE should be private", + DECL_NAME (decl)); + n->value = GOVD_PRIVATE; + return true; + } + else + return false; + } else if ((n->value & GOVD_EXPLICIT) != 0 - && (ctx == gimplify_omp_ctxp - || (ctx->region_type == ORT_COMBINED_PARALLEL - && gimplify_omp_ctxp->outer_context == ctx))) - { - if ((n->value & GOVD_FIRSTPRIVATE) != 0) - error ("iteration variable %qE should not be firstprivate", - DECL_NAME (decl)); - else if ((n->value & GOVD_REDUCTION) != 0) - error ("iteration variable %qE should not be reduction", - DECL_NAME (decl)); - } + && (ctx == gimplify_omp_ctxp + || (ctx->region_type == ORT_COMBINED_PARALLEL + && gimplify_omp_ctxp->outer_context == ctx))) + { + if ((n->value & GOVD_FIRSTPRIVATE) != 0) + error ("iteration variable %qE should not be firstprivate", + DECL_NAME (decl)); + else if ((n->value & GOVD_REDUCTION) != 0) + error ("iteration variable %qE should not be reduction", + DECL_NAME (decl)); + } return (ctx == gimplify_omp_ctxp - || (ctx->region_type == ORT_COMBINED_PARALLEL - && gimplify_omp_ctxp->outer_context == ctx)); + || (ctx->region_type == ORT_COMBINED_PARALLEL + && gimplify_omp_ctxp->outer_context == ctx)); } if (ctx->region_type != ORT_WORKSHARE) @@ -5777,13 +5764,13 @@ { ctx = ctx->outer_context; if (ctx == NULL) - return !(is_global_var (decl) - /* References might be private, but might be shared too. */ - || lang_hooks.decls.omp_privatize_by_reference (decl)); + return !(is_global_var (decl) + /* References might be private, but might be shared too. */ + || lang_hooks.decls.omp_privatize_by_reference (decl)); n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); if (n != NULL) - return (n->value & GOVD_SHARED) == 0; + return (n->value & GOVD_SHARED) == 0; } while (ctx->region_type == ORT_WORKSHARE); return false; @@ -5794,7 +5781,7 @@ static void gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, - enum omp_region_type region_type) + enum omp_region_type region_type) { struct gimplify_omp_ctx *ctx, *outer_ctx; struct gimplify_ctx gctx; @@ -5812,142 +5799,142 @@ tree decl; switch (OMP_CLAUSE_CODE (c)) - { - case OMP_CLAUSE_PRIVATE: - flags = GOVD_PRIVATE | GOVD_EXPLICIT; - if (lang_hooks.decls.omp_private_outer_ref (OMP_CLAUSE_DECL (c))) - { - flags |= GOVD_PRIVATE_OUTER_REF; - OMP_CLAUSE_PRIVATE_OUTER_REF (c) = 1; - } - else - notice_outer = false; - goto do_add; - case OMP_CLAUSE_SHARED: - flags = GOVD_SHARED | GOVD_EXPLICIT; - goto do_add; - case OMP_CLAUSE_FIRSTPRIVATE: - flags = GOVD_FIRSTPRIVATE | GOVD_EXPLICIT; - check_non_private = "firstprivate"; - goto do_add; - case OMP_CLAUSE_LASTPRIVATE: - flags = GOVD_LASTPRIVATE | GOVD_SEEN | GOVD_EXPLICIT; - check_non_private = "lastprivate"; - goto do_add; - case OMP_CLAUSE_REDUCTION: - flags = GOVD_REDUCTION | GOVD_SEEN | GOVD_EXPLICIT; - check_non_private = "reduction"; - goto do_add; - - do_add: - decl = OMP_CLAUSE_DECL (c); - if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node) - { - remove = true; - break; - } - omp_add_variable (ctx, decl, flags); - if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION - && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)) - { - omp_add_variable (ctx, OMP_CLAUSE_REDUCTION_PLACEHOLDER (c), - GOVD_LOCAL | GOVD_SEEN); - gimplify_omp_ctxp = ctx; - push_gimplify_context (&gctx); - - OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c) = gimple_seq_alloc (); - OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c) = gimple_seq_alloc (); - - gimplify_and_add (OMP_CLAUSE_REDUCTION_INIT (c), - &OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c)); - pop_gimplify_context - (gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c))); - push_gimplify_context (&gctx); - gimplify_and_add (OMP_CLAUSE_REDUCTION_MERGE (c), - &OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c)); - pop_gimplify_context - (gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c))); - OMP_CLAUSE_REDUCTION_INIT (c) = NULL_TREE; - OMP_CLAUSE_REDUCTION_MERGE (c) = NULL_TREE; - - gimplify_omp_ctxp = outer_ctx; - } - else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE - && OMP_CLAUSE_LASTPRIVATE_STMT (c)) - { - gimplify_omp_ctxp = ctx; - push_gimplify_context (&gctx); - if (TREE_CODE (OMP_CLAUSE_LASTPRIVATE_STMT (c)) != BIND_EXPR) - { - tree bind = build3 (BIND_EXPR, void_type_node, NULL, - NULL, NULL); - TREE_SIDE_EFFECTS (bind) = 1; - BIND_EXPR_BODY (bind) = OMP_CLAUSE_LASTPRIVATE_STMT (c); - OMP_CLAUSE_LASTPRIVATE_STMT (c) = bind; - } - gimplify_and_add (OMP_CLAUSE_LASTPRIVATE_STMT (c), - &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)); - pop_gimplify_context - (gimple_seq_first_stmt (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c))); - OMP_CLAUSE_LASTPRIVATE_STMT (c) = NULL_TREE; - - gimplify_omp_ctxp = outer_ctx; - } - if (notice_outer) - goto do_notice; - break; - - case OMP_CLAUSE_COPYIN: - case OMP_CLAUSE_COPYPRIVATE: - decl = OMP_CLAUSE_DECL (c); - if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node) - { - remove = true; - break; - } - do_notice: - if (outer_ctx) - omp_notice_variable (outer_ctx, decl, true); - if (check_non_private - && region_type == ORT_WORKSHARE - && omp_check_private (ctx, decl)) - { - error ("%s variable %qE is private in outer context", - check_non_private, DECL_NAME (decl)); - remove = true; - } - break; - - case OMP_CLAUSE_IF: - OMP_CLAUSE_OPERAND (c, 0) - = gimple_boolify (OMP_CLAUSE_OPERAND (c, 0)); - /* Fall through. */ - - case OMP_CLAUSE_SCHEDULE: - case OMP_CLAUSE_NUM_THREADS: - if (gimplify_expr (&OMP_CLAUSE_OPERAND (c, 0), pre_p, NULL, - is_gimple_val, fb_rvalue) == GS_ERROR) - remove = true; - break; - - case OMP_CLAUSE_NOWAIT: - case OMP_CLAUSE_ORDERED: - case OMP_CLAUSE_UNTIED: - case OMP_CLAUSE_COLLAPSE: - break; - - case OMP_CLAUSE_DEFAULT: - ctx->default_kind = OMP_CLAUSE_DEFAULT_KIND (c); - break; - - default: - gcc_unreachable (); - } + { + case OMP_CLAUSE_PRIVATE: + flags = GOVD_PRIVATE | GOVD_EXPLICIT; + if (lang_hooks.decls.omp_private_outer_ref (OMP_CLAUSE_DECL (c))) + { + flags |= GOVD_PRIVATE_OUTER_REF; + OMP_CLAUSE_PRIVATE_OUTER_REF (c) = 1; + } + else + notice_outer = false; + goto do_add; + case OMP_CLAUSE_SHARED: + flags = GOVD_SHARED | GOVD_EXPLICIT; + goto do_add; + case OMP_CLAUSE_FIRSTPRIVATE: + flags = GOVD_FIRSTPRIVATE | GOVD_EXPLICIT; + check_non_private = "firstprivate"; + goto do_add; + case OMP_CLAUSE_LASTPRIVATE: + flags = GOVD_LASTPRIVATE | GOVD_SEEN | GOVD_EXPLICIT; + check_non_private = "lastprivate"; + goto do_add; + case OMP_CLAUSE_REDUCTION: + flags = GOVD_REDUCTION | GOVD_SEEN | GOVD_EXPLICIT; + check_non_private = "reduction"; + goto do_add; + + do_add: + decl = OMP_CLAUSE_DECL (c); + if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node) + { + remove = true; + break; + } + omp_add_variable (ctx, decl, flags); + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION + && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)) + { + omp_add_variable (ctx, OMP_CLAUSE_REDUCTION_PLACEHOLDER (c), + GOVD_LOCAL | GOVD_SEEN); + gimplify_omp_ctxp = ctx; + push_gimplify_context (&gctx); + + OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c) = gimple_seq_alloc (); + OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c) = gimple_seq_alloc (); + + gimplify_and_add (OMP_CLAUSE_REDUCTION_INIT (c), + &OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c)); + pop_gimplify_context + (gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c))); + push_gimplify_context (&gctx); + gimplify_and_add (OMP_CLAUSE_REDUCTION_MERGE (c), + &OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c)); + pop_gimplify_context + (gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c))); + OMP_CLAUSE_REDUCTION_INIT (c) = NULL_TREE; + OMP_CLAUSE_REDUCTION_MERGE (c) = NULL_TREE; + + gimplify_omp_ctxp = outer_ctx; + } + else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE + && OMP_CLAUSE_LASTPRIVATE_STMT (c)) + { + gimplify_omp_ctxp = ctx; + push_gimplify_context (&gctx); + if (TREE_CODE (OMP_CLAUSE_LASTPRIVATE_STMT (c)) != BIND_EXPR) + { + tree bind = build3 (BIND_EXPR, void_type_node, NULL, + NULL, NULL); + TREE_SIDE_EFFECTS (bind) = 1; + BIND_EXPR_BODY (bind) = OMP_CLAUSE_LASTPRIVATE_STMT (c); + OMP_CLAUSE_LASTPRIVATE_STMT (c) = bind; + } + gimplify_and_add (OMP_CLAUSE_LASTPRIVATE_STMT (c), + &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)); + pop_gimplify_context + (gimple_seq_first_stmt (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c))); + OMP_CLAUSE_LASTPRIVATE_STMT (c) = NULL_TREE; + + gimplify_omp_ctxp = outer_ctx; + } + if (notice_outer) + goto do_notice; + break; + + case OMP_CLAUSE_COPYIN: + case OMP_CLAUSE_COPYPRIVATE: + decl = OMP_CLAUSE_DECL (c); + if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node) + { + remove = true; + break; + } + do_notice: + if (outer_ctx) + omp_notice_variable (outer_ctx, decl, true); + if (check_non_private + && region_type == ORT_WORKSHARE + && omp_check_private (ctx, decl)) + { + error ("%s variable %qE is private in outer context", + check_non_private, DECL_NAME (decl)); + remove = true; + } + break; + + case OMP_CLAUSE_IF: + OMP_CLAUSE_OPERAND (c, 0) + = gimple_boolify (OMP_CLAUSE_OPERAND (c, 0)); + /* Fall through. */ + + case OMP_CLAUSE_SCHEDULE: + case OMP_CLAUSE_NUM_THREADS: + if (gimplify_expr (&OMP_CLAUSE_OPERAND (c, 0), pre_p, NULL, + is_gimple_val, fb_rvalue) == GS_ERROR) + remove = true; + break; + + case OMP_CLAUSE_NOWAIT: + case OMP_CLAUSE_ORDERED: + case OMP_CLAUSE_UNTIED: + case OMP_CLAUSE_COLLAPSE: + break; + + case OMP_CLAUSE_DEFAULT: + ctx->default_kind = OMP_CLAUSE_DEFAULT_KIND (c); + break; + + default: + gcc_unreachable (); + } if (remove) - *list_p = OMP_CLAUSE_CHAIN (c); + *list_p = OMP_CLAUSE_CHAIN (c); else - list_p = &OMP_CLAUSE_CHAIN (c); + list_p = &OMP_CLAUSE_CHAIN (c); } gimplify_omp_ctxp = ctx; @@ -5978,26 +5965,26 @@ else private_debug = lang_hooks.decls.omp_private_debug_clause (decl, - !!(flags & GOVD_SHARED)); + !!(flags & GOVD_SHARED)); if (private_debug) code = OMP_CLAUSE_PRIVATE; else if (flags & GOVD_SHARED) { if (is_global_var (decl)) - { - struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp->outer_context; - while (ctx != NULL) - { - splay_tree_node on - = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); - if (on && (on->value & (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE - | GOVD_PRIVATE | GOVD_REDUCTION)) != 0) - break; - ctx = ctx->outer_context; - } - if (ctx == NULL) - return 0; - } + { + struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp->outer_context; + while (ctx != NULL) + { + splay_tree_node on + = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); + if (on && (on->value & (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE + | GOVD_PRIVATE | GOVD_REDUCTION)) != 0) + break; + ctx = ctx->outer_context; + } + if (ctx == NULL) + return 0; + } code = OMP_CLAUSE_SHARED; } else if (flags & GOVD_PRIVATE) @@ -6032,58 +6019,58 @@ bool remove = false; switch (OMP_CLAUSE_CODE (c)) - { - case OMP_CLAUSE_PRIVATE: - case OMP_CLAUSE_SHARED: - case OMP_CLAUSE_FIRSTPRIVATE: - decl = OMP_CLAUSE_DECL (c); - n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); - remove = !(n->value & GOVD_SEEN); - if (! remove) - { - bool shared = OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED; - if ((n->value & GOVD_DEBUG_PRIVATE) - || lang_hooks.decls.omp_private_debug_clause (decl, shared)) - { - gcc_assert ((n->value & GOVD_DEBUG_PRIVATE) == 0 - || ((n->value & GOVD_DATA_SHARE_CLASS) - == GOVD_PRIVATE)); - OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_PRIVATE); - OMP_CLAUSE_PRIVATE_DEBUG (c) = 1; - } - } - break; - - case OMP_CLAUSE_LASTPRIVATE: - /* Make sure OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE is set to - accurately reflect the presence of a FIRSTPRIVATE clause. */ - decl = OMP_CLAUSE_DECL (c); - n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); - OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c) - = (n->value & GOVD_FIRSTPRIVATE) != 0; - break; - - case OMP_CLAUSE_REDUCTION: - case OMP_CLAUSE_COPYIN: - case OMP_CLAUSE_COPYPRIVATE: - case OMP_CLAUSE_IF: - case OMP_CLAUSE_NUM_THREADS: - case OMP_CLAUSE_SCHEDULE: - case OMP_CLAUSE_NOWAIT: - case OMP_CLAUSE_ORDERED: - case OMP_CLAUSE_DEFAULT: - case OMP_CLAUSE_UNTIED: - case OMP_CLAUSE_COLLAPSE: - break; - - default: - gcc_unreachable (); - } + { + case OMP_CLAUSE_PRIVATE: + case OMP_CLAUSE_SHARED: + case OMP_CLAUSE_FIRSTPRIVATE: + decl = OMP_CLAUSE_DECL (c); + n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); + remove = !(n->value & GOVD_SEEN); + if (! remove) + { + bool shared = OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED; + if ((n->value & GOVD_DEBUG_PRIVATE) + || lang_hooks.decls.omp_private_debug_clause (decl, shared)) + { + gcc_assert ((n->value & GOVD_DEBUG_PRIVATE) == 0 + || ((n->value & GOVD_DATA_SHARE_CLASS) + == GOVD_PRIVATE)); + OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_PRIVATE); + OMP_CLAUSE_PRIVATE_DEBUG (c) = 1; + } + } + break; + + case OMP_CLAUSE_LASTPRIVATE: + /* Make sure OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE is set to + accurately reflect the presence of a FIRSTPRIVATE clause. */ + decl = OMP_CLAUSE_DECL (c); + n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); + OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c) + = (n->value & GOVD_FIRSTPRIVATE) != 0; + break; + + case OMP_CLAUSE_REDUCTION: + case OMP_CLAUSE_COPYIN: + case OMP_CLAUSE_COPYPRIVATE: + case OMP_CLAUSE_IF: + case OMP_CLAUSE_NUM_THREADS: + case OMP_CLAUSE_SCHEDULE: + case OMP_CLAUSE_NOWAIT: + case OMP_CLAUSE_ORDERED: + case OMP_CLAUSE_DEFAULT: + case OMP_CLAUSE_UNTIED: + case OMP_CLAUSE_COLLAPSE: + break; + + default: + gcc_unreachable (); + } if (remove) - *list_p = OMP_CLAUSE_CHAIN (c); + *list_p = OMP_CLAUSE_CHAIN (c); else - list_p = &OMP_CLAUSE_CHAIN (c); + list_p = &OMP_CLAUSE_CHAIN (c); } /* Add in any implicit data sharing. */ @@ -6107,9 +6094,9 @@ struct gimplify_ctx gctx; gimplify_scan_omp_clauses (&OMP_PARALLEL_CLAUSES (expr), pre_p, - OMP_PARALLEL_COMBINED (expr) - ? ORT_COMBINED_PARALLEL - : ORT_PARALLEL); + OMP_PARALLEL_COMBINED (expr) + ? ORT_COMBINED_PARALLEL + : ORT_PARALLEL); push_gimplify_context (&gctx); @@ -6122,8 +6109,8 @@ gimplify_adjust_omp_clauses (&OMP_PARALLEL_CLAUSES (expr)); g = gimple_build_omp_parallel (body, - OMP_PARALLEL_CLAUSES (expr), - NULL_TREE, NULL_TREE); + OMP_PARALLEL_CLAUSES (expr), + NULL_TREE, NULL_TREE); if (OMP_PARALLEL_COMBINED (expr)) gimple_omp_set_subcode (g, GF_OMP_PARALLEL_COMBINED); gimplify_seq_add_stmt (pre_p, g); @@ -6159,9 +6146,9 @@ gimplify_adjust_omp_clauses (&OMP_TASK_CLAUSES (expr)); g = gimple_build_omp_task (body, - OMP_TASK_CLAUSES (expr), - NULL_TREE, NULL_TREE, - NULL_TREE, NULL_TREE, NULL_TREE); + OMP_TASK_CLAUSES (expr), + NULL_TREE, NULL_TREE, + NULL_TREE, NULL_TREE, NULL_TREE); gimplify_seq_add_stmt (pre_p, g); *expr_p = NULL_TREE; } @@ -6181,7 +6168,7 @@ for_stmt = *expr_p; gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p, - ORT_WORKSHARE); + ORT_WORKSHARE); /* Handle OMP_FOR_INIT. */ for_pre_body = NULL; @@ -6190,9 +6177,9 @@ for_body = gimple_seq_alloc (); gcc_assert (TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)) - == TREE_VEC_LENGTH (OMP_FOR_COND (for_stmt))); + == TREE_VEC_LENGTH (OMP_FOR_COND (for_stmt))); gcc_assert (TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)) - == TREE_VEC_LENGTH (OMP_FOR_INCR (for_stmt))); + == TREE_VEC_LENGTH (OMP_FOR_INCR (for_stmt))); for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)); i++) { t = TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), i); @@ -6200,34 +6187,34 @@ decl = TREE_OPERAND (t, 0); gcc_assert (DECL_P (decl)); gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (decl)) - || POINTER_TYPE_P (TREE_TYPE (decl))); + || POINTER_TYPE_P (TREE_TYPE (decl))); /* Make sure the iteration variable is private. */ if (omp_is_private (gimplify_omp_ctxp, decl)) - omp_notice_variable (gimplify_omp_ctxp, decl, true); + omp_notice_variable (gimplify_omp_ctxp, decl, true); else - omp_add_variable (gimplify_omp_ctxp, decl, GOVD_PRIVATE | GOVD_SEEN); + omp_add_variable (gimplify_omp_ctxp, decl, GOVD_PRIVATE | GOVD_SEEN); /* If DECL is not a gimple register, create a temporary variable to act - as an iteration counter. This is valid, since DECL cannot be - modified in the body of the loop. */ + as an iteration counter. This is valid, since DECL cannot be + modified in the body of the loop. */ if (!is_gimple_reg (decl)) - { - var = create_tmp_var (TREE_TYPE (decl), get_name (decl)); - TREE_OPERAND (t, 0) = var; - - gimplify_seq_add_stmt (&for_body, gimple_build_assign (decl, var)); - - omp_add_variable (gimplify_omp_ctxp, var, GOVD_PRIVATE | GOVD_SEEN); - } + { + var = create_tmp_var (TREE_TYPE (decl), get_name (decl)); + TREE_OPERAND (t, 0) = var; + + gimplify_seq_add_stmt (&for_body, gimple_build_assign (decl, var)); + + omp_add_variable (gimplify_omp_ctxp, var, GOVD_PRIVATE | GOVD_SEEN); + } else - var = decl; + var = decl; tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); ret = MIN (ret, tret); if (ret == GS_ERROR) - return ret; + return ret; /* Handle OMP_FOR_COND. */ t = TREE_VEC_ELT (OMP_FOR_COND (for_stmt), i); @@ -6235,85 +6222,85 @@ gcc_assert (TREE_OPERAND (t, 0) == decl); tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); ret = MIN (ret, tret); /* Handle OMP_FOR_INCR. */ t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i); switch (TREE_CODE (t)) - { - case PREINCREMENT_EXPR: - case POSTINCREMENT_EXPR: - t = build_int_cst (TREE_TYPE (decl), 1); - t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t); - t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t); - TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t; - break; - - case PREDECREMENT_EXPR: - case POSTDECREMENT_EXPR: - t = build_int_cst (TREE_TYPE (decl), -1); - t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t); - t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t); - TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t; - break; - - case MODIFY_EXPR: - gcc_assert (TREE_OPERAND (t, 0) == decl); - TREE_OPERAND (t, 0) = var; - - t = TREE_OPERAND (t, 1); - switch (TREE_CODE (t)) - { - case PLUS_EXPR: - if (TREE_OPERAND (t, 1) == decl) - { - TREE_OPERAND (t, 1) = TREE_OPERAND (t, 0); - TREE_OPERAND (t, 0) = var; - break; - } - - /* Fallthru. */ - case MINUS_EXPR: - case POINTER_PLUS_EXPR: - gcc_assert (TREE_OPERAND (t, 0) == decl); - TREE_OPERAND (t, 0) = var; - break; - default: - gcc_unreachable (); - } - - tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, - is_gimple_val, fb_rvalue); - ret = MIN (ret, tret); - break; - - default: - gcc_unreachable (); - } + { + case PREINCREMENT_EXPR: + case POSTINCREMENT_EXPR: + t = build_int_cst (TREE_TYPE (decl), 1); + t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t); + TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t; + break; + + case PREDECREMENT_EXPR: + case POSTDECREMENT_EXPR: + t = build_int_cst (TREE_TYPE (decl), -1); + t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t); + TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t; + break; + + case MODIFY_EXPR: + gcc_assert (TREE_OPERAND (t, 0) == decl); + TREE_OPERAND (t, 0) = var; + + t = TREE_OPERAND (t, 1); + switch (TREE_CODE (t)) + { + case PLUS_EXPR: + if (TREE_OPERAND (t, 1) == decl) + { + TREE_OPERAND (t, 1) = TREE_OPERAND (t, 0); + TREE_OPERAND (t, 0) = var; + break; + } + + /* Fallthru. */ + case MINUS_EXPR: + case POINTER_PLUS_EXPR: + gcc_assert (TREE_OPERAND (t, 0) == decl); + TREE_OPERAND (t, 0) = var; + break; + default: + gcc_unreachable (); + } + + tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, + is_gimple_val, fb_rvalue); + ret = MIN (ret, tret); + break; + + default: + gcc_unreachable (); + } if (var != decl || TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)) > 1) - { - tree c; - for (c = OMP_FOR_CLAUSES (for_stmt); c ; c = OMP_CLAUSE_CHAIN (c)) - if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE - && OMP_CLAUSE_DECL (c) == decl - && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c) == NULL) - { - t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i); - gcc_assert (TREE_CODE (t) == MODIFY_EXPR); - gcc_assert (TREE_OPERAND (t, 0) == var); - t = TREE_OPERAND (t, 1); - gcc_assert (TREE_CODE (t) == PLUS_EXPR - || TREE_CODE (t) == MINUS_EXPR - || TREE_CODE (t) == POINTER_PLUS_EXPR); - gcc_assert (TREE_OPERAND (t, 0) == var); - t = build2 (TREE_CODE (t), TREE_TYPE (decl), decl, - TREE_OPERAND (t, 1)); - gimplify_assign (decl, t, - &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)); - } - } + { + tree c; + for (c = OMP_FOR_CLAUSES (for_stmt); c ; c = OMP_CLAUSE_CHAIN (c)) + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE + && OMP_CLAUSE_DECL (c) == decl + && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c) == NULL) + { + t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i); + gcc_assert (TREE_CODE (t) == MODIFY_EXPR); + gcc_assert (TREE_OPERAND (t, 0) == var); + t = TREE_OPERAND (t, 1); + gcc_assert (TREE_CODE (t) == PLUS_EXPR + || TREE_CODE (t) == MINUS_EXPR + || TREE_CODE (t) == POINTER_PLUS_EXPR); + gcc_assert (TREE_OPERAND (t, 0) == var); + t = build2 (TREE_CODE (t), TREE_TYPE (decl), decl, + TREE_OPERAND (t, 1)); + gimplify_assign (decl, t, + &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)); + } + } } gimplify_and_add (OMP_FOR_BODY (for_stmt), &for_body); @@ -6321,8 +6308,8 @@ gimplify_adjust_omp_clauses (&OMP_FOR_CLAUSES (for_stmt)); gfor = gimple_build_omp_for (for_body, OMP_FOR_CLAUSES (for_stmt), - TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)), - for_pre_body); + TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)), + for_pre_body); for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)); i++) { @@ -6380,19 +6367,19 @@ { expr = TREE_OPERAND (expr, 0); while (expr != addr - && (CONVERT_EXPR_P (expr) - || TREE_CODE (expr) == NON_LVALUE_EXPR) - && TREE_CODE (expr) == TREE_CODE (addr) - && types_compatible_p (TREE_TYPE (expr), TREE_TYPE (addr))) - { - expr = TREE_OPERAND (expr, 0); - addr = TREE_OPERAND (addr, 0); - } + && (CONVERT_EXPR_P (expr) + || TREE_CODE (expr) == NON_LVALUE_EXPR) + && TREE_CODE (expr) == TREE_CODE (addr) + && types_compatible_p (TREE_TYPE (expr), TREE_TYPE (addr))) + { + expr = TREE_OPERAND (expr, 0); + addr = TREE_OPERAND (addr, 0); + } if (expr == addr) - return true; + return true; return (TREE_CODE (addr) == ADDR_EXPR - && TREE_CODE (expr) == ADDR_EXPR - && TREE_OPERAND (addr, 0) == TREE_OPERAND (expr, 0)); + && TREE_CODE (expr) == ADDR_EXPR + && TREE_OPERAND (addr, 0) == TREE_OPERAND (expr, 0)); } if (TREE_CODE (addr) == ADDR_EXPR && expr == TREE_OPERAND (addr, 0)) return true; @@ -6406,7 +6393,7 @@ static int goa_stabilize_expr (tree *expr_p, gimple_seq *pre_p, tree lhs_addr, - tree lhs_var) + tree lhs_var) { tree expr = *expr_p; int saw_lhs; @@ -6425,10 +6412,10 @@ case tcc_binary: case tcc_comparison: saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 1), pre_p, lhs_addr, - lhs_var); + lhs_var); case tcc_unary: saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 0), pre_p, lhs_addr, - lhs_var); + lhs_var); break; case tcc_expression: switch (TREE_CODE (expr)) @@ -6451,17 +6438,13 @@ default: break; } - break; - default: - break; - } if (saw_lhs == 0) { enum gimplify_status gs; gs = gimplify_expr (expr_p, pre_p, NULL, is_gimple_val, fb_rvalue); if (gs != GS_ALL_DONE) - saw_lhs = -1; + saw_lhs = -1; } return saw_lhs; @@ -6537,19 +6520,19 @@ the inner expression, so if a separate POST sequence was not used, the resulting sequence would be: - 1 t.1 = *p - 2 p = p - 1 - 3 t.2 = t.1 + 1 - 4 *p = t.2 + 1 t.1 = *p + 2 p = p - 1 + 3 t.2 = t.1 + 1 + 4 *p = t.2 However, the post-decrement operation in line #2 must not be evaluated until after the store to *p at line #4, so the correct sequence should be: - 1 t.1 = *p - 2 t.2 = t.1 + 1 - 3 *p = t.2 - 4 p = p - 1 + 1 t.1 = *p + 2 t.2 = t.1 + 1 + 3 *p = t.2 + 4 p = p - 1 So, by specifying a separate post queue, it is possible to emit the post side-effects in the correct order. @@ -6578,7 +6561,7 @@ enum gimplify_status gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, - bool (*gimple_test_f) (tree), fallback_t fallback) + bool (*gimple_test_f) (tree), fallback_t fallback) { tree tmp; gimple_seq internal_pre = NULL; @@ -6612,7 +6595,7 @@ || gimple_test_f == is_gimple_mem_ref_addr) gcc_assert (fallback & fb_rvalue); else if (gimple_test_f == is_gimple_min_lval - || gimple_test_f == is_gimple_lvalue) + || gimple_test_f == is_gimple_lvalue) gcc_assert (fallback & fb_lvalue); else if (gimple_test_f == is_gimple_addressable) gcc_assert (fallback & fb_either); @@ -6621,8 +6604,8 @@ else { /* We should have recognized the GIMPLE_TEST_F predicate to - know what kind of fallback to use in case a temporary is - needed to hold the value or address of *EXPR_P. */ + know what kind of fallback to use in case a temporary is + needed to hold the value or address of *EXPR_P. */ gcc_unreachable (); } @@ -6657,7 +6640,7 @@ do { /* Strip away as many useless type conversions as possible - at the toplevel. */ + at the toplevel. */ STRIP_USELESS_TYPE_CONVERSION (*expr_p); /* Remember the expr. */ @@ -6665,25 +6648,25 @@ /* Die, die, die, my darling. */ if (save_expr == error_mark_node - || (TREE_TYPE (save_expr) - && TREE_TYPE (save_expr) == error_mark_node)) - { - ret = GS_ERROR; - break; - } + || (TREE_TYPE (save_expr) + && TREE_TYPE (save_expr) == error_mark_node)) + { + ret = GS_ERROR; + break; + } /* Do any language-specific gimplification. */ ret = ((enum gimplify_status) - lang_hooks.gimplify_expr (expr_p, pre_p, post_p)); + lang_hooks.gimplify_expr (expr_p, pre_p, post_p)); if (ret == GS_OK) - { - if (*expr_p == NULL_TREE) - break; - if (*expr_p != save_expr) - continue; - } + { + if (*expr_p == NULL_TREE) + break; + if (*expr_p != save_expr) + continue; + } else if (ret != GS_UNHANDLED) - break; + break; /* Make sure that all the cases set 'ret' appropriately. */ ret = GS_UNHANDLED; @@ -7324,7 +7307,7 @@ if (ret == GS_ERROR) { if (is_statement) - *expr_p = NULL; + *expr_p = NULL; goto out; } @@ -7335,67 +7318,67 @@ if (fallback == fb_none && *expr_p && !is_gimple_stmt (*expr_p)) { /* We aren't looking for a value, and we don't have a valid - statement. If it doesn't have side-effects, throw it away. */ + statement. If it doesn't have side-effects, throw it away. */ if (!TREE_SIDE_EFFECTS (*expr_p)) - *expr_p = NULL; + *expr_p = NULL; else if (!TREE_THIS_VOLATILE (*expr_p)) - { - /* This is probably a _REF that contains something nested that - has side effects. Recurse through the operands to find it. */ - enum tree_code code = TREE_CODE (*expr_p); - - switch (code) - { - case COMPONENT_REF: - case REALPART_EXPR: - case IMAGPART_EXPR: - case VIEW_CONVERT_EXPR: - gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, - gimple_test_f, fallback); - break; - - case ARRAY_REF: - case ARRAY_RANGE_REF: - gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, - gimple_test_f, fallback); - gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p, - gimple_test_f, fallback); - break; - - default: - /* Anything else with side-effects must be converted to - a valid statement before we get here. */ - gcc_unreachable (); - } - - *expr_p = NULL; - } + { + /* This is probably a _REF that contains something nested that + has side effects. Recurse through the operands to find it. */ + enum tree_code code = TREE_CODE (*expr_p); + + switch (code) + { + case COMPONENT_REF: + case REALPART_EXPR: + case IMAGPART_EXPR: + case VIEW_CONVERT_EXPR: + gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, + gimple_test_f, fallback); + break; + + case ARRAY_REF: + case ARRAY_RANGE_REF: + gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, + gimple_test_f, fallback); + gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p, + gimple_test_f, fallback); + break; + + default: + /* Anything else with side-effects must be converted to + a valid statement before we get here. */ + gcc_unreachable (); + } + + *expr_p = NULL; + } else if (COMPLETE_TYPE_P (TREE_TYPE (*expr_p)) - && TYPE_MODE (TREE_TYPE (*expr_p)) != BLKmode) - { - /* Historically, the compiler has treated a bare reference - to a non-BLKmode volatile lvalue as forcing a load. */ - tree type = TYPE_MAIN_VARIANT (TREE_TYPE (*expr_p)); - - /* Normally, we do not want to create a temporary for a - TREE_ADDRESSABLE type because such a type should not be - copied by bitwise-assignment. However, we make an - exception here, as all we are doing here is ensuring that - we read the bytes that make up the type. We use - create_tmp_var_raw because create_tmp_var will abort when - given a TREE_ADDRESSABLE type. */ - tree tmp = create_tmp_var_raw (type, "vol"); - gimple_add_tmp_var (tmp); - gimplify_assign (tmp, *expr_p, pre_p); - *expr_p = NULL; - } + && TYPE_MODE (TREE_TYPE (*expr_p)) != BLKmode) + { + /* Historically, the compiler has treated a bare reference + to a non-BLKmode volatile lvalue as forcing a load. */ + tree type = TYPE_MAIN_VARIANT (TREE_TYPE (*expr_p)); + + /* Normally, we do not want to create a temporary for a + TREE_ADDRESSABLE type because such a type should not be + copied by bitwise-assignment. However, we make an + exception here, as all we are doing here is ensuring that + we read the bytes that make up the type. We use + create_tmp_var_raw because create_tmp_var will abort when + given a TREE_ADDRESSABLE type. */ + tree tmp = create_tmp_var_raw (type, "vol"); + gimple_add_tmp_var (tmp); + gimplify_assign (tmp, *expr_p, pre_p); + *expr_p = NULL; + } else - /* We can't do anything useful with a volatile reference to - an incomplete type, so just throw it away. Likewise for - a BLKmode type, since any implicit inner load should - already have been turned into an explicit one by the - gimplification process. */ - *expr_p = NULL; + /* We can't do anything useful with a volatile reference to + an incomplete type, so just throw it away. Likewise for + a BLKmode type, since any implicit inner load should + already have been turned into an explicit one by the + gimplification process. */ + *expr_p = NULL; } /* If we are gimplifying at the statement level, we're done. Tack @@ -7407,22 +7390,22 @@ *expr_p = NULL_TREE; if (!gimple_seq_empty_p (internal_pre) - || !gimple_seq_empty_p (internal_post)) - { - gimplify_seq_add_seq (&internal_pre, internal_post); - gimplify_seq_add_seq (pre_p, internal_pre); - } + || !gimple_seq_empty_p (internal_post)) + { + gimplify_seq_add_seq (&internal_pre, internal_post); + gimplify_seq_add_seq (pre_p, internal_pre); + } /* The result of gimplifying *EXPR_P is going to be the last few - statements in *PRE_P and *POST_P. Add location information - to all the statements that were added by the gimplification - helpers. */ + statements in *PRE_P and *POST_P. Add location information + to all the statements that were added by the gimplification + helpers. */ if (!gimple_seq_empty_p (*pre_p)) - annotate_all_with_location_after (*pre_p, pre_last_gsi, input_location); + annotate_all_with_location_after (*pre_p, pre_last_gsi, input_location); if (!gimple_seq_empty_p (*post_p)) - annotate_all_with_location_after (*post_p, post_last_gsi, - input_location); + annotate_all_with_location_after (*post_p, post_last_gsi, + input_location); goto out; } @@ -7433,24 +7416,24 @@ enum tree_code code = TREE_CODE (*expr_p); /* These expressions should already be in gimple IR form. */ gcc_assert (code != MODIFY_EXPR - && code != ASM_EXPR - && code != BIND_EXPR - && code != CATCH_EXPR - && (code != COND_EXPR || gimplify_ctxp->allow_rhs_cond_expr) - && code != EH_FILTER_EXPR - && code != GOTO_EXPR - && code != LABEL_EXPR - && code != LOOP_EXPR - && code != SWITCH_EXPR - && code != TRY_FINALLY_EXPR - && code != OMP_CRITICAL - && code != OMP_FOR - && code != OMP_MASTER - && code != OMP_ORDERED - && code != OMP_PARALLEL - && code != OMP_SECTIONS - && code != OMP_SECTION - && code != OMP_SINGLE); + && code != ASM_EXPR + && code != BIND_EXPR + && code != CATCH_EXPR + && (code != COND_EXPR || gimplify_ctxp->allow_rhs_cond_expr) + && code != EH_FILTER_EXPR + && code != GOTO_EXPR + && code != LABEL_EXPR + && code != LOOP_EXPR + && code != SWITCH_EXPR + && code != TRY_FINALLY_EXPR + && code != OMP_CRITICAL + && code != OMP_FOR + && code != OMP_MASTER + && code != OMP_ORDERED + && code != OMP_PARALLEL + && code != OMP_SECTIONS + && code != OMP_SECTION + && code != OMP_SINGLE); } #endif @@ -7474,8 +7457,8 @@ && is_gimple_addressable (*expr_p)) { /* An lvalue will do. Take the address of the expression, store it - in a temporary, and replace the expression with an INDIRECT_REF of - that temporary. */ + in a temporary, and replace the expression with an INDIRECT_REF of + that temporary. */ tmp = build_fold_addr_expr_loc (input_location, *expr_p); gimplify_expr (&tmp, pre_p, post_p, is_gimple_reg, fb_rvalue); *expr_p = build_simple_mem_ref (tmp); @@ -7483,40 +7466,40 @@ else if ((fallback & fb_rvalue) && is_gimple_reg_rhs_or_call (*expr_p)) { /* An rvalue will do. Assign the gimplified expression into a - new temporary TMP and replace the original expression with - TMP. First, make sure that the expression has a type so that - it can be assigned into a temporary. */ + new temporary TMP and replace the original expression with + TMP. First, make sure that the expression has a type so that + it can be assigned into a temporary. */ gcc_assert (!VOID_TYPE_P (TREE_TYPE (*expr_p))); if (!gimple_seq_empty_p (internal_post) || (fallback & fb_lvalue)) - /* The postqueue might change the value of the expression between - the initialization and use of the temporary, so we can't use a - formal temp. FIXME do we care? */ - { - *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p); - if (TREE_CODE (TREE_TYPE (*expr_p)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (*expr_p)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (*expr_p) = 1; - } + /* The postqueue might change the value of the expression between + the initialization and use of the temporary, so we can't use a + formal temp. FIXME do we care? */ + { + *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p); + if (TREE_CODE (TREE_TYPE (*expr_p)) == COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (*expr_p)) == VECTOR_TYPE) + DECL_GIMPLE_REG_P (*expr_p) = 1; + } else - *expr_p = get_formal_tmp_var (*expr_p, pre_p); + *expr_p = get_formal_tmp_var (*expr_p, pre_p); } else { #ifdef ENABLE_GIMPLE_CHECKING if (!(fallback & fb_mayfail)) - { - fprintf (stderr, "gimplification failed:\n"); - print_generic_expr (stderr, *expr_p, 0); - debug_tree (*expr_p); - internal_error ("gimplification failed"); - } + { + fprintf (stderr, "gimplification failed:\n"); + print_generic_expr (stderr, *expr_p, 0); + debug_tree (*expr_p); + internal_error ("gimplification failed"); + } #endif gcc_assert (fallback & fb_mayfail); /* If this is an asm statement, and the user asked for the - impossible, don't die. Fail and let gimplify_asm_expr - issue an error. */ + impossible, don't die. Fail and let gimplify_asm_expr + issue an error. */ ret = GS_ERROR; goto out; } @@ -7566,10 +7549,10 @@ gimplify_one_sizepos (&TYPE_MAX_VALUE (type), list_p); for (t = TYPE_NEXT_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t)) - { - TYPE_MIN_VALUE (t) = TYPE_MIN_VALUE (type); - TYPE_MAX_VALUE (t) = TYPE_MAX_VALUE (type); - } + { + TYPE_MIN_VALUE (t) = TYPE_MIN_VALUE (type); + TYPE_MAX_VALUE (t) = TYPE_MAX_VALUE (type); + } break; case ARRAY_TYPE: @@ -7609,18 +7592,18 @@ case POINTER_TYPE: case REFERENCE_TYPE: - /* We used to recurse on the pointed-to type here, which turned out to - be incorrect because its definition might refer to variables not - yet initialized at this point if a forward declaration is involved. - - It was actually useful for anonymous pointed-to types to ensure - that the sizes evaluation dominates every possible later use of the - values. Restricting to such types here would be safe since there - is no possible forward declaration around, but would introduce an - undesirable middle-end semantic to anonymity. We then defer to - front-ends the responsibility of ensuring that the sizes are - evaluated both early and late enough, e.g. by attaching artificial - type declarations to the tree. */ + /* We used to recurse on the pointed-to type here, which turned out to + be incorrect because its definition might refer to variables not + yet initialized at this point if a forward declaration is involved. + + It was actually useful for anonymous pointed-to types to ensure + that the sizes evaluation dominates every possible later use of the + values. Restricting to such types here would be safe since there + is no possible forward declaration around, but would introduce an + undesirable middle-end semantic to anonymity. We then defer to + front-ends the responsibility of ensuring that the sizes are + evaluated both early and late enough, e.g. by attaching artificial + type declarations to the tree. */ break; default: @@ -7849,7 +7832,7 @@ for promotion to gimple registers. We'll transform their uses as we find them. */ if ((TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (parm)) == VECTOR_TYPE) + || TREE_CODE (TREE_TYPE (parm)) == VECTOR_TYPE) && !TREE_THIS_VOLATILE (parm) && !needs_to_live_in_memory (parm)) DECL_GIMPLE_REG_P (parm) = 1; @@ -7948,95 +7931,94 @@ { case GIMPLE_COND: gimplify_expr (gimple_cond_lhs_ptr (stmt), &pre, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); gimplify_expr (gimple_cond_rhs_ptr (stmt), &pre, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); break; case GIMPLE_SWITCH: gimplify_expr (gimple_switch_index_ptr (stmt), &pre, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); break; case GIMPLE_OMP_ATOMIC_LOAD: gimplify_expr (gimple_omp_atomic_load_rhs_ptr (stmt), &pre, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); break; case GIMPLE_ASM: { - size_t i, noutputs = gimple_asm_noutputs (stmt); - const char *constraint, **oconstraints; - bool allows_mem, allows_reg, is_inout; - - oconstraints - = (const char **) alloca ((noutputs) * sizeof (const char *)); - for (i = 0; i < noutputs; i++) - { - tree op = gimple_asm_output_op (stmt, i); - constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op))); - oconstraints[i] = constraint; - parse_output_constraint (&constraint, i, 0, 0, &allows_mem, - &allows_reg, &is_inout); - gimplify_expr (&TREE_VALUE (op), &pre, NULL, - is_inout ? is_gimple_min_lval : is_gimple_lvalue, - fb_lvalue | fb_mayfail); - } - for (i = 0; i < gimple_asm_ninputs (stmt); i++) - { - tree op = gimple_asm_input_op (stmt, i); - constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op))); - parse_input_constraint (&constraint, 0, 0, noutputs, 0, - oconstraints, &allows_mem, &allows_reg); - if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (op))) && allows_mem) - allows_reg = 0; - if (!allows_reg && allows_mem) - gimplify_expr (&TREE_VALUE (op), &pre, NULL, - is_gimple_lvalue, fb_lvalue | fb_mayfail); - else - gimplify_expr (&TREE_VALUE (op), &pre, NULL, - is_gimple_asm_val, fb_rvalue); - } + size_t i, noutputs = gimple_asm_noutputs (stmt); + const char *constraint, **oconstraints; + bool allows_mem, allows_reg, is_inout; + + oconstraints + = (const char **) alloca ((noutputs) * sizeof (const char *)); + for (i = 0; i < noutputs; i++) + { + tree op = gimple_asm_output_op (stmt, i); + constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op))); + oconstraints[i] = constraint; + parse_output_constraint (&constraint, i, 0, 0, &allows_mem, + &allows_reg, &is_inout); + gimplify_expr (&TREE_VALUE (op), &pre, NULL, + is_inout ? is_gimple_min_lval : is_gimple_lvalue, + fb_lvalue | fb_mayfail); + } + for (i = 0; i < gimple_asm_ninputs (stmt); i++) + { + tree op = gimple_asm_input_op (stmt, i); + constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op))); + parse_input_constraint (&constraint, 0, 0, noutputs, 0, + oconstraints, &allows_mem, &allows_reg); + if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (op))) && allows_mem) + allows_reg = 0; + if (!allows_reg && allows_mem) + gimplify_expr (&TREE_VALUE (op), &pre, NULL, + is_gimple_lvalue, fb_lvalue | fb_mayfail); + else + gimplify_expr (&TREE_VALUE (op), &pre, NULL, + is_gimple_asm_val, fb_rvalue); + } } break; default: /* NOTE: We start gimplifying operands from last to first to - make sure that side-effects on the RHS of calls, assignments - and ASMs are executed before the LHS. The ordering is not - important for other statements. */ + make sure that side-effects on the RHS of calls, assignments + and ASMs are executed before the LHS. The ordering is not + important for other statements. */ num_ops = gimple_num_ops (stmt); orig_lhs = gimple_get_lhs (stmt); for (i = num_ops; i > 0; i--) - { - tree op = gimple_op (stmt, i - 1); - if (op == NULL_TREE) - continue; - if (i == 1 && (is_gimple_call (stmt) || is_gimple_assign (stmt))) - gimplify_expr (&op, &pre, NULL, is_gimple_lvalue, fb_lvalue); - else if (i == 2 - && is_gimple_assign (stmt) - && num_ops == 2 - && get_gimple_rhs_class (gimple_expr_code (stmt)) - == GIMPLE_SINGLE_RHS) - gimplify_expr (&op, &pre, NULL, - rhs_predicate_for (gimple_assign_lhs (stmt)), - fb_rvalue); - else if (i == 2 && is_gimple_call (stmt)) - { - if (TREE_CODE (op) == FUNCTION_DECL) - continue; - gimplify_expr (&op, &pre, NULL, is_gimple_call_addr, fb_rvalue); - } - else - gimplify_expr (&op, &pre, NULL, is_gimple_val, fb_rvalue); - gimple_set_op (stmt, i - 1, op); - } + { + tree op = gimple_op (stmt, i - 1); + if (op == NULL_TREE) + continue; + if (i == 1 && (is_gimple_call (stmt) || is_gimple_assign (stmt))) + gimplify_expr (&op, &pre, NULL, is_gimple_lvalue, fb_lvalue); + else if (i == 2 + && is_gimple_assign (stmt) + && num_ops == 2 + && get_gimple_rhs_class (gimple_expr_code (stmt)) + == GIMPLE_SINGLE_RHS) + gimplify_expr (&op, &pre, NULL, + rhs_predicate_for (gimple_assign_lhs (stmt)), + fb_rvalue); + else if (i == 2 && is_gimple_call (stmt)) + { + if (TREE_CODE (op) == FUNCTION_DECL) + continue; + gimplify_expr (&op, &pre, NULL, is_gimple_call_addr, fb_rvalue); + } + else + gimplify_expr (&op, &pre, NULL, is_gimple_val, fb_rvalue); + gimple_set_op (stmt, i - 1, op); + } lhs = gimple_get_lhs (stmt); /* If the LHS changed it in a way that requires a simple RHS, - create temporary. */ + create temporary. */ if (lhs && !is_gimple_reg (lhs)) { bool need_temp = false; - if (is_gimple_assign (stmt) && num_ops == 2 && get_gimple_rhs_class (gimple_expr_code (stmt)) @@ -8103,12 +8085,12 @@ if (!gimple_seq_empty_p (pre)) { if (gimple_in_ssa_p (cfun)) - { - gimple_stmt_iterator i; - - for (i = gsi_start (pre); !gsi_end_p (i); gsi_next (&i)) - mark_symbols_for_renaming (gsi_stmt (i)); - } + { + gimple_stmt_iterator i; + + for (i = gsi_start (pre); !gsi_end_p (i); gsi_next (&i)) + mark_symbols_for_renaming (gsi_stmt (i)); + } gsi_insert_seq_before (gsi_p, pre, GSI_SAME_STMT); } if (post_stmt) @@ -8225,8 +8207,8 @@ tree force_gimple_operand_gsi (gimple_stmt_iterator *gsi, tree expr, - bool simple_p, tree var, bool before, - enum gsi_iterator_update m) + bool simple_p, tree var, bool before, + enum gsi_iterator_update m) { return force_gimple_operand_gsi_1 (gsi, expr, simple_p