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
This commit is contained in:
Richard Henderson 2003-02-15 16:58:29 -08:00 committed by Richard Henderson
parent a7075aea58
commit 0b077eace8
6 changed files with 83 additions and 7 deletions

View File

@ -1,3 +1,15 @@
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.

View File

@ -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) \

View File

@ -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;
}

View File

@ -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. */

View File

@ -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, \

View File

@ -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));