381cdae497
2016-05-03 Richard Biener <rguenther@suse.de> * gimplify.h (get_initialized_tmp_var): Add allow_ssa parameter default true. (gimplify_arg): Likewise. * gimplify.c (gimplify_expr): Add overload with allow_ssa parameter, re-writing the result to a decl if required. (internal_get_tmp_var): Add allow_ssa parameter and override into_ssa with it. (get_formal_tmp_var): Adjust. (get_initialized_tmp_var): Add allow_ssa parameter. (gimplify_arg): Add allow_ssa parameter and avoid generating SSA names for the result false. (gimplify_call_expr): If the call may return twice do not gimplify parameters into SSA. (prepare_gimple_addressable): Do not allow an SSA name as temporary. (gimplify_modify_expr): Adjust assert. For noreturn calls with a SSA name LHS adjust its def. (gimplify_save_expr): Do not allow an SSA name as save-expr result. (gimplify_one_sizepos): Do not allow an SSA name as a sizepos. (gimplify_body): Init GIMPLE SSA data structures and gimplify into-SSA. (gimplify_scan_omp_clauses): Make sure OMP_CLAUSE_SIZE is not an SSA name. Likewise for OMP_CLAUSE_REDUCTION operands. (gimplify_omp_for): Likewise for OMP_CLAUSE_DECL. Likewise for OMP_FOR_COND, OMP_FOR_INCR and OMP_CLAUSE_LINEAR_STEP. (optimize_target_teams): Do not allow SSA names for clause operands. (gimplify_expr): Likewise for where we mark the result addressable. * passes.def (pass_init_datastructures): Remove. * tree-into-ssa.c (mark_def_sites): Ignore existing SSA names. (rewrite_stmt): Likewise. * tree-inline.c (initialize_cfun): Properly transfer SSA state. (replace_locals_op): Replace SSA names. (copy_gimple_seq_and_replace_locals): Init src_cfun. * gimple-low.c (lower_builtin_setjmp): Deal with SSA. * cgraph.c (release_function_body): Free CFG annotations only when we have a CFG. Simplify. * gimple-fold.c (gimplify_and_update_call_from_tree): Use force_gimple_operand instead of get_initialized_tmp_var. * tree-pass.h (make_pass_init_datastructures): Remove. * tree-ssa.c (execute_init_datastructures): Remove. (pass_data_init_datastructures): Likewise. (class pass_init_datastructures): Likewise. (make_pass_init_datastructures): Likewise. * omp-low.c (create_omp_child_function): Init SSA data structures. (grid_expand_target_grid_body): Likewise. * tree-cfg.c (move_block_to_fn): Double-check the DEF is an SSA name before adding it to names_to_release. (remove_bb): Always release SSA defs. * tree-ssa-ccp.c (get_default_value): Check SSA_NAME_VAR before dereferencing it. * cgraphunit.c (init_lowered_empty_function): Always int SSA data structures. * tree-ssanames.c (release_defs): Remove assert that we are in SSA form. * trans-mem.c (diagnose_tm_1): Handle SSA name function. c-family/ * cilk.c (cilk_gimplify_call_params_in_spawned_fn): Do not allow call args to gimplify to SSA names. * gcc.dg/pr30172-1.c: Adjust. * gcc.dg/pr63743.c: Likewise. * gcc.dg/tm/pr51696.c: Likewise. * c-c++-common/tm/safe-1.c: Likewise. * gcc.dg/tree-prof/val-prof-3.c: Likewise. * gcc.dg/plugin/self-assign-test-1.c: XFAIL case that needs CSE. * g++.dg/plugin/self-assign-test-1.C: Likewise. * g++.dg/plugin/self-assign-test-2.C: Likewise. From-SVN: r235817
108 lines
4.1 KiB
C
108 lines
4.1 KiB
C
/* Header file for gimplification.
|
|
Copyright (C) 2013-2016 Free Software Foundation, Inc.
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
version.
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GCC; see the file COPYING3. If not see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef GCC_GIMPLIFY_H
|
|
#define GCC_GIMPLIFY_H
|
|
|
|
/* Validation of GIMPLE expressions. Note that these predicates only check
|
|
the basic form of the expression, they don't recurse to make sure that
|
|
underlying nodes are also of the right form. */
|
|
typedef bool (*gimple_predicate)(tree);
|
|
|
|
/* FIXME we should deduce this from the predicate. */
|
|
enum fallback {
|
|
fb_none = 0, /* Do not generate a temporary. */
|
|
|
|
fb_rvalue = 1, /* Generate an rvalue to hold the result of a
|
|
gimplified expression. */
|
|
|
|
fb_lvalue = 2, /* Generate an lvalue to hold the result of a
|
|
gimplified expression. */
|
|
|
|
fb_mayfail = 4, /* Gimplification may fail. Error issued
|
|
afterwards. */
|
|
fb_either= fb_rvalue | fb_lvalue
|
|
};
|
|
|
|
typedef int fallback_t;
|
|
|
|
enum gimplify_status {
|
|
GS_ERROR = -2, /* Something Bad Seen. */
|
|
GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
|
|
GS_OK = 0, /* We did something, maybe more to do. */
|
|
GS_ALL_DONE = 1 /* The expression is fully gimplified. */
|
|
};
|
|
|
|
extern void free_gimplify_stack (void);
|
|
extern void push_gimplify_context (bool in_ssa = false,
|
|
bool rhs_cond_ok = false);
|
|
extern void pop_gimplify_context (gimple *);
|
|
extern gbind *gimple_current_bind_expr (void);
|
|
extern vec<gbind *> gimple_bind_expr_stack (void);
|
|
extern void gimplify_and_add (tree, gimple_seq *);
|
|
extern tree get_formal_tmp_var (tree, gimple_seq *);
|
|
extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *,
|
|
bool = true);
|
|
extern void declare_vars (tree, gimple *, bool);
|
|
extern void gimple_add_tmp_var (tree);
|
|
extern void gimple_add_tmp_var_fn (struct function *, tree);
|
|
extern tree unshare_expr (tree);
|
|
extern tree unshare_expr_without_location (tree);
|
|
extern tree voidify_wrapper_expr (tree, tree);
|
|
extern tree build_and_jump (tree *);
|
|
extern enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *,
|
|
gimple_seq *, bool, tree);
|
|
extern tree gimple_boolify (tree);
|
|
extern gimple_predicate rhs_predicate_for (tree);
|
|
extern bool gimplify_stmt (tree *, gimple_seq *);
|
|
extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
|
|
extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
|
|
bool (*) (tree), fallback_t);
|
|
|
|
extern void gimplify_type_sizes (tree, gimple_seq *);
|
|
extern void gimplify_one_sizepos (tree *, gimple_seq *);
|
|
extern gbind *gimplify_body (tree, bool);
|
|
extern enum gimplify_status gimplify_arg (tree *, gimple_seq *, location_t,
|
|
bool = true);
|
|
extern void gimplify_function_tree (tree);
|
|
extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
|
|
gimple_seq *);
|
|
gimple *gimplify_assign (tree, tree, gimple_seq *);
|
|
|
|
/* Return true if gimplify_one_sizepos doesn't need to gimplify
|
|
expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
|
|
fields). */
|
|
|
|
static inline bool
|
|
is_gimple_sizepos (tree expr)
|
|
{
|
|
/* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
|
|
is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
|
|
anything if it's already a VAR_DECL. If it's a VAR_DECL from another
|
|
function, the gimplifier will want to replace it with a new variable,
|
|
but that will cause problems if this type is from outside the function.
|
|
It's OK to have that here. */
|
|
return (expr == NULL_TREE
|
|
|| TREE_CONSTANT (expr)
|
|
|| TREE_CODE (expr) == VAR_DECL
|
|
|| CONTAINS_PLACEHOLDER_P (expr));
|
|
}
|
|
|
|
#endif /* GCC_GIMPLIFY_H */
|