SEQUENCE rtl results in much fragmented RTL memory since the SEQUENCE
generated would almost certainly die right after it was created. */
-/* Make X be output before the instruction BEFORE. */
-
-rtx
-emit_insn_before_noloc (rtx x, rtx before, basic_block bb)
+static rtx
+emit_pattern_before_noloc (rtx x, rtx before, rtx last, basic_block bb,
+ rtx (*make_raw) (rtx))
{
- rtx last = before;
rtx insn;
gcc_assert (before);
#endif
default:
- last = make_insn_raw (x);
+ last = (*make_raw) (x);
add_insn_before (last, before, bb);
break;
}
return last;
}
+/* Make X be output before the instruction BEFORE. */
+
+rtx
+emit_insn_before_noloc (rtx x, rtx before, basic_block bb)
+{
+ return emit_pattern_before_noloc (x, before, before, bb, make_insn_raw);
+}
+
/* Make an instruction with body X and code JUMP_INSN
and output it before the instruction BEFORE. */
rtx
emit_jump_insn_before_noloc (rtx x, rtx before)
{
- rtx insn, last = NULL_RTX;
-
- gcc_assert (before);
-
- switch (GET_CODE (x))
- {
- case DEBUG_INSN:
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case CODE_LABEL:
- case BARRIER:
- case NOTE:
- insn = x;
- while (insn)
- {
- rtx next = NEXT_INSN (insn);
- add_insn_before (insn, before, NULL);
- last = insn;
- insn = next;
- }
- break;
-
-#ifdef ENABLE_RTL_CHECKING
- case SEQUENCE:
- gcc_unreachable ();
- break;
-#endif
-
- default:
- last = make_jump_insn_raw (x);
- add_insn_before (last, before, NULL);
- break;
- }
-
- return last;
+ return emit_pattern_before_noloc (x, before, NULL_RTX, NULL,
+ make_jump_insn_raw);
}
/* Make an instruction with body X and code CALL_INSN
rtx
emit_call_insn_before_noloc (rtx x, rtx before)
{
- rtx last = NULL_RTX, insn;
-
- gcc_assert (before);
-
- switch (GET_CODE (x))
- {
- case DEBUG_INSN:
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case CODE_LABEL:
- case BARRIER:
- case NOTE:
- insn = x;
- while (insn)
- {
- rtx next = NEXT_INSN (insn);
- add_insn_before (insn, before, NULL);
- last = insn;
- insn = next;
- }
- break;
-
-#ifdef ENABLE_RTL_CHECKING
- case SEQUENCE:
- gcc_unreachable ();
- break;
-#endif
-
- default:
- last = make_call_insn_raw (x);
- add_insn_before (last, before, NULL);
- break;
- }
-
- return last;
+ return emit_pattern_before_noloc (x, before, NULL_RTX, NULL,
+ make_call_insn_raw);
}
/* Make an instruction with body X and code DEBUG_INSN
rtx
emit_debug_insn_before_noloc (rtx x, rtx before)
{
- rtx last = NULL_RTX, insn;
-
- gcc_assert (before);
-
- switch (GET_CODE (x))
- {
- case DEBUG_INSN:
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case CODE_LABEL:
- case BARRIER:
- case NOTE:
- insn = x;
- while (insn)
- {
- rtx next = NEXT_INSN (insn);
- add_insn_before (insn, before, NULL);
- last = insn;
- insn = next;
- }
- break;
-
-#ifdef ENABLE_RTL_CHECKING
- case SEQUENCE:
- gcc_unreachable ();
- break;
-#endif
-
- default:
- last = make_debug_insn_raw (x);
- add_insn_before (last, before, NULL);
- break;
- }
-
- return last;
+ return emit_pattern_before_noloc (x, before, NULL_RTX, NULL,
+ make_debug_insn_raw);
}
/* Make an insn of code BARRIER
return last;
}
-/* Make X be output after the insn AFTER and set the BB of insn. If
- BB is NULL, an attempt is made to infer the BB from AFTER. */
-
-rtx
-emit_insn_after_noloc (rtx x, rtx after, basic_block bb)
+static rtx
+emit_pattern_after_noloc (rtx x, rtx after, basic_block bb,
+ rtx (*make_raw)(rtx))
{
rtx last = after;
#endif
default:
- last = make_insn_raw (x);
+ last = (*make_raw) (x);
add_insn_after (last, after, bb);
break;
}
return last;
}
+/* Make X be output after the insn AFTER and set the BB of insn. If
+ BB is NULL, an attempt is made to infer the BB from AFTER. */
+
+rtx
+emit_insn_after_noloc (rtx x, rtx after, basic_block bb)
+{
+ return emit_pattern_after_noloc (x, after, bb, make_insn_raw);
+}
+
/* Make an insn of code JUMP_INSN with body X
and output it after the insn AFTER. */
rtx
emit_jump_insn_after_noloc (rtx x, rtx after)
{
- rtx last;
-
- gcc_assert (after);
-
- switch (GET_CODE (x))
- {
- case DEBUG_INSN:
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case CODE_LABEL:
- case BARRIER:
- case NOTE:
- last = emit_insn_after_1 (x, after, NULL);
- break;
-
-#ifdef ENABLE_RTL_CHECKING
- case SEQUENCE:
- gcc_unreachable ();
- break;
-#endif
-
- default:
- last = make_jump_insn_raw (x);
- add_insn_after (last, after, NULL);
- break;
- }
-
- return last;
+ return emit_pattern_after_noloc (x, after, NULL, make_jump_insn_raw);
}
/* Make an instruction with body X and code CALL_INSN
rtx
emit_call_insn_after_noloc (rtx x, rtx after)
{
- rtx last;
-
- gcc_assert (after);
-
- switch (GET_CODE (x))
- {
- case DEBUG_INSN:
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case CODE_LABEL:
- case BARRIER:
- case NOTE:
- last = emit_insn_after_1 (x, after, NULL);
- break;
-
-#ifdef ENABLE_RTL_CHECKING
- case SEQUENCE:
- gcc_unreachable ();
- break;
-#endif
-
- default:
- last = make_call_insn_raw (x);
- add_insn_after (last, after, NULL);
- break;
- }
-
- return last;
+ return emit_pattern_after_noloc (x, after, NULL, make_call_insn_raw);
}
/* Make an instruction with body X and code CALL_INSN
rtx
emit_debug_insn_after_noloc (rtx x, rtx after)
{
- rtx last;
-
- gcc_assert (after);
-
- switch (GET_CODE (x))
- {
- case DEBUG_INSN:
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case CODE_LABEL:
- case BARRIER:
- case NOTE:
- last = emit_insn_after_1 (x, after, NULL);
- break;
-
-#ifdef ENABLE_RTL_CHECKING
- case SEQUENCE:
- gcc_unreachable ();
- break;
-#endif
-
- default:
- last = make_debug_insn_raw (x);
- add_insn_after (last, after, NULL);
- break;
- }
-
- return last;
+ return emit_pattern_after_noloc (x, after, NULL, make_debug_insn_raw);
}
/* Make an insn of code BARRIER