From 4586b4cadc3bbcbc9a171ffc9124fc622858a514 Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Thu, 29 Jul 2004 07:37:16 +0000 Subject: [PATCH] rtl.c (currently_expanding_to_rtl): New. * rtl.c (currently_expanding_to_rtl): New. * rtl.h (currently_expanding_to_rtl): Export it. * cfgexpand.c (tree_cfg_expand): Set/clear it at entry/exit. * config/alpha/alpha.c (alpha_expand_mov): Remove old RTL inliner hack. * config/sh/sh.c: Replace rtx_equal_function_value_matters with currently_expanding_to_rtl. * config/sh/sh.md: Likewise. * config/ia64/ia64.c (got_symbolic_operand): Likewise. From-SVN: r85287 --- gcc/ChangeLog | 13 +++++++++++++ gcc/cfgexpand.c | 6 ++++++ gcc/config/alpha/alpha.c | 17 ----------------- gcc/config/ia64/ia64.c | 2 +- gcc/config/sh/sh.c | 11 ++++------- gcc/config/sh/sh.md | 20 ++++++++++---------- gcc/rtl.c | 4 ++++ gcc/rtl.h | 3 +++ 8 files changed, 41 insertions(+), 35 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 12ae194fe3a..9c5b5237ad6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2004-07-29 Steven Bosscher + + * rtl.c (currently_expanding_to_rtl): New. + * rtl.h (currently_expanding_to_rtl): Export it. + * cfgexpand.c (tree_cfg_expand): Set/clear it at entry/exit. + + * config/alpha/alpha.c (alpha_expand_mov): Remove old RTL + inliner hack. + * config/sh/sh.c: Replace rtx_equal_function_value_matters + with currently_expanding_to_rtl. + * config/sh/sh.md: Likewise. + * config/ia64/ia64.c (got_symbolic_operand): Likewise. + 2004-07-29 Alexandre Oliva Introduce sh2a support. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index db9206ee56f..aa5911890ee 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -433,6 +433,9 @@ tree_expand_cfg (void) IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl))); } + /* Some backends want to know that we are expanding to RTL. */ + currently_expanding_to_rtl = 1; + /* Prepare the rtl middle end to start recording block changes. */ reset_block_changes (); @@ -459,6 +462,9 @@ tree_expand_cfg (void) construct_exit_block (); + /* We're done expanding trees to RTL. */ + currently_expanding_to_rtl = 0; + /* Convert from NOTE_INSN_EH_REGION style notes, and do other sorts of eh initialization. Delay this until after the initial rtl dump so that we can see the original nesting. */ diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index d195cab1d25..02bfb722b10 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -2796,23 +2796,6 @@ alpha_expand_mov (enum machine_mode mode, rtx *operands) { rtx tmp; - /* With RTL inlining, at -O3, rtl is generated, stored, then actually - compiled at the end of compilation. In the meantime, someone can - re-encode-section-info on some symbol changing it e.g. from global - to local-not-small. If this happens, we'd have emitted a plain - load rather than a high+losum load and not recognize the insn. - - So if rtl inlining is in effect, we delay the global/not-global - decision until rest_of_compilation by wrapping it in an - UNSPEC_SYMBOL. */ - if (TARGET_EXPLICIT_RELOCS && flag_inline_functions - && rtx_equal_function_value_matters - && global_symbolic_operand (operands[1], mode)) - { - emit_insn (gen_movdi_er_maybe_g (operands[0], operands[1])); - return true; - } - tmp = alpha_legitimize_address (operands[1], operands[0], mode); if (tmp) { diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 2899c0f611f..aa0dc20c268 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -489,7 +489,7 @@ got_symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) /* "Ok" while emitting rtl, since otherwise we won't be provided with the entire offset during emission, which makes it very hard to split the offset into high and low parts. */ - if (rtx_equal_function_value_matters) + if (currently_expanding_to_rtl) return 1; /* Force the low 14 bits of the constant to zero so that we do not diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index b2c01302778..7eef57ab238 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -2286,9 +2286,6 @@ shl_and_scr_length (rtx insn) return len + shift_insns[INTVAL (XEXP (op, 1))]; } -/* Generating rtl? */ -extern int rtx_equal_function_value_matters; - /* Generate rtl for instructions for which shl_and_kind advised a particular method of generating them, i.e. returned zero. */ @@ -2359,7 +2356,7 @@ gen_shl_and (rtx dest, rtx left_rtx, rtx mask_rtx, rtx source) case 2: /* Don't expand fine-grained when combining, because that will make the pattern fail. */ - if (rtx_equal_function_value_matters + if (currently_expanding_to_rtl || reload_in_progress || reload_completed) { rtx operands[3]; @@ -2556,7 +2553,7 @@ gen_shl_sext (rtx dest, rtx left_rtx, rtx size_rtx, rtx source) /* Don't expand fine-grained when combining, because that will make the pattern fail. */ - if (! rtx_equal_function_value_matters + if (! currently_expanding_to_rtl && ! reload_in_progress && ! reload_completed) { emit_insn (gen_shl_sext_ext (dest, source, left_rtx, size_rtx)); @@ -2611,7 +2608,7 @@ gen_shl_sext (rtx dest, rtx left_rtx, rtx size_rtx, rtx source) case 5: { int i = 16 - size; - if (! rtx_equal_function_value_matters + if (! currently_expanding_to_rtl && ! reload_in_progress && ! reload_completed) emit_insn (gen_shl_sext_ext (dest, source, left_rtx, size_rtx)); else @@ -2630,7 +2627,7 @@ gen_shl_sext (rtx dest, rtx left_rtx, rtx size_rtx, rtx source) case 7: /* Don't expand fine-grained when combining, because that will make the pattern fail. */ - if (! rtx_equal_function_value_matters + if (! currently_expanding_to_rtl && ! reload_in_progress && ! reload_completed) { emit_insn (gen_shl_sext_ext (dest, source, left_rtx, size_rtx)); diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index e825fae614b..8b2c6f2bb96 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -3459,7 +3459,7 @@ (unspec:SI [(match_operand 1 "register_operand" "")] UNSPEC_RA))] "TARGET_SH1" "#" - "&& ! rtx_equal_function_value_matters" + "&& ! currently_expanding_to_rtl" [(set (match_dup 0) (match_dup 1))] " { @@ -7476,7 +7476,7 @@ mov.l\\t1f,r0\\n\\ } if (sh_expand_t_scc (EQ, operands[0])) DONE; - if (! rtx_equal_function_value_matters) + if (! currently_expanding_to_rtl) FAIL; operands[1] = prepare_scc_operands (EQ); }") @@ -7524,7 +7524,7 @@ mov.l\\t1f,r0\\n\\ } DONE; } - if (! rtx_equal_function_value_matters) + if (! currently_expanding_to_rtl) FAIL; operands[1] = prepare_scc_operands (LT); }") @@ -7628,7 +7628,7 @@ mov.l\\t1f,r0\\n\\ } DONE; } - if (! rtx_equal_function_value_matters) + if (! currently_expanding_to_rtl) FAIL; operands[1] = prepare_scc_operands (GT); }") @@ -7682,7 +7682,7 @@ mov.l\\t1f,r0\\n\\ DONE; } - if (! rtx_equal_function_value_matters) + if (! currently_expanding_to_rtl) FAIL; if (GET_MODE_CLASS (GET_MODE (sh_compare_op0)) == MODE_FLOAT) { @@ -7723,7 +7723,7 @@ mov.l\\t1f,r0\\n\\ sh_compare_op0, sh_compare_op1)); DONE; } - if (! rtx_equal_function_value_matters) + if (! currently_expanding_to_rtl) FAIL; operands[1] = prepare_scc_operands (GTU); }") @@ -7749,7 +7749,7 @@ mov.l\\t1f,r0\\n\\ sh_compare_op1, sh_compare_op0)); DONE; } - if (! rtx_equal_function_value_matters) + if (! currently_expanding_to_rtl) FAIL; operands[1] = prepare_scc_operands (LTU); }") @@ -7780,7 +7780,7 @@ mov.l\\t1f,r0\\n\\ DONE; } - if (! rtx_equal_function_value_matters) + if (! currently_expanding_to_rtl) FAIL; operands[1] = prepare_scc_operands (LEU); }") @@ -7812,7 +7812,7 @@ mov.l\\t1f,r0\\n\\ DONE; } - if (! rtx_equal_function_value_matters) + if (! currently_expanding_to_rtl) FAIL; operands[1] = prepare_scc_operands (GEU); }") @@ -7863,7 +7863,7 @@ mov.l\\t1f,r0\\n\\ if (sh_expand_t_scc (NE, operands[0])) DONE; - if (! rtx_equal_function_value_matters) + if (! currently_expanding_to_rtl) FAIL; operands[1] = prepare_scc_operands (EQ); operands[2] = gen_reg_rtx (SImode); diff --git a/gcc/rtl.c b/gcc/rtl.c index 74c85351abe..7de4b90e671 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -320,6 +320,10 @@ shallow_copy_rtx_stat (rtx orig MEM_STAT_DECL) /* Nonzero when we are generating CONCATs. */ int generating_concat_p; + +/* Nonzero when we are expanding trees to RTL. */ +int currently_expanding_to_rtl; + /* Return 1 if X and Y are identical-looking rtx's. This is the Lisp function EQUAL for rtx arguments. */ diff --git a/gcc/rtl.h b/gcc/rtl.h index 965650f5788..06a553e555c 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1543,6 +1543,9 @@ do { \ /* Nonzero when we are generating CONCATs. */ extern int generating_concat_p; +/* Nonzero when we are expanding trees to RTL. */ +extern int currently_expanding_to_rtl; + /* Generally useful functions. */ /* In expmed.c */ -- 2.30.2