Message ID | 3D6C15DE-F3F5-409D-A715-5048C96EDD82@comcast.net |
---|---|
State | New |
Headers | show |
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
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
On Aug 23, 2012, at 1:30 PM, Richard Sandiford wrote: >> ../../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. So, where is the prototype for this function? a grep seems not to find it. Possibly my compiler is pickier than yours, I'm using g++ 4.5.1 apparently.
On Thu, Aug 23, 2012 at 02:29:39PM -0700, Mike Stump wrote: > On Aug 23, 2012, at 1:30 PM, Richard Sandiford wrote: > >> ../../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. > > So, where is the prototype for this function? a grep seems not to find it. Possibly my compiler is pickier than yours, I'm using g++ 4.5.1 apparently. Should be generated like most other ggc_alloc_* macros in gtype-desc.h. Jakub
Mike Stump <mikestump@comcast.net> writes: > On Aug 23, 2012, at 1:30 PM, Richard Sandiford wrote: >>> ../../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. > > So, where is the prototype for this function? a grep seems not to > find it. Possibly my compiler is pickier than yours, I'm using g++ > 4.5.1 apparently. It's supposed to be in gtype-desc.h (which is generated automatically). #define ggc_alloc_target_globals() ((struct target_globals *)(ggc_internal_alloc_stat (sizeof (struct target_globals) MEM_STAT_INFO))) That in turn gets pulled in via ggc.h. Richard
diff --git a/gcc/target-globals.c b/gcc/target-globals.c index e679f21..4e33359 100644 --- a/gcc/target-globals.c +++ b/gcc/target-globals.c @@ -65,6 +65,7 @@ struct target_globals * save_target_globals (void) { struct target_globals *g; + extern struct target_globals *ggc_alloc_target_globals (void); g = ggc_alloc_target_globals (); g->flag_state = XCNEW (struct target_flag_state);