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]

Re: Problem with put_reg_into_stack


> 
> Hi,
> 
> Here is a simplified version of my previous bug report. I think that
> may be another addressof related bug. mark_addressable () in
> cp/typeck.c has
> 
>       case CONST_DECL:
>       case RESULT_DECL:
>         if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
>             && !DECL_ARTIFICIAL (x) && extra_warnings)
>           cp_warning ("address requested for `%D', which is declared `register'",
>                       x);
>         put_var_into_stack (x);
>         TREE_ADDRESSABLE (x) = 1;
>         return 1;
> 
> The related RTL code is
>  
> (set (reg:QI 23)
>     (mem/s:QI (plus:SI (reg/v/u:SI 22)
>             (const_int 4))))
> 
> That is done on purpose since the x86 pattern doesn't allow memory
> to memory move. put_var_into_stack () calls put_reg_into_stack ()
> which turns
> 
> (reg:QI 23)
> 
> into
> 
> (mem:QI (plus:SI (reg:SI 18)
>         (const_int -2)))
> 
> Now we get
> 
> (set (mem:QI (plus:SI (reg:SI 18)
>         	(const_int -2)))
>     (mem/s:QI (plus:SI (reg/v/u:SI 22)
>             (const_int 4))))
> 
> It is not a valid x86 pattern. I have no idea if it can be fixed
> easily. Maybe i386.md can be modified to fix it.
> 
> Thanks.
> 
> 
> 
> -- 
> H.J. Lu (hjl@gnu.org)
> ---
> typedef unsigned long int pthread_t;
> class JTCThreadId
> {
> public:
>     JTCThreadId();
>     operator pthread_t() const;
> };
> class JTCRecursiveMutex
> {
>     int count_;  
>     JTCThreadId owner_;  
> public:
>     JTCThreadId _JTC_getId() const;
> };
> JTCThreadId
> JTCRecursiveMutex::_JTC_getId() const
> {
>     JTCThreadId id = (count_ > 0) ? owner_ : JTCThreadId();
>     return id;
> }
> 

Here is a kludge. Matthew, please let me know if it works for you.
I hope someone will provide a real fix.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
----
Sat Dec 12 19:08:53 1998  H.J. Lu  (hjl@gnu.org)

	* config/i386/i386.h (TARGET_MOVE): Allow memory->memory move
	if optimize == 0.

--- ../../../import/egcs/gcc/config/i386/i386.h	Mon Jul 27 09:56:45 1998
+++ config/i386/i386.h	Sat Dec 12 19:11:29 1998
@@ -148,7 +148,9 @@
 #define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
 
 /* Hack macros for tuning code generation */
-#define TARGET_MOVE	((target_flags & MASK_NO_MOVE) == 0)	/* Don't generate memory->memory */
+
+/* Don't generate memory->memory */
+#define TARGET_MOVE	((target_flags & MASK_NO_MOVE) == 0 || optimize == 0)
 #define TARGET_PSEUDO	((target_flags & MASK_NO_PSEUDO) == 0)	/* Move op's args into pseudos */
 
 #define TARGET_386 (ix86_cpu == PROCESSOR_I386)


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