refactor emit_*_{after,before}_noloc using common functions

refactor emit_*_{after,before}_noloc using common functions
	* emit-rtl.c (emit_pattern_before_noloc): New function.
	(emit_insn_before_noloc, emit_jump_insn_before_noloc): Call it.
	(emit_call_insn_before_noloc, emit_debug_insn_before_noloc): Likewise.
	(emit_pattern_after_noloc): New function.
	(emit_insn_after_noloc, emit_jump_insn_after_noloc): Call it.
	(emit_call_insn_after_noloc, emit_debug_insn_after_noloc): Likewise.

From-SVN: r171339
This commit is contained in:
Nathan Froyd 2011-03-23 01:56:12 +00:00 committed by Nathan Froyd
parent fdf3e18a14
commit 5f02387d74
2 changed files with 43 additions and 207 deletions

View File

@ -1,3 +1,12 @@
2011-03-22 Nathan Froyd <froydnj@codesourcery.com>
* emit-rtl.c (emit_pattern_before_noloc): New function.
(emit_insn_before_noloc, emit_jump_insn_before_noloc): Call it.
(emit_call_insn_before_noloc, emit_debug_insn_before_noloc): Likewise.
(emit_pattern_after_noloc): New function.
(emit_insn_after_noloc, emit_jump_insn_after_noloc): Call it.
(emit_call_insn_after_noloc, emit_debug_insn_after_noloc): Likewise.
2011-03-22 Nathan Froyd <froydnj@codesourcery.com>
* libgcc2.c (__lshrdi3, __ashldi3, __ashrdi3): Use W_TYPE_SIZE.

View File

@ -4022,12 +4022,10 @@ reorder_insns (rtx from, rtx to, rtx after)
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);
@ -4061,7 +4059,7 @@ emit_insn_before_noloc (rtx x, rtx before, basic_block bb)
#endif
default:
last = make_insn_raw (x);
last = (*make_raw) (x);
add_insn_before (last, before, bb);
break;
}
@ -4069,48 +4067,22 @@ emit_insn_before_noloc (rtx x, rtx before, basic_block bb)
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
@ -4119,42 +4091,8 @@ emit_jump_insn_before_noloc (rtx x, rtx before)
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
@ -4163,42 +4101,8 @@ emit_call_insn_before_noloc (rtx x, rtx before)
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
@ -4292,11 +4196,9 @@ emit_insn_after_1 (rtx first, rtx after, basic_block bb)
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;
@ -4324,7 +4226,7 @@ emit_insn_after_noloc (rtx x, rtx after, basic_block bb)
#endif
default:
last = make_insn_raw (x);
last = (*make_raw) (x);
add_insn_after (last, after, bb);
break;
}
@ -4332,6 +4234,15 @@ emit_insn_after_noloc (rtx x, rtx after, basic_block bb)
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. */
@ -4339,35 +4250,7 @@ emit_insn_after_noloc (rtx x, rtx after, basic_block bb)
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
@ -4376,35 +4259,7 @@ emit_jump_insn_after_noloc (rtx x, rtx after)
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
@ -4413,35 +4268,7 @@ emit_call_insn_after_noloc (rtx x, rtx after)
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