* rtl.h (MEM_READONLY_P): Replace RTX_UNCHANGING_P. * alias.c (true_dependence): Update to match new semantics. (canon_true_dependence, write_dependence_p): Likewise. (anti_dependence, output_dependence): Update write_dependence_p args. (unchanging_anti_dependence): Remove. * calls.c (purge_mem_unchanging_flag): Remove. (fixup_tail_calls): Don't call it. (expand_call): Don't add unchanging memory to function usage. * expr.c (emit_block_move_via_libcall): Likewise. (clear_storage_via_libcall): Don't clobber RTX_UNCHANGING_P mems. (get_subtarget): Don't use RTX_UNCHANGING_P. (expand_assignment, store_constructor, expand_expr_real_1): Likewise. (do_tablejump): Set MEM_READONLY_P, not RTX_UNCHANGING_P. * combine.c (get_last_value_validate): Use MEM_READONLY_P. * cse.c (insert): Don't use RTX_UNCHANGING_P. (cse_insn, canon_hash): Use MEM_READONLY_P. * emit-rtl.c (set_mem_attributes_minus_bitpos): Use MEM_READONLY_P instead of RTX_UNCHANGING_P. * explow.c (maybe_set_unchanging): Remove. * expr.h (maybe_set_unchanging): Remove. * flow.c (insn_dead_p, mark_used_regs): Use anti_dependence. * function.c (assign_stack_temp_for_type): Don't use RTX_UNCHANGING_P. (assign_parm_setup_reg, expand_function_start): Likewise. * integrate.c (copy_rtx_and_substitute): Likewise. * ra-rewrite.c (emit_colors): Likewise. * regmove.c (copy_src_to_dest, regmove_optimize): Likewise. (fixup_match_1): Likewise. * reload1.c (reload, alter_reg): Likewise. * local-alloc.c (validate_equiv_mem): Check MEM_READONLY_P, not RTX_UNCHANGING_P. (equiv_init_varies_p): Likewise. * loop-invariant.c (check_maybe_invariant): Likewise. * resource.c (mark_referenced_resources, mark_set_resources): Likewise. * loop.c (note_addr_stored): Likewise. (prescan_loop): Likewise. Don't check function usage for clobbered unchanging memory. * rtlanal.c (rtx_unstable_p): Check MEM_READONLY_P, not RTX_UNCHANGING_P. (rtx_varies_p, modified_between_p, modified_in_p): Likewise. * varasm.c (force_const_mem): Likewise. * stmt.c (expand_decl): Don't set RTX_UNCHANGING_P. * web.c (entry_register): Likewise. * tree-gimple.h (get_base_address): Move decl ... * tree.h: ... here. * doc/rtl.texi (MEM_READONLY_P): Replace RTX_UNCHANGING_P. * config/alpha/alpha.c (alpha_set_memflags_1): Rewrite to be called via for_each_rtx. Copy MEM_SCALAR_P, MEM_NOTRAP_P too. (alpha_set_memflags): Update to match. * config/darwin.c (machopic_indirect_data_reference): Set MEM_READONLY_P instead of RTX_UNCHANGING_P. (machopic_indirect_call_target): Likewise. (machopic_legitimize_pic_address): Likewise. * config/arm/arm.c (legitimize_pic_address, arm_gen_load_multiple, arm_gen_store_multiple, arm_gen_movmemqi): Likewise. * config/arm/arm.md (load_multiple, store_multiple): Likewise. * config/frv/frv.md (symGOT2reg): Likewise. * config/i386/i386.c (legitimize_pic_address, legitimize_tls_address, ix86_split_to_parts): Likewise. * config/ia64/ia64.c (ia64_expand_tls_address): Likewise. * config/ia64/ia64.md (load_fptr): Likewise. * config/m32r/m32r.c (m32r_legitimize_pic_address): Likewise. * config/m68k/m68k.c (legitimize_pic_address): Likewise. * config/mcore/mcore.c (block_move_sequence): Likewise. * config/mn10300/mn10300.md (symGOT2reg): Likewise. * config/pa/pa.c (legitimize_pic_address): Likewise. * config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Likewise. (rs6000_emit_move): Likewise. * config/s390/s390.c (legitimize_pic_address): Likewise. (legitimize_tls_address): Likewise. * config/s390/s390.md (casesi): Likewise. * config/sh/sh.c (prepare_move_operands, sh_reorg): Likewise. * config/sh/sh.md (symGOT2reg): Likewise. * config/sparc/sparc.c (legitimize_pic_address): Likewise. * config/v850/v850.md (casesi): Likewise. * config/ia64/ia64.c (gen_thread_pointer): Don't set RTX_UNCHANGING_P. * config/iq2000/iq2000.c (save_restore_insns): Likewise. * config/mips/mips.c (mips_restore_gp): Likewise. (mips_save_restore_reg, mips16_gp_pseudo_reg): Likewise. * config/sh/sh.c (sh_reorg): Likewise. From-SVN: r86178
140 lines
5.2 KiB
C
140 lines
5.2 KiB
C
/* Functions to analyze and validate GIMPLE trees.
|
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
|
Contributed by Diego Novillo <dnovillo@redhat.com>
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2, 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 COPYING. If not, write to
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
#ifndef _TREE_SIMPLE_H
|
|
#define _TREE_SIMPLE_H 1
|
|
|
|
|
|
#include "tree-iterator.h"
|
|
|
|
extern tree create_tmp_var_raw (tree, const char *);
|
|
extern tree create_tmp_var_name (const char *);
|
|
extern tree create_tmp_var (tree, const char *);
|
|
extern tree get_initialized_tmp_var (tree, tree *, tree *);
|
|
extern tree get_formal_tmp_var (tree, tree *);
|
|
extern void declare_tmp_vars (tree, tree);
|
|
|
|
extern void annotate_all_with_locus (tree *, location_t);
|
|
|
|
/* 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);
|
|
|
|
/* Returns true iff T is a valid GIMPLE statement. */
|
|
extern bool is_gimple_stmt (tree);
|
|
|
|
/* Returns true iff TYPE is a valid type for a scalar register variable. */
|
|
extern bool is_gimple_reg_type (tree);
|
|
/* Returns true iff T is a scalar register variable. */
|
|
extern bool is_gimple_reg (tree);
|
|
/* Returns true if T is a GIMPLE temporary variable, false otherwise. */
|
|
extern bool is_gimple_formal_tmp_var (tree);
|
|
/* Returns true if T is a GIMPLE temporary register variable. */
|
|
extern bool is_gimple_formal_tmp_reg (tree);
|
|
/* Returns true iff T is any sort of variable. */
|
|
extern bool is_gimple_variable (tree);
|
|
/* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
|
|
extern bool is_gimple_min_lval (tree);
|
|
/* Returns true iff T is something whose address can be taken. */
|
|
extern bool is_gimple_addressable (tree);
|
|
/* Returns true iff T is any valid GIMPLE lvalue. */
|
|
extern bool is_gimple_lvalue (tree);
|
|
|
|
/* Returns true iff T is a GIMPLE restricted function invariant. */
|
|
extern bool is_gimple_min_invariant (tree);
|
|
/* Returns true iff T is a GIMPLE rvalue. */
|
|
extern bool is_gimple_val (tree);
|
|
/* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
|
|
GIMPLE temporary, a renamed user variable, or something else,
|
|
respectively. */
|
|
extern bool is_gimple_formal_tmp_rhs (tree);
|
|
extern bool is_gimple_reg_rhs (tree);
|
|
extern bool is_gimple_mem_rhs (tree);
|
|
/* Returns the appropriate one of the above three predicates for the LHS
|
|
T. */
|
|
extern gimple_predicate rhs_predicate_for (tree);
|
|
|
|
/* Returns true iff T is a valid if-statement condition. */
|
|
extern bool is_gimple_condexpr (tree);
|
|
|
|
/* Returns true iff T is a type conversion. */
|
|
extern bool is_gimple_cast (tree);
|
|
/* Returns true iff T is a valid CONSTRUCTOR element (either an rvalue or
|
|
another CONSTRUCTOR). */
|
|
extern bool is_gimple_constructor_elt (tree);
|
|
/* Returns true iff T is a variable that does not need to live in memory. */
|
|
extern bool is_gimple_non_addressable (tree t);
|
|
|
|
/* Returns true iff T is a valid call address expression. */
|
|
extern bool is_gimple_call_addr (tree);
|
|
/* If T makes a function call, returns the CALL_EXPR operand. */
|
|
extern tree get_call_expr_in (tree t);
|
|
|
|
extern void recalculate_side_effects (tree);
|
|
|
|
/* FIXME we should deduce this from the predicate. */
|
|
typedef enum fallback_t {
|
|
fb_none = 0,
|
|
fb_rvalue = 1,
|
|
fb_lvalue = 2,
|
|
fb_mayfail = 4,
|
|
fb_either= fb_rvalue | fb_lvalue
|
|
} 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 enum gimplify_status gimplify_expr (tree *, tree *, tree *,
|
|
bool (*) (tree), fallback_t);
|
|
extern void gimplify_type_sizes (tree, tree *);
|
|
extern void gimplify_one_sizepos (tree *, tree *);
|
|
extern void gimplify_stmt (tree *);
|
|
extern void gimplify_to_stmt_list (tree *);
|
|
extern void gimplify_body (tree *, tree);
|
|
extern void push_gimplify_context (void);
|
|
extern void pop_gimplify_context (tree);
|
|
extern void gimplify_and_add (tree, tree *);
|
|
|
|
/* Miscellaneous helpers. */
|
|
extern void gimple_add_tmp_var (tree);
|
|
extern tree gimple_current_bind_expr (void);
|
|
extern void gimple_push_bind_expr (tree);
|
|
extern void gimple_pop_bind_expr (void);
|
|
extern void unshare_all_trees (tree);
|
|
extern tree voidify_wrapper_expr (tree, tree);
|
|
extern tree gimple_build_eh_filter (tree, tree, tree);
|
|
extern tree build_and_jump (tree *);
|
|
extern tree alloc_stmt_list (void);
|
|
extern void free_stmt_list (tree);
|
|
extern tree force_labels_r (tree *, int *, void *);
|
|
extern enum gimplify_status gimplify_va_arg_expr (tree *, tree *, tree *);
|
|
|
|
/* In tree-nested.c. */
|
|
extern void lower_nested_functions (tree);
|
|
|
|
#endif /* _TREE_SIMPLE_H */
|