arm.c (note_invalid_constants): Try to extract the constant pool value using avoid_co...
authorRichard Earnshaw <rearnsha@arm.com>
Fri, 24 Oct 2003 08:47:18 +0000 (08:47 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Fri, 24 Oct 2003 08:47:18 +0000 (08:47 +0000)
* arm.c (note_invalid_constants): Try to extract the constant
pool value using avoid_constant_pool_reference; only use
get_pool_constant if that returns the original reference.

From-SVN: r72883

gcc/ChangeLog
gcc/config/arm/arm.c

index 4b59697d372333a95526790e80bd35c4f1da19b4..794eb0190d29141fec40fe5a96bac13dfff0a40a 100644 (file)
@@ -1,3 +1,9 @@
+2003-10-24  Richard Earnshaw  <rearnsha@arm.com>
+
+       * arm.c (note_invalid_constants): Try to extract the constant
+       pool value using avoid_constant_pool_reference; only use
+       get_pool_constant if that returns the original reference.
+
 2003-10-24  Jan Hubicka  <jh@suse.cz>
 
        PR c++/12624
index 8a7997e30f3ff6c46377cd358cf0c8b163c788af..2b1bf7a138986abbd0d6b70116a5ecd29cd69431 100644 (file)
@@ -6894,9 +6894,23 @@ note_invalid_constants (rtx insn, HOST_WIDE_INT address, int do_pushes)
                   && CONSTANT_POOL_ADDRESS_P (XEXP (op, 0)))
            {
              if (do_pushes)
-               push_minipool_fix (insn, address, recog_data.operand_loc[opno],
-                                  recog_data.operand_mode[opno],
-                                  get_pool_constant (XEXP (op, 0)));
+               {
+                 rtx cop = avoid_constant_pool_reference (op);
+
+                 /* Casting the address of something to a mode narrower
+                    than a word can cause avoid_constant_pool_reference()
+                    to return the pool reference itself.  That's no good to
+                    us here.  Lets just hope that we can use the 
+                    constant pool value directly.  */
+                 if (op == cop)
+                   op = get_pool_constant (XEXP (op, 0));
+                 else
+                   op = cop;
+
+                 push_minipool_fix (insn, address,
+                                    recog_data.operand_loc[opno],
+                                    recog_data.operand_mode[opno], op);
+               }
 
              result = true;
            }