aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog36
-rw-r--r--gcc/Makefile.in24
-rw-r--r--gcc/cfglayout.c1
-rw-r--r--gcc/dce.c1
-rw-r--r--gcc/df-scan.c1
-rw-r--r--gcc/emit-rtl.c145
-rw-r--r--gcc/emit-rtl.h53
-rw-r--r--gcc/fwprop.c2
-rw-r--r--gcc/genautomata.c4
-rw-r--r--gcc/graph.c1
-rw-r--r--gcc/haifa-sched.c1
-rw-r--r--gcc/ira-build.c1
-rw-r--r--gcc/mode-switching.c1
-rw-r--r--gcc/reg-stack.c1
-rw-r--r--gcc/rtl.h19
-rw-r--r--gcc/rtlanal.c1
-rw-r--r--gcc/sel-sched-ir.c1
-rw-r--r--gcc/sel-sched.c1
18 files changed, 169 insertions, 125 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0ff31f1..d9a90e89 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,41 @@
2010-06-01 Jan Hubicka <jh@suse.cz>
+ * 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.
+
+2010-06-01 Jan Hubicka <jh@suse.cz>
+
* cgraph.h (tree_function_versioning): Update prototype.
(cgraph_function_versioning): Update prototype.
* cgraphunit.c (cgraph_copy_node_for_versioning): Accept bbs_to_copy
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index bbc4d2a..703dfe1 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2025,7 +2025,7 @@ c-pragma.o: c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
opts.h $(PLUGINS_H)
graph.o: graph.c $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H) $(FLAGS_H) output.h \
$(RTL_H) $(FUNCTION_H) hard-reg-set.h $(BASIC_BLOCK_H) graph.h $(OBSTACK_H) \
- $(CONFIG_H)
+ $(CONFIG_H) $(EMIT_RTL_H)
sbitmap.o: sbitmap.c sbitmap.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(BASIC_BLOCK_H)
ebitmap.o: ebitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(EBITMAP_H) $(RTL_H) $(FLAGS_H) $(OBSTACK_H)
@@ -2823,7 +2823,7 @@ print-rtl.o : print-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
rtlanal.o : rtlanal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H) \
$(RTL_H) hard-reg-set.h $(TM_P_H) insn-config.h $(RECOG_H) \
$(FLAGS_H) $(REGS_H) output.h $(TARGET_H) $(FUNCTION_H) $(TREE_H) \
- $(DF_H)
+ $(DF_H) $(EMIT_RTL_H)
varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) hard-reg-set.h $(REGS_H) \
@@ -3023,7 +3023,8 @@ cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
$(DF_H) $(DBGCNT_H)
dce.o : dce.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(EXCEPT_H) $(DF_H) cselib.h \
- $(DBGCNT_H) dce.h $(TIMEVAR_H) $(TREE_PASS_H) $(DBGCNT_H) $(TM_P_H)
+ $(DBGCNT_H) dce.h $(TIMEVAR_H) $(TREE_PASS_H) $(DBGCNT_H) $(TM_P_H) \
+ $(EMIT_RTL_H)
dse.o : dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(TM_P_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
$(RECOG_H) $(EXPR_H) $(DF_H) cselib.h $(DBGCNT_H) $(TIMEVAR_H) \
@@ -3061,7 +3062,7 @@ lcm.o : lcm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
mode-switching.o : mode-switching.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
$(INSN_ATTR_H) $(RECOG_H) $(BASIC_BLOCK_H) $(TM_P_H) $(FUNCTION_H) \
- output.h $(TREE_PASS_H) $(TIMEVAR_H) $(DF_H) $(TARGET_H)
+ output.h $(TREE_PASS_H) $(TIMEVAR_H) $(DF_H) $(TARGET_H) $(EMIT_RTL_H)
tree-ssa-dce.o : tree-ssa-dce.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
$(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) \
coretypes.h $(TREE_DUMP_H) $(TREE_PASS_H) $(FLAGS_H) $(BASIC_BLOCK_H) \
@@ -3107,7 +3108,7 @@ df-scan.o : df-scan.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
insn-config.h $(RECOG_H) $(FUNCTION_H) $(REGS_H) alloc-pool.h \
hard-reg-set.h $(BASIC_BLOCK_H) $(DF_H) $(BITMAP_H) sbitmap.h $(TIMEVAR_H) \
$(TM_P_H) $(FLAGS_H) $(TARGET_H) $(TARGET_DEF_H) $(TREE_H) output.h \
- $(TREE_PASS_H)
+ $(TREE_PASS_H) $(EMIT_RTL_H)
df-byte-scan.o : df-byte-scan.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TM_P_H) $(DF_H) output.h $(DBGCNT_H)
regstat.o : regstat.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
@@ -3318,7 +3319,7 @@ modulo-sched.o : modulo-sched.c $(DDG_H) $(CONFIG_H) $(CONFIG_H) $(SYSTEM_H) \
haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h $(FUNCTION_H) \
$(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) $(EXCEPT_H) $(TM_P_H) $(TARGET_H) output.h \
- $(PARAMS_H) $(DBGCNT_H) $(CFGLOOP_H) ira.h
+ $(PARAMS_H) $(DBGCNT_H) $(CFGLOOP_H) ira.h $(EMIT_RTL_H)
sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
$(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) $(EXCEPT_H) cselib.h \
@@ -3340,7 +3341,7 @@ sel-sched.o : sel-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
$(TM_P_H) output.h $(TARGET_H) $(TIMEVAR_H) $(TREE_PASS_H) \
$(SCHED_INT_H) $(GGC_H) $(TREE_H) langhooks.h rtlhooks-def.h \
- $(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H) sel-sched.h $(DBGCNT_H)
+ $(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H) sel-sched.h $(DBGCNT_H) $(EMIT_RTL_H)
sel-sched-dump.o : sel-sched-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
$(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
@@ -3351,7 +3352,8 @@ sel-sched-ir.o : sel-sched-ir.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
$(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
$(TM_P_H) $(TARGET_H) $(TIMEVAR_H) $(TREE_PASS_H) $(SCHED_INT_H) $(GGC_H) \
- $(TREE_H) langhooks.h rtlhooks-def.h $(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H)
+ $(TREE_H) langhooks.h rtlhooks-def.h $(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H) \
+ $(EMIT_RTL_H)
final.o : final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) intl.h $(REGS_H) $(RECOG_H) conditions.h \
insn-config.h $(INSN_ATTR_H) $(FUNCTION_H) output.h hard-reg-set.h \
@@ -3368,7 +3370,7 @@ reg-stack.o : reg-stack.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
insn-config.h $(TOPLEV_H) reload.h $(FUNCTION_H) $(TM_P_H) $(GGC_H) \
$(BASIC_BLOCK_H) $(CFGLAYOUT_H) output.h $(TIMEVAR_H) \
- $(TREE_PASS_H) $(TARGET_H) vecprim.h $(DF_H)
+ $(TREE_PASS_H) $(TARGET_H) vecprim.h $(DF_H) $(EMIT_RTL_H)
sreal.o: sreal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) sreal.h
predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) \
@@ -3390,7 +3392,7 @@ cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h \
$(FUNCTION_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(TARGET_H) gt-cfglayout.h \
$(GGC_H) alloc-pool.h $(FLAGS_H) $(OBSTACK_H) $(TREE_PASS_H) vecprim.h \
- $(DF_H)
+ $(DF_H) $(EMIT_RTL_H)
timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TIMEVAR_H) $(FLAGS_H) intl.h $(TOPLEV_H) $(RTL_H) timevar.def
regcprop.o : regcprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
@@ -3490,7 +3492,7 @@ insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
insn-config.h $(TOPLEV_H) $(RECOG_H) $(TM_P_H) $(FLAGS_H)
insn-automata.o : insn-automata.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(REGS_H) output.h $(INSN_ATTR_H) \
- insn-config.h $(TOPLEV_H) $(RECOG_H) $(TM_P_H) $(FLAGS_H)
+ insn-config.h $(TOPLEV_H) $(RECOG_H) $(TM_P_H) $(FLAGS_H) $(EMIT_RTL_H)
insn-emit.o : insn-emit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TM_P_H) $(FUNCTION_H) $(EXPR_H) $(OPTABS_H) \
dfp.h $(FLAGS_H) output.h insn-config.h hard-reg-set.h $(RECOG_H) \
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 62ca643..58c0478 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "df.h"
#include "vecprim.h"
+#include "emit-rtl.h"
/* Holds the interesting trailing notes for the function. */
rtx cfg_layout_function_footer;
diff --git a/gcc/dce.c b/gcc/dce.c
index 855bef3..12f3af0 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "dbgcnt.h"
#include "tm_p.h"
+#include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */
/* -------------------------------------------------------------------------
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index c7548f6..bf285a1 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see
#include "target-def.h"
#include "df.h"
#include "tree-pass.h"
+#include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */
DEF_VEC_P(df_ref);
DEF_VEC_ALLOC_P_STACK(df_ref);
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
diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h
index 01479e1..704f901 100644
--- a/gcc/emit-rtl.h
+++ b/gcc/emit-rtl.h
@@ -51,4 +51,57 @@ extern rtx replace_equiv_address (rtx, rtx);
/* Likewise, but the reference is not required to be valid. */
extern rtx replace_equiv_address_nv (rtx, rtx);
+extern rtx gen_blockage (void);
+extern rtvec gen_rtvec (int, ...);
+extern rtx copy_insn_1 (rtx);
+extern rtx copy_insn (rtx);
+extern rtx gen_int_mode (HOST_WIDE_INT, enum machine_mode);
+extern rtx emit_copy_of_insn_after (rtx, rtx);
+extern void set_reg_attrs_from_value (rtx, rtx);
+extern void set_reg_attrs_for_parm (rtx, rtx);
+extern void set_reg_attrs_for_decl_rtl (tree t, rtx x);
+extern void adjust_reg_mode (rtx, enum machine_mode);
+extern int mem_expr_equal_p (const_tree, const_tree);
+
+/* Return the first insn of the current sequence or current function. */
+
+static inline rtx
+get_insns (void)
+{
+ return crtl->emit.x_first_insn;
+}
+
+/* Specify a new insn as the first in the chain. */
+
+static inline void
+set_first_insn (rtx insn)
+{
+ gcc_assert (!insn || !PREV_INSN (insn));
+ crtl->emit.x_first_insn = insn;
+}
+
+/* Return the last insn emitted in current sequence or current function. */
+
+static inline rtx
+get_last_insn (void)
+{
+ return crtl->emit.x_last_insn;
+}
+
+/* Specify a new insn as the last in the chain. */
+
+static inline void
+set_last_insn (rtx insn)
+{
+ gcc_assert (!insn || !NEXT_INSN (insn));
+ crtl->emit.x_last_insn = insn;
+}
+
+/* Return a number larger than any instruction's uid in this function. */
+
+static inline int
+get_max_uid (void)
+{
+ return crtl->emit.x_cur_insn_uid;
+}
#endif /* GCC_EMIT_RTL_H */
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index 6e65093..5085805 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "rtl.h"
#include "tm_p.h"
-#include "emit-rtl.h"
#include "insn-config.h"
#include "recog.h"
#include "flags.h"
@@ -40,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "tree-pass.h"
#include "domwalk.h"
+#include "emit-rtl.h"
/* This pass does simple forward propagation and simplification when an
diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index beda6cd..4c58d35 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -9569,7 +9569,9 @@ main (int argc, char **argv)
"#include \"insn-attr.h\"\n"
"#include \"toplev.h\"\n"
"#include \"flags.h\"\n"
- "#include \"function.h\"\n");
+ "#include \"function.h\"\n"
+ "#include \"emit-rtl.h\"\n");
+ /* FIXME: emit-rtl.h can go away once crtl is in rtl.h. */
write_automata ();
}
diff --git a/gcc/graph.c b/gcc/graph.c
index 38e7294..04227a4 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "toplev.h"
#include "graph.h"
+#include "emit-rtl.h"
static const char *const graph_ext[] =
{
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index b15fe63..2effed2 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -148,6 +148,7 @@ along with GCC; see the file COPYING3. If not see
#include "dbgcnt.h"
#include "cfgloop.h"
#include "ira.h"
+#include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */
#ifdef INSN_SCHEDULING
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index 3bd98f6..502b0f6 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "reload.h"
#include "sparseset.h"
#include "ira-int.h"
+#include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */
static ira_copy_t find_allocno_copy (ira_allocno_t, ira_allocno_t, rtx,
ira_loop_tree_node_t);
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index fa119d0..c0db7c4 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "timevar.h"
#include "df.h"
+#include "emit-rtl.h"
/* We want target macros for the mode switching code to be able to refer
to instruction attribute values. */
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index b59bcff..43af91d 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -175,6 +175,7 @@
#include "target.h"
#include "df.h"
#include "vecprim.h"
+#include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */
#ifdef STACK_REGS
diff --git a/gcc/rtl.h b/gcc/rtl.h
index f9e6373..107bb9c 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1051,7 +1051,6 @@ rhs_regno (const_rtx x)
}
-
/* 1 if RTX is a reg or parallel that is the current function's return
value. */
#define REG_FUNCTION_VALUE_P(RTX) \
@@ -1551,19 +1550,6 @@ extern int ceil_log2 (unsigned HOST_WIDE_INT);
extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, enum machine_mode);
extern rtx plus_constant (rtx, HOST_WIDE_INT);
-/* In emit-rtl.c */
-extern rtx gen_blockage (void);
-extern rtvec gen_rtvec (int, ...);
-extern rtx copy_insn_1 (rtx);
-extern rtx copy_insn (rtx);
-extern rtx gen_int_mode (HOST_WIDE_INT, enum machine_mode);
-extern rtx emit_copy_of_insn_after (rtx, rtx);
-extern void set_reg_attrs_from_value (rtx, rtx);
-extern void set_reg_attrs_for_parm (rtx, rtx);
-extern void set_reg_attrs_for_decl_rtl (tree t, rtx x);
-extern void adjust_reg_mode (rtx, enum machine_mode);
-extern int mem_expr_equal_p (const_tree, const_tree);
-
/* In rtl.c */
extern rtx rtx_alloc_stat (RTX_CODE MEM_STAT_DECL);
#define rtx_alloc(c) rtx_alloc_stat (c MEM_STAT_INFO)
@@ -1613,9 +1599,7 @@ extern rtx convert_memory_address_addr_space (enum machine_mode, rtx,
addr_space_t);
#define convert_memory_address(to_mode,x) \
convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
-extern rtx get_insns (void);
extern const char *get_insn_name (int);
-extern rtx get_last_insn (void);
extern rtx get_last_insn_anywhere (void);
extern rtx get_first_nonnote_insn (void);
extern rtx get_last_nonnote_insn (void);
@@ -2216,7 +2200,6 @@ extern void reset_used_flags (rtx);
extern void set_used_flags (rtx);
extern void reorder_insns (rtx, rtx, rtx);
extern void reorder_insns_nobb (rtx, rtx, rtx);
-extern int get_max_uid (void);
extern int get_max_insn_count (void);
extern int in_sequence_p (void);
extern void force_next_line_note (void);
@@ -2230,8 +2213,6 @@ extern unsigned int unshare_all_rtl (void);
extern void unshare_all_rtl_again (rtx);
extern void unshare_all_rtl_in_chain (rtx);
extern void verify_rtl_sharing (void);
-extern void set_first_insn (rtx);
-extern void set_last_insn (rtx);
extern void link_cc0_insns (rtx);
extern void add_insn (rtx);
extern void add_insn_before (rtx, rtx, struct basic_block_def *);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index f5dc0bb..a360873 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "df.h"
#include "tree.h"
+#include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */
/* Forward declarations */
static void set_of_1 (rtx, const_rtx, void *);
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index e11968e..e831a78 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "vec.h"
#include "langhooks.h"
#include "rtlhooks-def.h"
+#include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */
#ifdef INSN_SCHEDULING
#include "sel-sched-ir.h"
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 0981440..8590b8a 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "rtlhooks-def.h"
#include "output.h"
+#include "emit-rtl.h"
#ifdef INSN_SCHEDULING
#include "sel-sched-ir.h"