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: RFC: Putting target-dependent global state into switchable structures


Mike Stump <mikestump@comcast.net> writes:
> On Jun 26, 2010, at 12:24 PM, Richard Sandiford wrote:
>> GCC has a fair number of global variables that cache target-dependent
>> data.  This makes it difficult to switch between subtargets on the fly,
>> such as when switching between a MIPS16 and a non-MIPS16 function.
>> 
>> Our current approach is to call target_reinit each time we make such
>> a switch.  This function goes off and redoes a fair chunk of the target
>> initialisation process, and although it works (or least worked) pretty well,
>> it is very slow.
>> 
>
>> 	* doc/tm.texi (SWITCHABLE_TARGET): Document.
>> 	* Makefile.in (target_globals_def): New variable.
>> 	(target_globals_h): Likewise.
>> 	(TARGET_GLOBALS_H): Likewise.
>> 	(OBJS-common): Add target-globals.o.
>> 	(gtype-desc.o): Depend on $(TARGET_GLOBALS_H).
>> 	(target-globals.o): New rule.
>> 	($(target_globals_h)): Likewise.
>> 	(s-target-globals): Likewise.
>> 	(GTFILES): Add $(target_globals_h).
>> 	(build/gentarget-globals.o): New rule.
>> 	* defaults.h (SWITCHABLE_TARGET): Define.
>> 	* gengtype.c (open_base_files): Add target-globals.h to the
>> 	include list.
>> 	* target-globals.def: New file.
>> 	* gentarget-globals.c: Likewise.
>> 	* target-globals.c: Likewise.
>
> First, thanks for the work.  I have a switchable port, I seem to be seeing:
>
> ../../gcc/gcc/target-globals.c: In function âtarget_globals* save_target_globals()â:
> ../../gcc/gcc/target-globals.c:69:33: error: âggc_alloc_target_globalsâ was not declared in this scope
> make: *** [target-globals.o] Error 1
>
> after the switch to C++.  I was wondering if your switchable target port compiles post the switch to C++?

Yeah, mips64-elf with today's trunk seems OK.  mips64-linux-gnu compiled
relatively recently on the conversion branch too.

FWIW, this was using an x86_64 host compiler bootstrapped from the
same tree.

Richard


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