Mercurial > hg > CbC > CbC_gcc
diff gcc/gimple.h @ 69:1b10fe6932e1
merge 69
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 21 Aug 2011 07:53:12 +0900 |
parents | 326d9e06c2e3 f6334be47118 |
children | b81903832de2 |
line wrap: on
line diff
--- a/gcc/gimple.h Tue Dec 14 03:58:33 2010 +0900 +++ b/gcc/gimple.h Sun Aug 21 07:53:12 2011 +0900 @@ -1,6 +1,6 @@ /* Gimple IR definitions. - Copyright 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Aldy Hernandez <aldyh@redhat.com> This file is part of GCC. @@ -24,23 +24,16 @@ #include "pointer-set.h" #include "vec.h" +#include "vecprim.h" +#include "vecir.h" #include "ggc.h" -#include "tm.h" -#include "hard-reg-set.h" #include "basic-block.h" #include "tree-ssa-operands.h" - -DEF_VEC_P(gimple); -DEF_VEC_ALLOC_P(gimple,heap); -DEF_VEC_ALLOC_P(gimple,gc); - -typedef gimple *gimple_p; -DEF_VEC_P(gimple_p); -DEF_VEC_ALLOC_P(gimple_p,heap); - -DEF_VEC_P(gimple_seq); -DEF_VEC_ALLOC_P(gimple_seq,gc); -DEF_VEC_ALLOC_P(gimple_seq,heap); +#include "tree-ssa-alias.h" + +struct gimple_seq_node_d; +typedef struct gimple_seq_node_d *gimple_seq_node; +typedef const struct gimple_seq_node_d *const_gimple_seq_node; /* For each block, the PHI nodes that need to be rewritten are stored into these vectors. */ @@ -60,6 +53,7 @@ /* Error out if a gimple tuple is addressed incorrectly. */ #if defined ENABLE_GIMPLE_CHECKING +#define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR) extern void gimple_check_failed (const_gimple, const char *, int, \ const char *, enum gimple_code, \ enum tree_code) ATTRIBUTE_NORETURN; @@ -72,6 +66,7 @@ (CODE), ERROR_MARK); \ } while (0) #else /* not ENABLE_GIMPLE_CHECKING */ +#define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR))) #define GIMPLE_CHECK(GS, CODE) (void)0 #endif @@ -80,6 +75,7 @@ enum gimple_rhs_class { GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */ + GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */ GIMPLE_BINARY_RHS, /* The expression is a binary operation. */ GIMPLE_UNARY_RHS, /* The expression is a unary operation. */ GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA @@ -108,6 +104,7 @@ #ifndef noCbC GF_CALL_CBC_GOTO = 1 << 5, #endif + GF_CALL_NOTHROW = 1 << 5, GF_OMP_PARALLEL_COMBINED = 1 << 0, /* True on an GIMPLE_OMP_RETURN statement if the return does not require @@ -223,6 +220,13 @@ void gimple_seq_add_stmt (gimple_seq *, gimple); +/* Link gimple statement GS to the end of the sequence *SEQ_P. If + *SEQ_P is NULL, a new sequence is allocated. This function is + similar to gimple_seq_add_stmt, but does not scan the operands. + During gimplification, we need to manipulate statement sequences + before the def/use vectors have been constructed. */ +void gimplify_seq_add_stmt (gimple_seq *, gimple); + /* Allocate a new sequence and initialize its first element with STMT. */ static inline gimple_seq @@ -248,7 +252,7 @@ static inline void set_bb_seq (basic_block bb, gimple_seq seq) { - gcc_assert (!(bb->flags & BB_RTL)); + gcc_checking_assert (!(bb->flags & BB_RTL)); bb->il.gimple->seq = seq; } @@ -393,6 +397,25 @@ }; +/* Call statements that take both memory and register operands. */ + +struct GTY(()) gimple_statement_call +{ + /* [ WORD 1-8 ] */ + struct gimple_statement_with_memory_ops_base membase; + + /* [ WORD 9-12 ] */ + struct pt_solution call_used; + struct pt_solution call_clobbered; + + /* [ WORD 13 ] + Operand vector. NOTE! This must always be the last field + of this structure. In particular, this means that this + structure cannot be embedded inside another one. */ + tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1]; +}; + + /* OpenMP statements (#pragma omp). */ struct GTY(()) gimple_statement_omp { @@ -737,11 +760,12 @@ /* Define the overall contents of a gimple tuple. It may be any of the structures declared above for various types of tuples. */ -union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d { +union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d { struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase; struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops; struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase; struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem; + struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call; struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp; struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind; struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch; @@ -781,12 +805,14 @@ gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL); #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO) -void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *); +void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *); gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree, - tree MEM_STAT_DECL); -#define gimple_build_assign_with_ops(c,o1,o2,o3) \ - gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO) + tree, tree MEM_STAT_DECL); +#define gimple_build_assign_with_ops(c,o1,o2,o3) \ + gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO) +#define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \ + gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO) gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL); #define gimple_build_debug_bind(var,val,stmt) \ @@ -839,20 +865,20 @@ void gimple_seq_add_seq (gimple_seq *, gimple_seq); gimple_seq gimple_seq_copy (gimple_seq); int gimple_call_flags (const_gimple); +int gimple_call_return_flags (const_gimple); +int gimple_call_arg_flags (const_gimple, unsigned); +void gimple_call_reset_alias_info (gimple); bool gimple_assign_copy_p (gimple); bool gimple_assign_ssa_name_copy_p (gimple); -bool gimple_assign_single_p (gimple); bool gimple_assign_unary_nop_p (gimple); void gimple_set_bb (gimple, struct basic_block_def *); -tree gimple_fold (const_gimple); void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree); -void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code, - tree, tree); +void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code, + tree, tree, tree); tree gimple_get_lhs (const_gimple); void gimple_set_lhs (gimple, tree); void gimple_replace_lhs (gimple, tree); gimple gimple_copy (gimple); -bool is_gimple_operand (const_tree); void gimple_set_modified (gimple, bool); void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *); gimple gimple_build_cond_from_tree (tree, tree, tree); @@ -860,6 +886,7 @@ bool gimple_has_side_effects (const_gimple); bool gimple_rhs_has_side_effects (const_gimple); bool gimple_could_trap_p (gimple); +bool gimple_could_trap_p_1 (gimple, bool, bool); bool gimple_assign_rhs_could_trap_p (gimple); void gimple_regimplify_operands (gimple, gimple_stmt_iterator *); bool empty_body_p (gimple_seq); @@ -867,8 +894,9 @@ #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO) gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL); const char *gimple_decl_printable_name (tree, int); -tree gimple_fold_obj_type_ref (tree, tree); - +bool gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace); +tree gimple_get_virt_mehtod_for_binfo (HOST_WIDE_INT, tree, tree *, bool); +void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree); /* Returns true iff T is a valid GIMPLE statement. */ extern bool is_gimple_stmt (tree); @@ -904,6 +932,8 @@ extern bool is_gimple_val (tree); /* Returns true iff T is a GIMPLE asm statement input. */ extern bool is_gimple_asm_val (tree); +/* Returns true iff T is a valid address operand of a MEM_REF. */ +bool is_gimple_mem_ref_addr (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. */ @@ -913,8 +943,6 @@ /* 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 variable that does not need to live in memory. */ extern bool is_gimple_non_addressable (tree t); @@ -924,8 +952,11 @@ extern tree get_call_expr_in (tree t); extern void recalculate_side_effects (tree); -extern bool compare_field_offset (tree, tree); +extern bool gimple_compare_field_offset (tree, tree); extern tree gimple_register_type (tree); +extern tree gimple_register_canonical_type (tree); +enum gtc_mode { GTC_MERGE = 0, GTC_DIAG = 1 }; +extern bool gimple_types_compatible_p (tree, tree, enum gtc_mode); extern void print_gimple_types_stats (void); extern void free_gimple_type_tables (void); extern tree gimple_unsigned_type (tree); @@ -941,11 +972,13 @@ bool (*)(gimple, tree, void *), bool (*)(gimple, tree, void *)); extern bool gimple_ior_addresses_taken (bitmap, gimple); +extern bool gimple_call_builtin_p (gimple, enum built_in_function); /* In gimplify.c */ 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 create_tmp_reg (tree, const char *); extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *); extern tree get_formal_tmp_var (tree, gimple_seq *); extern void declare_vars (tree, gimple, bool); @@ -1017,8 +1050,6 @@ extern VEC(gimple, heap) *gimple_bind_expr_stack (void); extern tree voidify_wrapper_expr (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 *, gimple_seq *, gimple_seq *); @@ -1064,7 +1095,7 @@ static inline enum gimple_statement_structure_enum gss_for_code (enum gimple_code code) { - gcc_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE); + gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE); return gss_for_code_[code]; } @@ -1304,7 +1335,7 @@ static inline void gimple_set_def_ops (gimple g, struct def_optype_d *def) { - gcc_assert (gimple_has_ops (g)); + gcc_gimple_checking_assert (gimple_has_ops (g)); g->gsops.opbase.def_ops = def; } @@ -1325,7 +1356,7 @@ static inline void gimple_set_use_ops (gimple g, struct use_optype_d *use) { - gcc_assert (gimple_has_ops (g)); + gcc_gimple_checking_assert (gimple_has_ops (g)); g->gsops.opbase.use_ops = use; } @@ -1406,7 +1437,7 @@ static inline void gimple_set_vuse (gimple g, tree vuse) { - gcc_assert (gimple_has_mem_ops (g)); + gcc_gimple_checking_assert (gimple_has_mem_ops (g)); g->gsmembase.vuse = vuse; } @@ -1415,7 +1446,7 @@ static inline void gimple_set_vdef (gimple g, tree vdef) { - gcc_assert (gimple_has_mem_ops (g)); + gcc_gimple_checking_assert (gimple_has_mem_ops (g)); g->gsmembase.vdef = vdef; } @@ -1442,10 +1473,11 @@ enum gimple_code code = gimple_code (stmt); if (code == GIMPLE_ASSIGN || code == GIMPLE_COND) return (enum tree_code) stmt->gsbase.subcode; - else if (code == GIMPLE_CALL) - return CALL_EXPR; else - gcc_unreachable (); + { + gcc_gimple_checking_assert (code == GIMPLE_CALL); + return CALL_EXPR; + } } @@ -1506,7 +1538,7 @@ static inline unsigned gimple_omp_subcode (const_gimple s) { - gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD + gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD && gimple_code (s) <= GIMPLE_OMP_SINGLE); return s->gsbase.subcode; } @@ -1518,7 +1550,7 @@ { /* We only have 16 bits for the subcode. Assert that we are not overflowing it. */ - gcc_assert (subcode < (1 << 16)); + gcc_gimple_checking_assert (subcode < (1 << 16)); s->gsbase.subcode = subcode; } @@ -1618,7 +1650,7 @@ of the structure. Note that those structures that do not have an operand vector have a zero offset. */ off = gimple_ops_offset_[gimple_statement_structure (gs)]; - gcc_assert (off != 0); + gcc_gimple_checking_assert (off != 0); return (tree *) ((char *) gs + off); } @@ -1631,7 +1663,7 @@ { if (gimple_has_ops (gs)) { - gcc_assert (i < gimple_num_ops (gs)); + gcc_gimple_checking_assert (i < gimple_num_ops (gs)); return gimple_ops (CONST_CAST_GIMPLE (gs))[i]; } else @@ -1645,7 +1677,7 @@ { if (gimple_has_ops (gs)) { - gcc_assert (i < gimple_num_ops (gs)); + gcc_gimple_checking_assert (i < gimple_num_ops (gs)); return gimple_ops (CONST_CAST_GIMPLE (gs)) + i; } else @@ -1657,7 +1689,7 @@ static inline void gimple_set_op (gimple gs, unsigned i, tree op) { - gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs)); + gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs)); /* Note. It may be tempting to assert that OP matches is_gimple_operand, but that would be wrong. Different tuples @@ -1709,7 +1741,6 @@ gimple_assign_set_lhs (gimple gs, tree lhs) { GIMPLE_CHECK (gs, GIMPLE_ASSIGN); - gcc_assert (is_gimple_operand (lhs)); gimple_set_op (gs, 0, lhs); if (lhs && TREE_CODE (lhs) == SSA_NAME) @@ -1744,13 +1775,6 @@ { GIMPLE_CHECK (gs, GIMPLE_ASSIGN); - /* If there are 3 or more operands, the 2 operands on the RHS must be - GIMPLE values. */ - if (gimple_num_ops (gs) >= 3) - gcc_assert (is_gimple_val (rhs)); - else - gcc_assert (is_gimple_operand (rhs)); - gimple_set_op (gs, 1, rhs); } @@ -1788,12 +1812,66 @@ { GIMPLE_CHECK (gs, GIMPLE_ASSIGN); - /* The 2 operands on the RHS must be GIMPLE values. */ - gcc_assert (is_gimple_val (rhs)); - gimple_set_op (gs, 2, rhs); } +/* Return the third operand on the RHS of assignment statement GS. + If GS does not have two operands, NULL is returned instead. */ + +static inline tree +gimple_assign_rhs3 (const_gimple gs) +{ + GIMPLE_CHECK (gs, GIMPLE_ASSIGN); + + if (gimple_num_ops (gs) >= 4) + return gimple_op (gs, 3); + else + return NULL_TREE; +} + +/* Return a pointer to the third operand on the RHS of assignment + statement GS. */ + +static inline tree * +gimple_assign_rhs3_ptr (const_gimple gs) +{ + GIMPLE_CHECK (gs, GIMPLE_ASSIGN); + return gimple_op_ptr (gs, 3); +} + + +/* Set RHS to be the third operand on the RHS of assignment statement GS. */ + +static inline void +gimple_assign_set_rhs3 (gimple gs, tree rhs) +{ + GIMPLE_CHECK (gs, GIMPLE_ASSIGN); + + gimple_set_op (gs, 3, rhs); +} + +/* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect + to see only a maximum of two operands. */ + +static inline void +gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, + tree op1, tree op2) +{ + gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL); +} + +/* A wrapper around extract_ops_from_tree_1, for callers which expect + to see only a maximum of two operands. */ + +static inline void +extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0, + tree *op1) +{ + tree op2; + extract_ops_from_tree_1 (expr, code, op0, op1, &op2); + gcc_assert (op2 == NULL_TREE); +} + /* Returns true if GS is a nontemporal move. */ static inline bool @@ -1823,7 +1901,10 @@ enum tree_code code; GIMPLE_CHECK (gs, GIMPLE_ASSIGN); - code = gimple_expr_code (gs); + code = (enum tree_code) gs->gsbase.subcode; + /* While we initially set subcode to the TREE_CODE of the rhs for + GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay + in sync when we rewrite stmts into SSA form or do SSA propagations. */ if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS) code = TREE_CODE (gimple_assign_rhs1 (gs)); @@ -1852,6 +1933,19 @@ return get_gimple_rhs_class (gimple_assign_rhs_code (gs)); } +/* Return true if GS is an assignment with a singleton RHS, i.e., + there is no operator associated with the assignment itself. + Unlike gimple_assign_copy_p, this predicate returns true for + any RHS operand, including those that perform an operation + and do not have the semantics of a copy, such as COND_EXPR. */ + +static inline bool +gimple_assign_single_p (gimple gs) +{ + return (is_gimple_assign (gs) + && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS); +} + /* Return true if S is a type-cast assignment. */ @@ -1904,7 +1998,6 @@ gimple_call_set_lhs (gimple gs, tree lhs) { GIMPLE_CHECK (gs, GIMPLE_CALL); - gcc_assert (!lhs || is_gimple_operand (lhs)); gimple_set_op (gs, 0, lhs); if (lhs && TREE_CODE (lhs) == SSA_NAME) SSA_NAME_DEF_STMT (lhs) = gs; @@ -1939,7 +2032,6 @@ gimple_call_set_fn (gimple gs, tree fn) { GIMPLE_CHECK (gs, GIMPLE_CALL); - gcc_assert (is_gimple_operand (fn)); gimple_set_op (gs, 1, fn); } @@ -1950,7 +2042,6 @@ gimple_call_set_fndecl (gimple gs, tree decl) { GIMPLE_CHECK (gs, GIMPLE_CALL); - gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl)); } @@ -1965,7 +2056,15 @@ tree addr = gimple_call_fn (gs); if (TREE_CODE (addr) == ADDR_EXPR) { - gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL); + tree fndecl = TREE_OPERAND (addr, 0); + if (TREE_CODE (fndecl) == MEM_REF) + { + if (TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR + && integer_zerop (TREE_OPERAND (fndecl, 1))) + return TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0); + else + return NULL_TREE; + } return TREE_OPERAND (addr, 0); } return NULL_TREE; @@ -1981,12 +2080,8 @@ tree type = TREE_TYPE (fn); /* See through the pointer. */ - gcc_assert (POINTER_TYPE_P (type)); type = TREE_TYPE (type); - gcc_assert (TREE_CODE (type) == FUNCTION_TYPE - || TREE_CODE (type) == METHOD_TYPE); - /* The type returned by a FUNCTION_DECL is the type of its function type. */ return TREE_TYPE (type); @@ -2018,9 +2113,7 @@ gimple_call_set_chain (gimple gs, tree chain) { GIMPLE_CHECK (gs, GIMPLE_CALL); - gcc_assert (chain == NULL - || TREE_CODE (chain) == ADDR_EXPR - || SSA_VAR_P (chain)); + gimple_set_op (gs, 2, chain); } @@ -2033,7 +2126,6 @@ unsigned num_ops; GIMPLE_CHECK (gs, GIMPLE_CALL); num_ops = gimple_num_ops (gs); - gcc_assert (num_ops >= 3); return num_ops - 3; } @@ -2065,7 +2157,6 @@ gimple_call_set_arg (gimple gs, unsigned index, tree arg) { GIMPLE_CHECK (gs, GIMPLE_CALL); - gcc_assert (is_gimple_operand (arg)); gimple_set_op (gs, index + 3, arg); } @@ -2227,6 +2318,19 @@ } +/* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw + even if the called function can throw in other cases. */ + +static inline void +gimple_call_set_nothrow (gimple s, bool nothrow_p) +{ + GIMPLE_CHECK (s, GIMPLE_CALL); + if (nothrow_p) + s->gsbase.subcode |= GF_CALL_NOTHROW; + else + s->gsbase.subcode &= ~GF_CALL_NOTHROW; +} + /* Return true if S is a nothrow call. */ static inline bool @@ -2248,6 +2352,28 @@ } +/* Return a pointer to the points-to solution for the set of call-used + variables of the call CALL. */ + +static inline struct pt_solution * +gimple_call_use_set (gimple call) +{ + GIMPLE_CHECK (call, GIMPLE_CALL); + return &call->gimple_call.call_used; +} + + +/* Return a pointer to the points-to solution for the set of call-used + variables of the call CALL. */ + +static inline struct pt_solution * +gimple_call_clobber_set (gimple call) +{ + GIMPLE_CHECK (call, GIMPLE_CALL); + return &call->gimple_call.call_clobbered; +} + + /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a non-NULL lhs. */ @@ -2276,7 +2402,6 @@ gimple_cond_set_code (gimple gs, enum tree_code code) { GIMPLE_CHECK (gs, GIMPLE_COND); - gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison); gs->gsbase.subcode = code; } @@ -2307,7 +2432,6 @@ gimple_cond_set_lhs (gimple gs, tree lhs) { GIMPLE_CHECK (gs, GIMPLE_COND); - gcc_assert (is_gimple_operand (lhs)); gimple_set_op (gs, 0, lhs); } @@ -2339,7 +2463,6 @@ gimple_cond_set_rhs (gimple gs, tree rhs) { GIMPLE_CHECK (gs, GIMPLE_COND); - gcc_assert (is_gimple_operand (rhs)); gimple_set_op (gs, 1, rhs); } @@ -2362,7 +2485,6 @@ gimple_cond_set_true_label (gimple gs, tree label) { GIMPLE_CHECK (gs, GIMPLE_COND); - gcc_assert (!label || TREE_CODE (label) == LABEL_DECL); gimple_set_op (gs, 2, label); } @@ -2374,7 +2496,6 @@ gimple_cond_set_false_label (gimple gs, tree label) { GIMPLE_CHECK (gs, GIMPLE_COND); - gcc_assert (!label || TREE_CODE (label) == LABEL_DECL); gimple_set_op (gs, 3, label); } @@ -2505,7 +2626,6 @@ gimple_label_set_label (gimple gs, tree label) { GIMPLE_CHECK (gs, GIMPLE_LABEL); - gcc_assert (TREE_CODE (label) == LABEL_DECL); gimple_set_op (gs, 0, label); } @@ -2526,7 +2646,6 @@ gimple_goto_set_dest (gimple gs, tree dest) { GIMPLE_CHECK (gs, GIMPLE_GOTO); - gcc_assert (is_gimple_operand (dest)); gimple_set_op (gs, 0, dest); } @@ -2622,7 +2741,8 @@ gimple_bind_set_block (gimple gs, tree block) { GIMPLE_CHECK (gs, GIMPLE_BIND); - gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK); + gcc_gimple_checking_assert (block == NULL_TREE + || TREE_CODE (block) == BLOCK); gs->gimple_bind.block = block; } @@ -2671,7 +2791,7 @@ gimple_asm_input_op (const_gimple gs, unsigned index) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.ni); + gcc_gimple_checking_assert (index <= gs->gimple_asm.ni); return gimple_op (gs, index); } @@ -2681,7 +2801,7 @@ gimple_asm_input_op_ptr (const_gimple gs, unsigned index) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.ni); + gcc_gimple_checking_assert (index <= gs->gimple_asm.ni); return gimple_op_ptr (gs, index); } @@ -2692,8 +2812,8 @@ gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.ni); - gcc_assert (TREE_CODE (in_op) == TREE_LIST); + gcc_gimple_checking_assert (index <= gs->gimple_asm.ni + && TREE_CODE (in_op) == TREE_LIST); gimple_set_op (gs, index, in_op); } @@ -2704,7 +2824,7 @@ gimple_asm_output_op (const_gimple gs, unsigned index) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.no); + gcc_gimple_checking_assert (index <= gs->gimple_asm.no); return gimple_op (gs, index + gs->gimple_asm.ni); } @@ -2714,7 +2834,7 @@ gimple_asm_output_op_ptr (const_gimple gs, unsigned index) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.no); + gcc_gimple_checking_assert (index <= gs->gimple_asm.no); return gimple_op_ptr (gs, index + gs->gimple_asm.ni); } @@ -2725,8 +2845,8 @@ gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.no); - gcc_assert (TREE_CODE (out_op) == TREE_LIST); + gcc_gimple_checking_assert (index <= gs->gimple_asm.no + && TREE_CODE (out_op) == TREE_LIST); gimple_set_op (gs, index + gs->gimple_asm.ni, out_op); } @@ -2737,7 +2857,7 @@ gimple_asm_clobber_op (const_gimple gs, unsigned index) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.nc); + gcc_gimple_checking_assert (index <= gs->gimple_asm.nc); return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no); } @@ -2748,8 +2868,8 @@ gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.nc); - gcc_assert (TREE_CODE (clobber_op) == TREE_LIST); + gcc_gimple_checking_assert (index <= gs->gimple_asm.nc + && TREE_CODE (clobber_op) == TREE_LIST); gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op); } @@ -2759,7 +2879,7 @@ gimple_asm_label_op (const_gimple gs, unsigned index) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.nl); + gcc_gimple_checking_assert (index <= gs->gimple_asm.nl); return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc); } @@ -2769,8 +2889,8 @@ gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op) { GIMPLE_CHECK (gs, GIMPLE_ASM); - gcc_assert (index <= gs->gimple_asm.nl); - gcc_assert (TREE_CODE (label_op) == TREE_LIST); + gcc_gimple_checking_assert (index <= gs->gimple_asm.nl + && TREE_CODE (label_op) == TREE_LIST); gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op); } @@ -2983,7 +3103,8 @@ gimple_try_set_kind (gimple gs, enum gimple_try_flags kind) { GIMPLE_CHECK (gs, GIMPLE_TRY); - gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY); + gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH + || kind == GIMPLE_TRY_FINALLY); if (gimple_try_kind (gs) != kind) gs->gsbase.subcode = (unsigned int) kind; } @@ -2994,7 +3115,7 @@ static inline bool gimple_try_catch_is_cleanup (const_gimple gs) { - gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH); + gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH); return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0; } @@ -3025,7 +3146,7 @@ static inline void gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup) { - gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH); + gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH); if (catch_is_cleanup) g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP; else @@ -3152,7 +3273,7 @@ gimple_phi_arg (gimple gs, unsigned index) { GIMPLE_CHECK (gs, GIMPLE_PHI); - gcc_assert (index <= gs->gimple_phi.capacity); + gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity); return &(gs->gimple_phi.args[index]); } @@ -3163,8 +3284,8 @@ gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg) { GIMPLE_CHECK (gs, GIMPLE_PHI); - gcc_assert (index <= gs->gimple_phi.nargs); - memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d)); + gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs); + gs->gimple_phi.args[index] = *phiarg; } /* Return the region number for GIMPLE_RESX GS. */ @@ -3211,7 +3332,7 @@ unsigned num_ops; GIMPLE_CHECK (gs, GIMPLE_SWITCH); num_ops = gimple_num_ops (gs); - gcc_assert (num_ops > 1); + gcc_gimple_checking_assert (num_ops > 1); return num_ops - 1; } @@ -3252,7 +3373,7 @@ gimple_switch_set_index (gimple gs, tree index) { GIMPLE_CHECK (gs, GIMPLE_SWITCH); - gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index)); + gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index)); gimple_set_op (gs, 0, index); } @@ -3264,7 +3385,7 @@ gimple_switch_label (const_gimple gs, unsigned index) { GIMPLE_CHECK (gs, GIMPLE_SWITCH); - gcc_assert (gimple_num_ops (gs) > index + 1); + gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1); return gimple_op (gs, index + 1); } @@ -3274,8 +3395,9 @@ gimple_switch_set_label (gimple gs, unsigned index, tree label) { GIMPLE_CHECK (gs, GIMPLE_SWITCH); - gcc_assert (gimple_num_ops (gs) > index + 1); - gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR); + gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1 + && (label == NULL_TREE + || TREE_CODE (label) == CASE_LABEL_EXPR)); gimple_set_op (gs, index + 1, label); } @@ -3320,7 +3442,7 @@ gimple_debug_bind_get_var (gimple dbg) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); - gcc_assert (gimple_debug_bind_p (dbg)); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); return gimple_op (dbg, 0); } @@ -3331,7 +3453,7 @@ gimple_debug_bind_get_value (gimple dbg) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); - gcc_assert (gimple_debug_bind_p (dbg)); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); return gimple_op (dbg, 1); } @@ -3342,7 +3464,7 @@ gimple_debug_bind_get_value_ptr (gimple dbg) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); - gcc_assert (gimple_debug_bind_p (dbg)); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); return gimple_op_ptr (dbg, 1); } @@ -3352,7 +3474,7 @@ gimple_debug_bind_set_var (gimple dbg, tree var) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); - gcc_assert (gimple_debug_bind_p (dbg)); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); gimple_set_op (dbg, 0, var); } @@ -3363,7 +3485,7 @@ gimple_debug_bind_set_value (gimple dbg, tree value) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); - gcc_assert (gimple_debug_bind_p (dbg)); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); gimple_set_op (dbg, 1, value); } @@ -3378,7 +3500,7 @@ gimple_debug_bind_reset_value (gimple dbg) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); - gcc_assert (gimple_debug_bind_p (dbg)); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE); } @@ -3389,7 +3511,7 @@ gimple_debug_bind_has_value_p (gimple dbg) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); - gcc_assert (gimple_debug_bind_p (dbg)); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE; } @@ -3488,7 +3610,7 @@ gimple_omp_for_index (const_gimple gs, size_t i) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); return gs->gimple_omp_for.iter[i].index; } @@ -3499,7 +3621,7 @@ gimple_omp_for_index_ptr (gimple gs, size_t i) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); return &gs->gimple_omp_for.iter[i].index; } @@ -3510,7 +3632,7 @@ gimple_omp_for_set_index (gimple gs, size_t i, tree index) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); gs->gimple_omp_for.iter[i].index = index; } @@ -3521,7 +3643,7 @@ gimple_omp_for_initial (const_gimple gs, size_t i) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); return gs->gimple_omp_for.iter[i].initial; } @@ -3532,7 +3654,7 @@ gimple_omp_for_initial_ptr (gimple gs, size_t i) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); return &gs->gimple_omp_for.iter[i].initial; } @@ -3543,7 +3665,7 @@ gimple_omp_for_set_initial (gimple gs, size_t i, tree initial) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); gs->gimple_omp_for.iter[i].initial = initial; } @@ -3554,7 +3676,7 @@ gimple_omp_for_final (const_gimple gs, size_t i) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); return gs->gimple_omp_for.iter[i].final; } @@ -3565,7 +3687,7 @@ gimple_omp_for_final_ptr (gimple gs, size_t i) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); return &gs->gimple_omp_for.iter[i].final; } @@ -3576,7 +3698,7 @@ gimple_omp_for_set_final (gimple gs, size_t i, tree final) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); gs->gimple_omp_for.iter[i].final = final; } @@ -3587,7 +3709,7 @@ gimple_omp_for_incr (const_gimple gs, size_t i) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); return gs->gimple_omp_for.iter[i].incr; } @@ -3598,7 +3720,7 @@ gimple_omp_for_incr_ptr (gimple gs, size_t i) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); return &gs->gimple_omp_for.iter[i].incr; } @@ -3609,7 +3731,7 @@ gimple_omp_for_set_incr (gimple gs, size_t i, tree incr) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); gs->gimple_omp_for.iter[i].incr = incr; } @@ -4111,8 +4233,8 @@ gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison + && i < gs->gimple_omp_for.collapse); gs->gimple_omp_for.iter[i].cond = cond; } @@ -4123,7 +4245,7 @@ gimple_omp_for_cond (const_gimple gs, size_t i) { GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); - gcc_assert (i < gs->gimple_omp_for.collapse); + gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); return gs->gimple_omp_for.iter[i].cond; } @@ -4282,7 +4404,6 @@ gimple_return_retval_ptr (const_gimple gs) { GIMPLE_CHECK (gs, GIMPLE_RETURN); - gcc_assert (gimple_num_ops (gs) == 1); return gimple_op_ptr (gs, 0); } @@ -4292,7 +4413,6 @@ gimple_return_retval (const_gimple gs) { GIMPLE_CHECK (gs, GIMPLE_RETURN); - gcc_assert (gimple_num_ops (gs) == 1); return gimple_op (gs, 0); } @@ -4303,10 +4423,6 @@ gimple_return_set_retval (gimple gs, tree retval) { GIMPLE_CHECK (gs, GIMPLE_RETURN); - gcc_assert (gimple_num_ops (gs) == 1); - gcc_assert (retval == NULL_TREE - || TREE_CODE (retval) == RESULT_DECL - || is_gimple_val (retval)); gimple_set_op (gs, 0, retval); } @@ -4790,4 +4906,20 @@ extern void dump_gimple_statistics (void); +/* In gimple-fold.c. */ +void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree); +tree gimple_fold_builtin (gimple); +bool fold_stmt (gimple_stmt_iterator *); +bool fold_stmt_inplace (gimple); +tree maybe_fold_offset_to_address (location_t, tree, tree, tree); +tree maybe_fold_offset_to_reference (location_t, tree, tree, tree); +tree maybe_fold_stmt_addition (location_t, tree, tree, tree); +tree get_symbol_constant_value (tree); +tree canonicalize_constructor_val (tree); +bool may_propagate_address_into_dereference (tree, tree); +extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree, + enum tree_code, tree, tree); +extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree, + enum tree_code, tree, tree); + #endif /* GCC_GIMPLE_H */