/* 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;
(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
static inline enum gimple_statement_structure_enum
gss_for_code (enum gimple_code code)
{
-#ifdef ENABLE_CHECKING
- gcc_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
-#endif
+ gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
return gss_for_code_[code];
}
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;
}
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;
}
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;
}
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;
}
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;
}
{
/* 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;
}
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);
}
{
if (gimple_has_ops (gs))
{
-#ifdef ENABLE_CHECKING
- gcc_assert (i < gimple_num_ops (gs));
-#endif
+ gcc_gimple_checking_assert (i < gimple_num_ops (gs));
return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
}
else
{
if (gimple_has_ops (gs))
{
-#ifdef ENABLE_CHECKING
- gcc_assert (i < gimple_num_ops (gs));
-#endif
+ gcc_gimple_checking_assert (i < gimple_num_ops (gs));
return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
}
else
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
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;
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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;
}
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;
}
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
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]);
}
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. */
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;
}
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);
}
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);
}
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);
}
gimple_debug_bind_get_var (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
return gimple_op (dbg, 0);
}
gimple_debug_bind_get_value (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
return gimple_op (dbg, 1);
}
gimple_debug_bind_get_value_ptr (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
return gimple_op_ptr (dbg, 1);
}
gimple_debug_bind_set_var (gimple dbg, tree var)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
gimple_set_op (dbg, 0, var);
}
gimple_debug_bind_set_value (gimple dbg, tree value)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
gimple_set_op (dbg, 1, value);
}
gimple_debug_bind_reset_value (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
}
gimple_debug_bind_has_value_p (gimple dbg)
{
GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
-#ifdef ENABLE_CHECKING
- gcc_assert (gimple_debug_bind_p (dbg));
-#endif
+ gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}