This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Putting target-dependent global state into switchable structures
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Mike Stump <mikestump at comcast dot net>, Gcc Patches <gcc-patches at gcc dot gnu dot org>, rdsandiford at googlemail dot com
- Date: Thu, 23 Aug 2012 13:32:57 -0700
- Subject: Re: RFC: Putting target-dependent global state into switchable structures
- References: <87pqzdegwc.fsf@firetop.home> <3D6C15DE-F3F5-409D-A715-5048C96EDD82@comcast.net> <87obm14agt.fsf@talisman.home>
On Thu, Aug 23, 2012 at 1:30 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> 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.
And I did a bootstrap right on mips64-linux-gnu right after the C++
conversion branch was merged in.
Thanks,
Andrew