This is the mail archive of the gcc@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: reload problems....


At 2:13 AM +1200 7/24/01, thomas joseph wrote:

>Hi Alan,
>
>  thanks for your reply. I have already defined
> SMALL_REGISTER_CLASSES and CLASSES_LIKELY_SPILLED
>macros.
>
>   Do I need to define LEGITIMIZE_RELOAD_ADDRESS macro
> ??

	It may help.  You can look at the SPARC port for an example.  There are
	several other ports that do this too.  The L_R_A macro is particularly useful if
	you have several different addressing modes, as reload has some very general ideas
	about how to create legal addresses during the reload phase, and often to get good code you
	need this "specialization".

>   I defined LEGITIMIZE_ADDRESS macro to make the
>illegitimate addresses as legitimate. It handles only
>one case ,  in the indexed addressing mode when the
>displacement goes out of range (-128 to 127).
>It is defined as :
>
>#define LEGITIMIZE_ADDRESS (OLDX, MODE, WIN) \ {     
>                             \
>  if (GET_CODE (X) == PLUS  && GET_CODE (XEXP (X, 0))
>== REG   && GET_CODE (XEXP (X, 1))  == CONST_INT \
>  && !VALID_CONSTANT_OFFSET_P (XEXP (X, 1), MODE))\
>{\                                                   
>      rtx xop0 = XEXP (X, 0);                        \
>      rtx xop1 = XEXP (X, 1);                        \
>     xop1 = force_reg (HImode, xop1);  \
>     (X) = force_reg (Pmode, gen_rtx_PLUS (Pmode,
>xop0, xop1)); \
>      goto WIN;                         \
>    }                                \
>}                                          


	You can encounter the same sort of thing in reload.  The default reload algorithms will
	do this kind of a transformation.  However, you might get better code by loading a base
	register with
		
		ptr+(offset & mask)

	where mask is something that zeros off the low 7 bits or so.  That would allow you to
	share the base addresses if you were accessing nearby values in a large structure for example.


>
>
>   I have been working on this port for the last six
>months. How much time is sufficient enough to build a
>newport (for a fresh compilers engineer).

	I would really find it difficult to predict the time required for an inexperienced engineer.  For an
	experienced compiler developer (with GCC internals experience too), it's possible to do a complete
	tool chain (compiler, assembler, linker, simulator) in as little as 3-4 months.

	Regards,
	Alan

-- 
------------------------------------------------------------------------

		    Quality Software Management
		http://home.earthlink.net/~qsmgmt
			apl@alum.mit.edu
			(978)287-0435 Voice
			(978)808-6836 Cell
			(978)287-0436 Fax

	Software Process Improvement and Management Consulting
	     Language Design and Compiler Implementation


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