On Wed, Nov 13, 2013 at 11:53:32AM +0100, Richard Biener wrote: > > So, perhaps we should just define SWITCHABLE_TARGET on i?86/x86_64/powerpc* > > (and rx if maintainer cares) and tweak it to attach somehow > > struct target_globals * to TARGET_OPTION_NODE somehow. > > A problem might be that lots of the save_target_globals > > allocated structures are heap allocated rather than GC, so we might leak > > memory. Wonder if save_target_globals couldn't just compute the > > aggregate size of all the structures it allocates with XCNEW right now > > (plus required alignment if needed) and just allocate them together > > with the ggc_alloc_target_globals after the target_globals structure > > itself. > > If you want to re-use it from functions with same options don't you > have a hashtable anyway? You could add a reference count.
build_target_option_node is such a hash table for that. Jakub