This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ARM] [1/2] Make ARM_LEGITIMIZE_RELOAD_ADDRESS be a function


On 01/29/2011 11:22 AM, Jie Zhang wrote:
On 01/29/2011 01:03 AM, Richard Earnshaw wrote:
Also, I notice that the same problem has crept into
thumb_legitimize_reload_address. Perhaps you could correct that too in
a similar manner. Consider such a patch pre-approved (but please commit
it separately from the ARM one).

I will see if I can prepare a patch.

I take a look. Yeah, there are some issues in thumb_legitimize_reload_address.

1. thumb_legitimize_reload_address uses REG_MODE_OK_FOR_REG_BASE_P, which will use an undefined macro ARM_REGNO_OK_FOR_INDEX_P if REG_OK_STRICT was defined. But since thumb_legitimize_reload_address is defined in arm.c, in which REG_OK_STRICT is not defined, this does not cause a compile time bug now.

2. I tried to use REGNO_OK_FOR_INDEX_P instead of ARM_REGNO_OK_FOR_INDEX_P and apply the attached patch. GCC would have an ICE on the attached test case, which is reduced from a newlib source file, with options "-O2 -mthumb".

3. Currently we use thumb_legitimize_reload_address to handle TARGET_THUMB1 and TARGET_THUMB2. It seems not good. I think we may need to use separate functions for each case.

4. The code piece which uses REG_MODE_OK_FOR_REG_BASE_P in thumb_legitimize_reload_address was added to fix PR target/23436. That bug cannot be reproduced on the latest GCC trunk even after commenting out that code piece. Maybe we don't need that code piece now?

So it seems there is no simple fix for this problem. But I may have not much time for this now.


Regards, -- Jie Zhang
typedef unsigned long __ULong;
struct _on_exit_args
{
  void *_dso_handle[32];
  __ULong _fntypes;
  __ULong _is_cxa;
};
struct _atexit
{
  int _ind;
  struct _on_exit_args _on_exit_args;
};
struct _reent
{
  int _errno;
  union
  {
    struct
    {
      unsigned int _unused_rand;
      unsigned int _nmalloc[30];
    }
  }
  _new;
  struct _atexit *_atexit;
};
extern struct _reent *const _global_impure_ptr;
__call_exitprocs (void *d)
{
  register struct _atexit *p;
  register struct _on_exit_args *args;
  register int n;
  int i;
restart:
  p = _global_impure_ptr->_atexit;
  {
    args = &p->_on_exit_args;
    for (;;)
      {
	i = 1 << n;
	if (d && (!args || args->_dso_handle[n] != d))
	  if ((args->_fntypes & i) == 0)
	    fn ();
	  else if ((args->_is_cxa & i))
	    goto restart;
      }
  }
}
Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c	(revision 169386)
+++ config/arm/arm.c	(working copy)
@@ -6477,8 +6477,8 @@ thumb_legitimize_reload_address (rtx *x_
   if (GET_CODE (x) == PLUS
       && REG_P (XEXP (x, 0))
       && REG_P (XEXP (x, 1))
-      && !REG_MODE_OK_FOR_REG_BASE_P (XEXP (x, 0), mode)
-      && !REG_MODE_OK_FOR_REG_BASE_P (XEXP (x, 1), mode))
+      && !REGNO_OK_FOR_INDEX_P (REGNO (XEXP (x, 0)))
+      && !REGNO_OK_FOR_INDEX_P (REGNO (XEXP (x, 1))))
     {
       rtx orig_x = x;
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]