diff options
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r-- | gcc/stmt.c | 102 |
1 files changed, 45 insertions, 57 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c index 02e6664b82c..dc2ca0d3b1b 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -132,8 +132,7 @@ static struct case_node *add_case_node (struct case_node *, tree, tree, tree); rtx label_rtx (tree label) { - if (TREE_CODE (label) != LABEL_DECL) - abort (); + gcc_assert (TREE_CODE (label) == LABEL_DECL); if (!DECL_RTL_SET_P (label)) { @@ -155,8 +154,7 @@ force_label_rtx (tree label) tree function = decl_function_context (label); struct function *p; - if (!function) - abort (); + gcc_assert (function); if (function != current_function_decl) p = find_function_data (function); @@ -241,8 +239,7 @@ expand_goto (tree label) /* Check for a nonlocal goto to a containing function. Should have gotten translated to __builtin_nonlocal_goto. */ tree context = decl_function_context (label); - if (context != 0 && context != current_function_decl) - abort (); + gcc_assert (!context || context == current_function_decl); #endif emit_jump (label_rtx (label)); @@ -785,11 +782,12 @@ expand_asm_operands (tree string, tree outputs, tree inputs, bool allows_reg; bool allows_mem; rtx op; + bool ok; - if (!parse_output_constraint (&constraints[i], i, ninputs, + ok = parse_output_constraint (&constraints[i], i, ninputs, noutputs, &allows_mem, &allows_reg, - &is_inout)) - abort (); + &is_inout); + gcc_assert (ok); /* If an output operand is not a decl or indirect ref and our constraint allows a register, make a temporary to act as an intermediate. @@ -866,11 +864,12 @@ expand_asm_operands (tree string, tree outputs, tree inputs, const char *constraint; tree val, type; rtx op; + bool ok; constraint = constraints[i + noutputs]; - if (! parse_input_constraint (&constraint, i, ninputs, noutputs, ninout, - constraints, &allows_mem, &allows_reg)) - abort (); + ok = parse_input_constraint (&constraint, i, ninputs, noutputs, ninout, + constraints, &allows_mem, &allows_reg); + gcc_assert (ok); generating_concat_p = 0; @@ -1330,8 +1329,7 @@ resolve_operand_name_1 (char *p, tree outputs, tree inputs) p = strchr (p, '\0'); /* Verify the no extra buffer space assumption. */ - if (p > q) - abort (); + gcc_assert (p <= q); /* Shift the rest of the buffer down to fill the gap. */ memmove (p, q + 1, strlen (q + 1) + 1); @@ -1733,9 +1731,8 @@ expand_return (tree retval) if (GET_MODE_SIZE (tmpmode) >= bytes) break; - /* No suitable mode found. */ - if (tmpmode == VOIDmode) - abort (); + /* A suitable mode should have been found. */ + gcc_assert (tmpmode != VOIDmode); PUT_MODE (result_rtl, tmpmode); } @@ -1974,9 +1971,8 @@ expand_decl (tree decl) to the proper address. */ if (DECL_RTL_SET_P (decl)) { - if (!MEM_P (DECL_RTL (decl)) - || !REG_P (XEXP (DECL_RTL (decl), 0))) - abort (); + gcc_assert (MEM_P (DECL_RTL (decl))); + gcc_assert (REG_P (XEXP (DECL_RTL (decl), 0))); oldaddr = XEXP (DECL_RTL (decl), 0); } @@ -2122,6 +2118,7 @@ expand_anon_union_decl (tree decl, tree cleanup ATTRIBUTE_UNUSED, { tree decl_elt = TREE_VALUE (t); enum machine_mode mode = TYPE_MODE (TREE_TYPE (decl_elt)); + rtx decl_rtl; /* If any of the elements are addressable, so is the entire union. */ @@ -2139,24 +2136,18 @@ expand_anon_union_decl (tree decl, tree cleanup ATTRIBUTE_UNUSED, DECL_MODE (decl_elt) = mode = mode_for_size_tree (DECL_SIZE (decl_elt), MODE_INT, 1); - /* (SUBREG (MEM ...)) at RTL generation time is invalid, so we - instead create a new MEM rtx with the proper mode. */ - if (MEM_P (x)) + if (mode == GET_MODE (x)) + decl_rtl = x; + else if (MEM_P (x)) + /* (SUBREG (MEM ...)) at RTL generation time is invalid, so we + instead create a new MEM rtx with the proper mode. */ + decl_rtl = adjust_address_nv (x, mode, 0); + else { - if (mode == GET_MODE (x)) - SET_DECL_RTL (decl_elt, x); - else - SET_DECL_RTL (decl_elt, adjust_address_nv (x, mode, 0)); + gcc_assert (REG_P (x)); + decl_rtl = gen_lowpart_SUBREG (mode, x); } - else if (REG_P (x)) - { - if (mode == GET_MODE (x)) - SET_DECL_RTL (decl_elt, x); - else - SET_DECL_RTL (decl_elt, gen_lowpart_SUBREG (mode, x)); - } - else - abort (); + SET_DECL_RTL (decl_elt, decl_rtl); } } @@ -2280,10 +2271,9 @@ emit_case_bit_tests (tree index_type, tree index_expr, tree minval, if (i == count) { - if (count >= MAX_CASE_BIT_TESTS) - abort (); - test[i].hi = 0; - test[i].lo = 0; + gcc_assert (count < MAX_CASE_BIT_TESTS); + test[i].hi = 0; + test[i].lo = 0; test[i].label = label; test[i].bits = 1; count++; @@ -2378,8 +2368,8 @@ expand_case (tree exp) /* The switch body is lowered in gimplify.c, we should never have switches with a non-NULL SWITCH_BODY here. */ - if (SWITCH_BODY (exp) || !SWITCH_LABELS (exp)) - abort (); + gcc_assert (!SWITCH_BODY (exp)); + gcc_assert (SWITCH_LABELS (exp)); for (i = TREE_VEC_LENGTH (vec); --i >= 0; ) { @@ -2388,15 +2378,12 @@ expand_case (tree exp) /* Handle default labels specially. */ if (!CASE_HIGH (elt) && !CASE_LOW (elt)) { -#ifdef ENABLE_CHECKING - if (default_label_decl != 0) - abort (); -#endif - default_label_decl = CASE_LABEL (elt); + gcc_assert (!default_label_decl); + default_label_decl = CASE_LABEL (elt); } else case_list = add_case_node (case_list, CASE_LOW (elt), CASE_HIGH (elt), - CASE_LABEL (elt)); + CASE_LABEL (elt)); } do_pending_stack_adjust (); @@ -2411,6 +2398,8 @@ expand_case (tree exp) /* An ERROR_MARK occurs for various reasons including invalid data type. */ if (index_type != error_mark_node) { + int fail; + /* If we don't have a default-label, create one here, after the body of the switch. */ if (default_label_decl == 0) @@ -2431,10 +2420,8 @@ expand_case (tree exp) for (n = case_list; n; n = n->right) { /* Check low and high label values are integers. */ - if (TREE_CODE (n->low) != INTEGER_CST) - abort (); - if (TREE_CODE (n->high) != INTEGER_CST) - abort (); + gcc_assert (TREE_CODE (n->low) == INTEGER_CST); + gcc_assert (TREE_CODE (n->high) == INTEGER_CST); n->low = convert (index_type, n->low); n->high = convert (index_type, n->high); @@ -2605,6 +2592,7 @@ expand_case (tree exp) if (! try_casesi (index_type, index_expr, minval, range, table_label, default_label)) { + bool ok; index_type = integer_type_node; /* Index jumptables from zero for suitable values of @@ -2617,9 +2605,9 @@ expand_case (tree exp) range = maxval; } - if (! try_tablejump (index_type, index_expr, minval, range, - table_label, default_label)) - abort (); + ok = try_tablejump (index_type, index_expr, minval, range, + table_label, default_label); + gcc_assert (ok); } /* Get table of labels to jump to, in order of case index. */ @@ -2675,8 +2663,8 @@ expand_case (tree exp) before_case = NEXT_INSN (before_case); end = get_last_insn (); - if (squeeze_notes (&before_case, &end)) - abort (); + fail = squeeze_notes (&before_case, &end); + gcc_assert (!fail); reorder_insns (before_case, end, start); } |