aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2003-02-03 19:40:58 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2003-02-03 19:40:58 +0000
commit7daebb7ae4a90b9463a5b6940977690e2da07ff9 (patch)
tree941a0c444f84c4242289e65f0a9288ba576f035e /gcc
parent348b0c310505a37e779ad69065190f1991253854 (diff)
downloadgcc-7daebb7ae4a90b9463a5b6940977690e2da07ff9.zip
gcc-7daebb7ae4a90b9463a5b6940977690e2da07ff9.tar.gz
gcc-7daebb7ae4a90b9463a5b6940977690e2da07ff9.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog21
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/config/i386/i386.c38
-rw-r--r--gcc/hooks.c10
-rw-r--r--gcc/hooks.h4
-rw-r--r--gcc/simplify-rtx.c30
-rw-r--r--gcc/target-def.h4
-rw-r--r--gcc/target.h5
8 files changed, 73 insertions, 41 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e26e1c0..d89b215 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,24 @@
+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>
* i386.c (ix86_expand_int_movcc): Fix setcc sign bit case.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index cc44404..a40d15a 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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) \
$(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) \
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
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 48b60ad..2f7a300 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -990,6 +990,9 @@ static enum x86_64_reg_class merge_classes PARAMS ((enum x86_64_reg_class,
#undef TARGET_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
#define TARGET_MS_BITFIELD_LAYOUT_P ix86_ms_bitfield_layout_p
@@ -5368,21 +5371,7 @@ ix86_find_base_term (x)
return term;
}
- if (GET_CODE (x) != PLUS
- || 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);
+ term = i386_simplify_dwarf_addr (x);
if (GET_CODE (term) != SYMBOL_REF
&& GET_CODE (term) != LABEL_REF)
@@ -8047,24 +8036,7 @@ static rtx
maybe_get_pool_constant (x)
rtx x;
{
- x = 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);
- }
+ x = i386_simplify_dwarf_addr (XEXP (x, 0));
if (GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x))
return get_pool_constant (x);
diff --git a/gcc/hooks.c b/gcc/hooks.c
index 0954bde..8926638 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -1,5 +1,5 @@
/* 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
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)
return false;
}
+/* Generic hook that takes an rtx and returns it. */
+rtx
+hook_rtx_rtx_identity (x)
+ rtx x;
+{
+ return x;
+}
+
diff --git a/gcc/hooks.h b/gcc/hooks.h
index d36e3fc..f7a4d6d 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -1,5 +1,5 @@
/* 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
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
bool hook_bool_tree_tree_false PARAMS ((tree, tree));
+rtx hook_rtx_rtx_identity PARAMS ((rtx));
+
#endif
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 47dd7a0..19d664b 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -38,6 +38,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "toplev.h"
#include "output.h"
#include "ggc.h"
+#include "target.h"
/* Simplification and canonicalization of RTL. */
@@ -106,13 +107,36 @@ rtx
avoid_constant_pool_reference (x)
rtx x;
{
- rtx c, addr;
+ rtx c, tmp, addr;
enum machine_mode cmode;
- if (GET_CODE (x) != MEM)
- return x;
+ 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;
+ }
+
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)
addr = XEXP (addr, 1);
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 18929d1..dfc5900 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -1,5 +1,5 @@
/* 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
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.
/* 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_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
#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES hook_void_tree
@@ -293,6 +294,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_DELEGITIMIZE_ADDRESS, \
TARGET_FUNCTION_OK_FOR_SIBCALL, \
TARGET_IN_SMALL_DATA_P, \
TARGET_BINDS_LOCAL_P, \
diff --git a/gcc/target.h b/gcc/target.h
index b6d7f8d..8c286f7 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -1,5 +1,5 @@
/* 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
under the terms of the GNU General Public License as published by the
@@ -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));
+ /* 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
call expression EXP. DECL will be the called function, or NULL if
this is an indirect call. */