diff options
author | Richard Henderson <rth@redhat.com> | 2003-02-15 16:58:29 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2003-02-15 16:58:29 -0800 |
commit | 0b077eace85e5b6b6bc311b0f6800e0324de6d59 (patch) | |
tree | 35ca2b5dd89aac0a688da30150746834c7713a87 /gcc | |
parent | a7075aea5850feee4de2a5fec2c118aac7365790 (diff) | |
download | gcc-0b077eace85e5b6b6bc311b0f6800e0324de6d59.zip gcc-0b077eace85e5b6b6bc311b0f6800e0324de6d59.tar.gz gcc-0b077eace85e5b6b6bc311b0f6800e0324de6d59.tar.bz2 |
Makefile.in (cfglayout.o): Depend on TARGET_H.
* Makefile.in (cfglayout.o): Depend on TARGET_H.
* cfglayout.c: Include target.h.
(cfg_layout_can_duplicate_bb_p): Check targetm.cannot_copy_insn_p.
* target-def.h (TARGET_CANNOT_COPY_INSN_P): New.
* target.h (struct gcc_target): Add cannot_copy_insn_p.
* config/alpha/alpha.c (alpha_cannot_copy_insn_p): New.
(TARGET_CANNOT_COPY_INSN_P): New.
(override_options): Revert 2003-02-08 hack.
From-SVN: r62955
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/Makefile.in | 6 | ||||
-rw-r--r-- | gcc/cfglayout.c | 16 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.c | 51 | ||||
-rw-r--r-- | gcc/target-def.h | 2 | ||||
-rw-r--r-- | gcc/target.h | 3 |
6 files changed, 83 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 26201f3..1381de2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,17 @@ 2003-02-15 Richard Henderson <rth@redhat.com> + * Makefile.in (cfglayout.o): Depend on TARGET_H. + * cfglayout.c: Include target.h. + (cfg_layout_can_duplicate_bb_p): Check targetm.cannot_copy_insn_p. + * target-def.h (TARGET_CANNOT_COPY_INSN_P): New. + * target.h (struct gcc_target): Add cannot_copy_insn_p. + + * config/alpha/alpha.c (alpha_cannot_copy_insn_p): New. + (TARGET_CANNOT_COPY_INSN_P): New. + (override_options): Revert 2003-02-08 hack. + +2003-02-15 Richard Henderson <rth@redhat.com> + * gcse.c (bypass_block): Use BLOCK_FOR_INSN for resolving LABEL_REFs. (bypass_conditional_jumps): Accept computed_jump_p insns as well. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 8af0a704..edab43e 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1700,9 +1700,9 @@ bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ $(BASIC_BLOCK_H) hard-reg-set.h output.h cfglayout.h flags.h \ $(PARAMS_H) profile.h -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 +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) timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TIMEVAR_H) flags.h \ intl.h toplev.h regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index 7ac9cb6..04ba2ec 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -32,6 +32,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "obstack.h" #include "cfglayout.h" #include "cfgloop.h" +#include "target.h" /* The contents of the current function definition are allocated in this obstack, and all are freed at the end of the function. */ @@ -748,6 +749,21 @@ cfg_layout_can_duplicate_bb_p (bb) && (GET_CODE (PATTERN (next)) == ADDR_VEC || GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC)) return false; + + /* Do not duplicate blocks containing insns that can't be copied. */ + if (targetm.cannot_copy_insn_p) + { + rtx insn = bb->head; + while (1) + { + if (INSN_P (insn) && (*targetm.cannot_copy_insn_p) (insn)) + return false; + if (insn == bb->end) + break; + insn = NEXT_INSN (insn); + } + } + return true; } diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index fcd3633..c21656d 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -192,6 +192,8 @@ static int some_small_symbolic_operand_1 PARAMS ((rtx *, void *)); static int split_small_symbolic_operand_1 PARAMS ((rtx *, void *)); +static bool alpha_cannot_copy_insn_p + PARAMS ((rtx)); static bool alpha_rtx_costs PARAMS ((rtx, int, int, int *)); static void alpha_set_memflags_1 @@ -361,6 +363,8 @@ static void unicosmk_unique_section PARAMS ((tree, int)); #undef TARGET_FUNCTION_OK_FOR_SIBCALL #define TARGET_FUNCTION_OK_FOR_SIBCALL alpha_function_ok_for_sibcall +#undef TARGET_CANNOT_COPY_INSN_P +#define TARGET_CANNOT_COPY_INSN_P alpha_cannot_copy_insn_p #if TARGET_ABI_OSF #undef TARGET_ASM_OUTPUT_MI_THUNK @@ -657,10 +661,6 @@ override_options () real_format_for_mode[DFmode - QFmode] = &vax_g_format; real_format_for_mode[TFmode - QFmode] = NULL; } - - /* ??? Turn off explicit relocs until code duplication by bb-reorder - is addressed. */ - target_flags &= ~MASK_EXPLICIT_RELOCS; } /* Returns 1 if VALUE is a mask that contains full bytes of zero or ones. */ @@ -2475,6 +2475,49 @@ split_small_symbolic_operand_1 (px, data) return 0; } +/* Indicate that INSN cannot be duplicated. This is true for any insn + that we've marked with gpdisp relocs, since those have to stay in + 1-1 correspondence with one another. + + Techinically we could copy them if we could set up a mapping from one + sequence number to another, across the set of insns to be duplicated. + This seems overly complicated and error-prone since interblock motion + from sched-ebb could move one of the pair of insns to a different block. */ + +static bool +alpha_cannot_copy_insn_p (insn) + rtx insn; +{ + rtx pat; + + if (!reload_completed || !TARGET_EXPLICIT_RELOCS) + return false; + + if (GET_CODE (insn) != INSN) + return false; + if (asm_noperands (insn) >= 0) + return false; + + pat = PATTERN (insn); + if (GET_CODE (pat) != SET) + return false; + pat = SET_SRC (pat); + if (GET_CODE (pat) == UNSPEC_VOLATILE) + { + if (XINT (pat, 1) == UNSPECV_LDGP1 + || XINT (pat, 1) == UNSPECV_PLDGP2) + return true; + } + else if (GET_CODE (pat) == UNSPEC) + { + if (XINT (pat, 1) == UNSPEC_LDGP2) + return true; + } + + return false; +} + + /* Try a machine-dependent way of reloading an illegitimate address operand. If we find one, push the reload and return the new rtx. */ diff --git a/gcc/target-def.h b/gcc/target-def.h index dfc5900..985d651 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -259,6 +259,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* In hook.c. */ #define TARGET_CANNOT_MODIFY_JUMPS_P hook_bool_void_false #define TARGET_CANNOT_FORCE_CONST_MEM hook_bool_rtx_false +#define TARGET_CANNOT_COPY_INSN_P NULL #define TARGET_DELEGITIMIZE_ADDRESS hook_rtx_rtx_identity #define TARGET_FUNCTION_OK_FOR_SIBCALL hook_bool_tree_tree_false #define TARGET_COMP_TYPE_ATTRIBUTES hook_int_tree_tree_1 @@ -294,6 +295,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TARGET_SECTION_TYPE_FLAGS, \ TARGET_CANNOT_MODIFY_JUMPS_P, \ TARGET_CANNOT_FORCE_CONST_MEM, \ + TARGET_CANNOT_COPY_INSN_P, \ TARGET_DELEGITIMIZE_ADDRESS, \ TARGET_FUNCTION_OK_FOR_SIBCALL, \ TARGET_IN_SMALL_DATA_P, \ diff --git a/gcc/target.h b/gcc/target.h index 8c286f7..f671321 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -292,6 +292,9 @@ struct gcc_target /* True if the constant X cannot be placed in the constant pool. */ bool (* cannot_force_const_mem) PARAMS ((rtx)); + /* True if the insn X cannot be duplicated. */ + bool (* cannot_copy_insn_p) PARAMS ((rtx)); + /* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS. */ rtx (* delegitimize_address) PARAMS ((rtx)); |