-/* Finish a null loop, aka do { } while (0). */
-
-void
-expand_end_null_loop ()
-{
- do_pending_stack_adjust ();
- emit_label (loop_stack->data.loop.end_label);
-
- POPSTACK (loop_stack);
-
- clear_last_expr ();
-}
-
-/* Generate a jump to the current loop's continue-point.
- This is usually the top of the loop, but may be specified
- explicitly elsewhere. If not currently inside a loop,
- return 0 and do nothing; caller will print an error message. */
-
-int
-expand_continue_loop (whichloop)
- struct nesting *whichloop;
-{
- /* Emit information for branch prediction. */
- rtx note;
-
- note = emit_note (NULL, NOTE_INSN_PREDICTION);
- NOTE_PREDICTION (note) = NOTE_PREDICT (PRED_CONTINUE, IS_TAKEN);
- clear_last_expr ();
- if (whichloop == 0)
- whichloop = loop_stack;
- if (whichloop == 0)
- return 0;
- expand_goto_internal (NULL_TREE, whichloop->data.loop.continue_label,
- NULL_RTX);
- return 1;
-}
-
-/* Generate a jump to exit the current loop. If not currently inside a loop,
- return 0 and do nothing; caller will print an error message. */
-
-int
-expand_exit_loop (whichloop)
- struct nesting *whichloop;
-{
- clear_last_expr ();
- if (whichloop == 0)
- whichloop = loop_stack;
- if (whichloop == 0)
- return 0;
- expand_goto_internal (NULL_TREE, whichloop->data.loop.end_label, NULL_RTX);
- return 1;
-}
-
-/* Generate a conditional jump to exit the current loop if COND
- evaluates to zero. If not currently inside a loop,
- return 0 and do nothing; caller will print an error message. */
-
-int
-expand_exit_loop_if_false (whichloop, cond)
- struct nesting *whichloop;
- tree cond;
-{
- rtx label = gen_label_rtx ();
- rtx last_insn;
- clear_last_expr ();
-
- if (whichloop == 0)
- whichloop = loop_stack;
- if (whichloop == 0)
- return 0;
- /* In order to handle fixups, we actually create a conditional jump
- around an unconditional branch to exit the loop. If fixups are
- necessary, they go before the unconditional branch. */
-
- do_jump (cond, NULL_RTX, label);
- last_insn = get_last_insn ();
- if (GET_CODE (last_insn) == CODE_LABEL)
- whichloop->data.loop.alt_end_label = last_insn;
- expand_goto_internal (NULL_TREE, whichloop->data.loop.end_label,
- NULL_RTX);
- emit_label (label);
-
- return 1;
-}
-
-/* Like expand_exit_loop_if_false except also emit a note marking
- the end of the conditional. Should only be used immediately
- after expand_loop_start. */
-
-int
-expand_exit_loop_top_cond (whichloop, cond)
- struct nesting *whichloop;
- tree cond;
-{
- if (! expand_exit_loop_if_false (whichloop, cond))
- return 0;
-
- emit_note (NULL, NOTE_INSN_LOOP_END_TOP_COND);
- return 1;
-}
-
-/* Return nonzero if the loop nest is empty. Else return zero. */
-
-int
-stmt_loop_nest_empty ()
-{
- /* cfun->stmt can be NULL if we are building a call to get the
- EH context for a setjmp/longjmp EH target and the current
- function was a deferred inline function. */
- return (cfun->stmt == NULL || loop_stack == NULL);
-}
-
-/* Return nonzero if we should preserve sub-expressions as separate
- pseudos. We never do so if we aren't optimizing. We always do so
- if -fexpensive-optimizations.
-
- Otherwise, we only do so if we are in the "early" part of a loop. I.e.,
- the loop may still be a small one. */
-
-int
-preserve_subexpressions_p ()
-{
- rtx insn;
-
- if (flag_expensive_optimizations)
- return 1;
-
- if (optimize == 0 || cfun == 0 || cfun->stmt == 0 || loop_stack == 0)
- return 0;
-
- insn = get_last_insn_anywhere ();
-
- return (insn
- && (INSN_UID (insn) - INSN_UID (loop_stack->data.loop.start_label)
- < n_non_fixed_regs * 3));
-
-}
-
-/* Generate a jump to exit the current loop, conditional, binding contour
- or case statement. Not all such constructs are visible to this function,
- only those started with EXIT_FLAG nonzero. Individual languages use
- the EXIT_FLAG parameter to control which kinds of constructs you can
- exit this way.
-
- If not currently inside anything that can be exited,
- return 0 and do nothing; caller will print an error message. */
-
-int
-expand_exit_something ()
-{
- struct nesting *n;
- clear_last_expr ();
- for (n = nesting_stack; n; n = n->all)
- if (n->exit_label != 0)
- {
- expand_goto_internal (NULL_TREE, n->exit_label, NULL_RTX);
- return 1;
- }
-
- return 0;
-}
-\f
-/* Generate RTL to return from the current function, with no value.
- (That is, we do not do anything about returning any value.) */
-
-void
-expand_null_return ()
-{
- rtx last_insn;
-
- last_insn = get_last_insn ();
-
- /* If this function was declared to return a value, but we
- didn't, clobber the return registers so that they are not
- propagated live to the rest of the function. */
- clobber_return_register ();
-
- expand_null_return_1 (last_insn);
-}
-
-/* Try to guess whether the value of return means error code. */
-static enum br_predictor
-return_prediction (val)
- rtx val;
-{
- /* Different heuristics for pointers and scalars. */
- if (POINTER_TYPE_P (TREE_TYPE (DECL_RESULT (current_function_decl))))
- {
- /* NULL is usually not returned. */
- if (val == const0_rtx)
- return PRED_NULL_RETURN;
- }
- else
- {
- /* Negative return values are often used to indicate
- errors. */
- if (GET_CODE (val) == CONST_INT
- && INTVAL (val) < 0)
- return PRED_NEGATIVE_RETURN;
- /* Constant return values are also usually erors,
- zero/one often mean booleans so exclude them from the
- heuristics. */
- if (CONSTANT_P (val)
- && (val != const0_rtx && val != const1_rtx))
- return PRED_CONST_RETURN;
- }
- return PRED_NO_PREDICTION;
-}
-
-/* Generate RTL to return from the current function, with value VAL. */
-
-static void
-expand_value_return (val)
- rtx val;
-{
- rtx last_insn;
- rtx return_reg;
- enum br_predictor pred;
-
- if ((pred = return_prediction (val)) != PRED_NO_PREDICTION)
- {
- /* Emit information for branch prediction. */
- rtx note;
-
- note = emit_note (NULL, NOTE_INSN_PREDICTION);
-
- NOTE_PREDICTION (note) = NOTE_PREDICT (pred, NOT_TAKEN);
-
- }
-
- last_insn = get_last_insn ();
- return_reg = DECL_RTL (DECL_RESULT (current_function_decl));
-
- /* Copy the value to the return location
- unless it's already there. */