Commit 7daebb7a by Roger Sayle Committed by Roger Sayle

hooks.c (hook_rtx_rtx_identity): Generic hook function that takes a single rtx…

hooks.c (hook_rtx_rtx_identity): Generic hook function that takes a single rtx and returns it unmodified.


	* hooks.c (hook_rtx_rtx_identity): Generic hook function that
	takes a single rtx and returns it unmodified.
	* hooks.h (hook_rtx_rtx_identity): Prototype here.
	* target.h (struct gcc_target): Add "delegitimize_address"
	field to target structure.
	* target-def.h (TARGET_DELEGITIMIZE_ADDRESS):  Provide default
	for delegitimize_address target using hook_rtx_rtx_identity.
	(TARGET_INITIALIZER): Initialize delegitimize_address field
	using TARGET_DELEGITIMIZE_ADDRESS macro.
	* simplify-rtx.c (avoid_constant_pool_reference): Handle float
	extensions of constant pool references.  Use delegitimize_address
	to undo the obfuscation of "-fpic".
	* Makefile.in (simplify-rtx.o): Add dependency on target.h.

	* config/i386/i386.c (TARGET_DELEGITIMIZE_ADDRESS): Define as
	i386_simplify_dwarf_addr.
	(ix86_find_base_term): Simplify using i386_simplify_dwarf_addr.
  	(maybe_get_pool_constant): Likewise.

From-SVN: r62336
parent 348b0c31
2002-02-03 Roger Sayle <roger@eyesopen.com>
* hooks.c (hook_rtx_rtx_identity): Generic hook function that
takes a single rtx and returns it unmodified.
* hooks.h (hook_rtx_rtx_identity): Prototype here.
* target.h (struct gcc_target): Add "delegitimize_address"
field to target structure.
* target-def.h (TARGET_DELEGITIMIZE_ADDRESS): Provide default
for delegitimize_address target using hook_rtx_rtx_identity.
(TARGET_INITIALIZER): Initialize delegitimize_address field
using TARGET_DELEGITIMIZE_ADDRESS macro.
* simplify-rtx.c (avoid_constant_pool_reference): Handle float
extensions of constant pool references. Use delegitimize_address
to undo the obfuscation of "-fpic".
* Makefile.in (simplify-rtx.o): Add dependency on target.h.
* config/i386/i386.c (TARGET_DELEGITIMIZE_ADDRESS): Define as
i386_simplify_dwarf_addr.
(ix86_find_base_term): Simplify using i386_simplify_dwarf_addr.
(maybe_get_pool_constant): Likewise.
Mon Feb 3 16:01:17 CET 2003 Jan Hubicka <jh@suse.cz> Mon Feb 3 16:01:17 CET 2003 Jan Hubicka <jh@suse.cz>
* i386.c (ix86_expand_int_movcc): Fix setcc sign bit case. * i386.c (ix86_expand_int_movcc): Fix setcc sign bit case.
......
...@@ -1523,7 +1523,7 @@ jump.o : jump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ ...@@ -1523,7 +1523,7 @@ jump.o : jump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \
simplify-rtx.o : simplify-rtx.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ simplify-rtx.o : simplify-rtx.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(REGS_H) hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \ $(REGS_H) hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \
output.h function.h $(GGC_H) $(OBSTACK_H) $(TM_P_H) $(TREE_H) output.h function.h $(GGC_H) $(OBSTACK_H) $(TM_P_H) $(TREE_H) $(TARGET_H)
cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \ hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \
output.h function.h cselib.h $(GGC_H) $(TM_P_H) gt-cselib.h output.h function.h cselib.h $(GGC_H) $(TM_P_H) gt-cselib.h
......
...@@ -990,6 +990,9 @@ static enum x86_64_reg_class merge_classes PARAMS ((enum x86_64_reg_class, ...@@ -990,6 +990,9 @@ static enum x86_64_reg_class merge_classes PARAMS ((enum x86_64_reg_class,
#undef TARGET_CANNOT_FORCE_CONST_MEM #undef TARGET_CANNOT_FORCE_CONST_MEM
#define TARGET_CANNOT_FORCE_CONST_MEM ix86_cannot_force_const_mem #define TARGET_CANNOT_FORCE_CONST_MEM ix86_cannot_force_const_mem
#undef TARGET_DELEGITIMIZE_ADDRESS
#define TARGET_DELEGITIMIZE_ADDRESS i386_simplify_dwarf_addr
#undef TARGET_MS_BITFIELD_LAYOUT_P #undef TARGET_MS_BITFIELD_LAYOUT_P
#define TARGET_MS_BITFIELD_LAYOUT_P ix86_ms_bitfield_layout_p #define TARGET_MS_BITFIELD_LAYOUT_P ix86_ms_bitfield_layout_p
...@@ -5368,21 +5371,7 @@ ix86_find_base_term (x) ...@@ -5368,21 +5371,7 @@ ix86_find_base_term (x)
return term; return term;
} }
if (GET_CODE (x) != PLUS term = i386_simplify_dwarf_addr (x);
|| XEXP (x, 0) != pic_offset_table_rtx
|| GET_CODE (XEXP (x, 1)) != CONST)
return x;
term = XEXP (XEXP (x, 1), 0);
if (GET_CODE (term) == PLUS && GET_CODE (XEXP (term, 1)) == CONST_INT)
term = XEXP (term, 0);
if (GET_CODE (term) != UNSPEC
|| XINT (term, 1) != UNSPEC_GOTOFF)
return x;
term = XVECEXP (term, 0, 0);
if (GET_CODE (term) != SYMBOL_REF if (GET_CODE (term) != SYMBOL_REF
&& GET_CODE (term) != LABEL_REF) && GET_CODE (term) != LABEL_REF)
...@@ -8047,24 +8036,7 @@ static rtx ...@@ -8047,24 +8036,7 @@ static rtx
maybe_get_pool_constant (x) maybe_get_pool_constant (x)
rtx x; rtx x;
{ {
x = XEXP (x, 0); x = i386_simplify_dwarf_addr (XEXP (x, 0));
if (flag_pic && ! TARGET_64BIT)
{
if (GET_CODE (x) != PLUS)
return NULL_RTX;
if (XEXP (x, 0) != pic_offset_table_rtx)
return NULL_RTX;
x = XEXP (x, 1);
if (GET_CODE (x) != CONST)
return NULL_RTX;
x = XEXP (x, 0);
if (GET_CODE (x) != UNSPEC)
return NULL_RTX;
if (XINT (x, 1) != UNSPEC_GOTOFF)
return NULL_RTX;
x = XVECEXP (x, 0, 0);
}
if (GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x)) if (GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x))
return get_pool_constant (x); return get_pool_constant (x);
......
/* General-purpose hooks. /* General-purpose hooks.
Copyright (C) 2002 Free Software Foundation, Inc. Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
...@@ -149,3 +149,11 @@ hook_bool_rtx_int_int_intp_false (a, b, c, d) ...@@ -149,3 +149,11 @@ hook_bool_rtx_int_int_intp_false (a, b, c, d)
return false; return false;
} }
/* Generic hook that takes an rtx and returns it. */
rtx
hook_rtx_rtx_identity (x)
rtx x;
{
return x;
}
/* General-purpose hooks. /* General-purpose hooks.
Copyright (C) 2002 Free Software Foundation, Inc. Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
...@@ -45,4 +45,6 @@ bool default_can_output_mi_thunk_no_vcall ...@@ -45,4 +45,6 @@ bool default_can_output_mi_thunk_no_vcall
bool hook_bool_tree_tree_false PARAMS ((tree, tree)); bool hook_bool_tree_tree_false PARAMS ((tree, tree));
rtx hook_rtx_rtx_identity PARAMS ((rtx));
#endif #endif
...@@ -38,6 +38,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -38,6 +38,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "toplev.h" #include "toplev.h"
#include "output.h" #include "output.h"
#include "ggc.h" #include "ggc.h"
#include "target.h"
/* Simplification and canonicalization of RTL. */ /* Simplification and canonicalization of RTL. */
...@@ -106,13 +107,36 @@ rtx ...@@ -106,13 +107,36 @@ rtx
avoid_constant_pool_reference (x) avoid_constant_pool_reference (x)
rtx x; rtx x;
{ {
rtx c, addr; rtx c, tmp, addr;
enum machine_mode cmode; enum machine_mode cmode;
if (GET_CODE (x) != MEM) switch (GET_CODE (x))
{
case MEM:
break;
case FLOAT_EXTEND:
/* Handle float extensions of constant pool references. */
tmp = XEXP (x, 0);
c = avoid_constant_pool_reference (tmp);
if (c != tmp && GET_CODE (c) == CONST_DOUBLE)
{
REAL_VALUE_TYPE d;
REAL_VALUE_FROM_CONST_DOUBLE (d, c);
return CONST_DOUBLE_FROM_REAL_VALUE (d, GET_MODE (x));
}
return x;
default:
return x; return x;
}
addr = XEXP (x, 0); addr = XEXP (x, 0);
/* Call target hook to avoid the effects of -fpic etc... */
addr = (*targetm.delegitimize_address) (addr);
if (GET_CODE (addr) == LO_SUM) if (GET_CODE (addr) == LO_SUM)
addr = XEXP (addr, 1); addr = XEXP (addr, 1);
......
/* Default initializers for a generic GCC target. /* Default initializers for a generic GCC target.
Copyright (C) 2001, 2002 Free Software Foundation, Inc. Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
...@@ -259,6 +259,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -259,6 +259,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* In hook.c. */ /* In hook.c. */
#define TARGET_CANNOT_MODIFY_JUMPS_P hook_bool_void_false #define TARGET_CANNOT_MODIFY_JUMPS_P hook_bool_void_false
#define TARGET_CANNOT_FORCE_CONST_MEM hook_bool_rtx_false #define TARGET_CANNOT_FORCE_CONST_MEM hook_bool_rtx_false
#define TARGET_DELEGITIMIZE_ADDRESS hook_rtx_rtx_identity
#define TARGET_FUNCTION_OK_FOR_SIBCALL hook_bool_tree_tree_false #define TARGET_FUNCTION_OK_FOR_SIBCALL hook_bool_tree_tree_false
#define TARGET_COMP_TYPE_ATTRIBUTES hook_int_tree_tree_1 #define TARGET_COMP_TYPE_ATTRIBUTES hook_int_tree_tree_1
#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES hook_void_tree #define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES hook_void_tree
...@@ -293,6 +294,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -293,6 +294,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TARGET_SECTION_TYPE_FLAGS, \ TARGET_SECTION_TYPE_FLAGS, \
TARGET_CANNOT_MODIFY_JUMPS_P, \ TARGET_CANNOT_MODIFY_JUMPS_P, \
TARGET_CANNOT_FORCE_CONST_MEM, \ TARGET_CANNOT_FORCE_CONST_MEM, \
TARGET_DELEGITIMIZE_ADDRESS, \
TARGET_FUNCTION_OK_FOR_SIBCALL, \ TARGET_FUNCTION_OK_FOR_SIBCALL, \
TARGET_IN_SMALL_DATA_P, \ TARGET_IN_SMALL_DATA_P, \
TARGET_BINDS_LOCAL_P, \ TARGET_BINDS_LOCAL_P, \
......
/* Data structure definitions for a generic GCC target. /* Data structure definitions for a generic GCC target.
Copyright (C) 2001, 2002 Free Software Foundation, Inc. Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
...@@ -292,6 +292,9 @@ struct gcc_target ...@@ -292,6 +292,9 @@ struct gcc_target
/* True if the constant X cannot be placed in the constant pool. */ /* True if the constant X cannot be placed in the constant pool. */
bool (* cannot_force_const_mem) PARAMS ((rtx)); bool (* cannot_force_const_mem) PARAMS ((rtx));
/* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS. */
rtx (* delegitimize_address) PARAMS ((rtx));
/* True if it is OK to do sibling call optimization for the specified /* True if it is OK to do sibling call optimization for the specified
call expression EXP. DECL will be the called function, or NULL if call expression EXP. DECL will be the called function, or NULL if
this is an indirect call. */ this is an indirect call. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment