aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
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/simplify-rtx.c
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/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c30
1 files changed, 27 insertions, 3 deletions
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);