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: Save memory with ppc elf shared libraries.


> Date: Mon, 28 Dec 1998 10:29:01 -0800
> From: Richard Henderson <rth@cygnus.com>
> Cc: egcs-patches@cygnus.com
> Reply-To: Richard Henderson <rth@cygnus.com>
> 
> On Sun, Dec 27, 1998 at 02:44:02AM +1100, Geoff Keating wrote:
> > The tricky part here is that I believe (after looking at various
> > machine definitions, and checking through the source) that all
> > RTL of the form (const x) has a symbol_ref somewhere in the 'x'.  So
> > it's unnecessary to go looking for it.  Similarly with (high x).
> 
> There are a couple (relatively few after Dave's rewrite) places
> in the Sparc port that stick a const_int in a high+lo_sum.  It
> should be simple enough to clean them up though.

You mean, like

(set x (high (const_int 12345678)))
(lo_sum x 12345678)

?  Hmmm.

Doesn't the `symbolic_memory_operand' function in sparc.c use
precisely the definition I used?  It has

  return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST
         || GET_CODE (op) == HIGH || GET_CODE (op) == LABEL_REF);

so I guess you might want to clean them up.  I stopped looking at
the sparc port once I saw that.  In SELECT_RTX_SECTION, there is

#define SELECT_RTX_SECTION(MODE, X)             \
{                                               \
  if (GET_MODE_BITSIZE (MODE) <= MAX_TEXT_ALIGN \
      && ! (flag_pic && (symbolic_operand (X) || SUNOS4_SHARED_LIBRARIES)))  \
    text_section ();                            \
  else                                          \
    data_section ();                            \
}


The worst that will happen is that the (high (const_int x)) will be
spilled to memory, in which case it'll be put in the writable data
section.


OK.  This is getting a little scary.  I will write another patch that
explicitly checks for a symbol_ref.  I'll keep the SYMBOLIC_CONSTANT_P
macro, though, it looks useful.

-- 
Geoffrey Keating <geoffk@ozemail.com.au>

===File ~/patches/egcs-9-2.diff=============================
Sun Dec 27 01:08:06 1998  Geoff Keating  <geoffk@ozemail.com.au>

	* config/sparc/sparc.c (symbolic_memory_operand): Use 
	SYMBOLIC_CONSTANT_P.

--- egcs-1.1.1/gcc/config/sparc/sparc.c~	Tue Jul 14 10:18:55 1998
+++ egcs-1.1.1/gcc/config/sparc/sparc.c	Sun Dec 27 01:01:18 1998
@@ -528,8 +528,7 @@ symbolic_memory_operand (op, mode)
   if (GET_CODE (op) != MEM)
     return 0;
   op = XEXP (op, 0);
-  return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST
-	  || GET_CODE (op) == HIGH || GET_CODE (op) == LABEL_REF);
+  return SYMBOLIC_CONSTANT_P (op);
 }
 
 /* Return truth value of statement that OP is a LABEL_REF of mode MODE.  */
============================================================


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