aboutsummaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-06-01 17:49:37 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-06-01 15:49:37 +0000
commit5936d944f8fffbb02f9c694645d37f60603a8a25 (patch)
tree1b6ee9a54e64f4b81990716e8025ba5a494502fc /gcc/emit-rtl.c
parent91382288079e2b47f7a18252051036e4f76c6ada (diff)
downloadgcc-5936d944f8fffbb02f9c694645d37f60603a8a25.zip
gcc-5936d944f8fffbb02f9c694645d37f60603a8a25.tar.gz
gcc-5936d944f8fffbb02f9c694645d37f60603a8a25.tar.bz2
fwprop.c: Make emit-rtl.h include last.
* fwprop.c: Make emit-rtl.h include last. * rtlanal.c: Include emit-rtl.h. * genautomata.c: Output emit-rtl include into insn-automata.c * df-scan.c: Include emit-rtl.h. * haifa-sched.c: Indlude emit-rtl.h. * mode-switching.c: Indlude emit-rtl.h. * graph.c: Indlude emit-rtl.h. * sel-sched.c: Include emit-rtl.h. * sel-sched-ir.c: Include emit-rtl.h. * ira-build.c: Include emit-rtl.h. * emit-rtl.c: (first_insn, last_insn): Remove defines. (get_insns, set_first_insn, get_last_insn, set_last_insn, get_max_uid): Move to emit-rtl.h. (set_new_first_and_last_insn, get_last_insn_anywhere, get_first_nonnote_insn, get_last_nonnote_insn, try_split, make_call_insn_raw, add_insn_after, add_insn_before, remove_insn, delete_insns_since, reorder_insns_nobb, emit_insn_after_1, emit_debug_insn_before, emit_insn, start_sequence, push_to_sequence, push_to_sequence2, push_topmost_sequence, end_sequence, copy_insn): Use accessor functions. * emit-rtl.h (gen_blockage, gen_rtvec, copy_insn_1, copy_insn, gen_int_mode, emit_copy_of_insn_after, set_reg_attrs_from_value, set_reg_attrs_for_parm, set_reg_attrs_for_decl_rtl, adjust_reg_mode, mem_expr_equal_p): Move here from rtl.h (get_insns, set_first-insn, get_last_insn, set_last_insn, get_max_uid): Move here from emit-rtl.c; make inline. * cfglayout.h: Include emit-rtl.h * rtl.h (gen_blockage, gen_rtvec, copy_insn_1, copy_insn, gen_int_mode, emit_copy_of_insn_after, set_reg_attrs_from_value, set_reg_attrs_for_parm, set_reg_attrs_for_decl_rtl, adjust_reg_mode, mem_expr_equal_p, get_insns, set_first-insn, get_last_insn, set_last_insn, get_max_uid): Move to emit-rtl.h. * reg-stack.c: Include emit-rtl.h * dce.c: Likewise. From-SVN: r160111
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c145
1 files changed, 52 insertions, 93 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index c1d2468..d51481f 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -167,8 +167,6 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
htab_t const_fixed_htab;
-#define first_insn (crtl->emit.x_first_insn)
-#define last_insn (crtl->emit.x_last_insn)
#define cur_insn_uid (crtl->emit.x_cur_insn_uid)
#define cur_debug_insn_uid (crtl->emit.x_cur_debug_insn_uid)
#define last_location (crtl->emit.x_last_location)
@@ -2317,8 +2315,8 @@ set_new_first_and_last_insn (rtx first, rtx last)
{
rtx insn;
- first_insn = first;
- last_insn = last;
+ set_first_insn (first);
+ set_last_insn (last);
cur_insn_uid = 0;
if (MIN_NONDEBUG_INSN_UID || MAY_HAVE_DEBUG_INSNS)
@@ -2926,48 +2924,14 @@ make_safe_from (rtx x, rtx other)
/* Emission of insns (adding them to the doubly-linked list). */
-/* Return the first insn of the current sequence or current function. */
-
-rtx
-get_insns (void)
-{
- return first_insn;
-}
-
-/* Specify a new insn as the first in the chain. */
-
-void
-set_first_insn (rtx insn)
-{
- gcc_assert (!PREV_INSN (insn));
- first_insn = insn;
-}
-
-/* Return the last insn emitted in current sequence or current function. */
-
-rtx
-get_last_insn (void)
-{
- return last_insn;
-}
-
-/* Specify a new insn as the last in the chain. */
-
-void
-set_last_insn (rtx insn)
-{
- gcc_assert (!NEXT_INSN (insn));
- last_insn = insn;
-}
-
/* Return the last insn emitted, even if it is in a sequence now pushed. */
rtx
get_last_insn_anywhere (void)
{
struct sequence_stack *stack;
- if (last_insn)
- return last_insn;
+ if (get_last_insn ())
+ return get_last_insn ();
for (stack = seq_stack; stack; stack = stack->next)
if (stack->last != 0)
return stack->last;
@@ -2980,7 +2944,7 @@ get_last_insn_anywhere (void)
rtx
get_first_nonnote_insn (void)
{
- rtx insn = first_insn;
+ rtx insn = get_insns ();
if (insn)
{
@@ -3006,7 +2970,7 @@ get_first_nonnote_insn (void)
rtx
get_last_nonnote_insn (void)
{
- rtx insn = last_insn;
+ rtx insn = get_last_insn ();
if (insn)
{
@@ -3027,14 +2991,6 @@ get_last_nonnote_insn (void)
return insn;
}
-/* Return a number larger than any instruction's uid in this function. */
-
-int
-get_max_uid (void)
-{
- return cur_insn_uid;
-}
-
/* Return the number of actual (non-debug) insns emitted in this
function. */
@@ -3625,7 +3581,7 @@ try_split (rtx pat, rtx trial, int last)
/* Return either the first or the last insn, depending on which was
requested. */
return last
- ? (after ? PREV_INSN (after) : last_insn)
+ ? (after ? PREV_INSN (after) : get_last_insn ())
: NEXT_INSN (before);
}
@@ -3728,16 +3684,16 @@ make_call_insn_raw (rtx pattern)
void
add_insn (rtx insn)
{
- PREV_INSN (insn) = last_insn;
+ PREV_INSN (insn) = get_last_insn();
NEXT_INSN (insn) = 0;
- if (NULL != last_insn)
- NEXT_INSN (last_insn) = insn;
+ if (NULL != get_last_insn())
+ NEXT_INSN (get_last_insn ()) = insn;
- if (NULL == first_insn)
- first_insn = insn;
+ if (NULL == get_insns ())
+ set_first_insn (insn);
- last_insn = insn;
+ set_last_insn (insn);
}
/* Add INSN into the doubly-linked list after insn AFTER. This and
@@ -3761,8 +3717,8 @@ add_insn_after (rtx insn, rtx after, basic_block bb)
if (NONJUMP_INSN_P (next) && GET_CODE (PATTERN (next)) == SEQUENCE)
PREV_INSN (XVECEXP (PATTERN (next), 0, 0)) = insn;
}
- else if (last_insn == after)
- last_insn = insn;
+ else if (get_last_insn () == after)
+ set_last_insn (insn);
else
{
struct sequence_stack *stack = seq_stack;
@@ -3826,8 +3782,8 @@ add_insn_before (rtx insn, rtx before, basic_block bb)
NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = insn;
}
}
- else if (first_insn == before)
- first_insn = insn;
+ else if (get_insns () == before)
+ set_first_insn (insn);
else
{
struct sequence_stack *stack = seq_stack;
@@ -3898,8 +3854,11 @@ remove_insn (rtx insn)
NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = next;
}
}
- else if (first_insn == insn)
- first_insn = next;
+ else if (get_insns () == insn)
+ {
+ PREV_INSN (next) = NULL;
+ set_first_insn (next);
+ }
else
{
struct sequence_stack *stack = seq_stack;
@@ -3920,8 +3879,8 @@ remove_insn (rtx insn)
if (NONJUMP_INSN_P (next) && GET_CODE (PATTERN (next)) == SEQUENCE)
PREV_INSN (XVECEXP (PATTERN (next), 0, 0)) = prev;
}
- else if (last_insn == insn)
- last_insn = prev;
+ else if (get_last_insn () == insn)
+ set_last_insn (prev);
else
{
struct sequence_stack *stack = seq_stack;
@@ -3982,10 +3941,10 @@ void
delete_insns_since (rtx from)
{
if (from == 0)
- first_insn = 0;
+ set_first_insn (0);
else
NEXT_INSN (from) = 0;
- last_insn = from;
+ set_last_insn (from);
}
/* This function is deprecated, please use sequences instead.
@@ -4006,10 +3965,10 @@ reorder_insns_nobb (rtx from, rtx to, rtx after)
NEXT_INSN (PREV_INSN (from)) = NEXT_INSN (to);
if (NEXT_INSN (to))
PREV_INSN (NEXT_INSN (to)) = PREV_INSN (from);
- if (last_insn == to)
- last_insn = PREV_INSN (from);
- if (first_insn == from)
- first_insn = NEXT_INSN (to);
+ if (get_last_insn () == to)
+ set_last_insn (PREV_INSN (from));
+ if (get_insns () == from)
+ set_first_insn (NEXT_INSN (to));
/* Make the new neighbors point to it and it to them. */
if (NEXT_INSN (after))
@@ -4018,8 +3977,8 @@ reorder_insns_nobb (rtx from, rtx to, rtx after)
NEXT_INSN (to) = NEXT_INSN (after);
PREV_INSN (from) = after;
NEXT_INSN (after) = from;
- if (after == last_insn)
- last_insn = to;
+ if (after == get_last_insn())
+ set_last_insn (to);
}
/* Same as function above, but take care to update BB boundaries. */
@@ -4344,8 +4303,8 @@ emit_insn_after_1 (rtx first, rtx after, basic_block bb)
if (after_after)
PREV_INSN (after_after) = last;
- if (after == last_insn)
- last_insn = last;
+ if (after == get_last_insn())
+ set_last_insn (last);
return last;
}
@@ -4842,7 +4801,7 @@ emit_debug_insn_before (rtx pattern, rtx before)
rtx
emit_insn (rtx x)
{
- rtx last = last_insn;
+ rtx last = get_last_insn();
rtx insn;
if (x == NULL_RTX)
@@ -4888,7 +4847,7 @@ emit_insn (rtx x)
rtx
emit_debug_insn (rtx x)
{
- rtx last = last_insn;
+ rtx last = get_last_insn();
rtx insn;
if (x == NULL_RTX)
@@ -5283,13 +5242,13 @@ start_sequence (void)
tem = GGC_NEW (struct sequence_stack);
tem->next = seq_stack;
- tem->first = first_insn;
- tem->last = last_insn;
+ tem->first = get_insns ();
+ tem->last = get_last_insn ();
seq_stack = tem;
- first_insn = 0;
- last_insn = 0;
+ set_first_insn (0);
+ set_last_insn (0);
}
/* Set up the insn chain starting with FIRST as the current sequence,
@@ -5305,8 +5264,8 @@ push_to_sequence (rtx first)
for (last = first; last && NEXT_INSN (last); last = NEXT_INSN (last));
- first_insn = first;
- last_insn = last;
+ set_first_insn (first);
+ set_last_insn (last);
}
/* Like push_to_sequence, but take the last insn as an argument to avoid
@@ -5317,8 +5276,8 @@ push_to_sequence2 (rtx first, rtx last)
{
start_sequence ();
- first_insn = first;
- last_insn = last;
+ set_first_insn (first);
+ set_last_insn (last);
}
/* Set up the outer-level insn chain
@@ -5334,8 +5293,8 @@ push_topmost_sequence (void)
for (stack = seq_stack; stack; stack = stack->next)
top = stack;
- first_insn = top->first;
- last_insn = top->last;
+ set_first_insn (top->first);
+ set_last_insn (top->last);
}
/* After emitting to the outer-level insn chain, update the outer-level
@@ -5349,8 +5308,8 @@ pop_topmost_sequence (void)
for (stack = seq_stack; stack; stack = stack->next)
top = stack;
- top->first = first_insn;
- top->last = last_insn;
+ top->first = get_insns ();
+ top->last = get_last_insn ();
end_sequence ();
}
@@ -5373,8 +5332,8 @@ end_sequence (void)
{
struct sequence_stack *tem = seq_stack;
- first_insn = tem->first;
- last_insn = tem->last;
+ set_first_insn (tem->first);
+ set_last_insn (tem->last);
seq_stack = tem->next;
memset (tem, 0, sizeof (*tem));
@@ -5576,8 +5535,8 @@ copy_insn (rtx insn)
void
init_emit (void)
{
- first_insn = NULL;
- last_insn = NULL;
+ set_first_insn (NULL);
+ set_last_insn (NULL);
if (MIN_NONDEBUG_INSN_UID)
cur_insn_uid = MIN_NONDEBUG_INSN_UID;
else