Re: C++ and gather-detailed-mem-stats

2012-08-27 Thread Michael Matz
Hi, On Fri, 24 Aug 2012, Diego Novillo wrote: > > void foo (int bar) __attribute__((add_location_pack)); > > > > that directs GNU C++ to add a __Gcc_call_location_pack typed > > argument at each call site (properly constructed of course)? > > I really like this idea. > > Couldn't we make it ev

Re: C++ and gather-detailed-mem-stats

2012-08-24 Thread Tom Tromey
> "Diego" == Diego Novillo writes: Diego> The compiler will then always add 'file', 'function' and 'line' to the Diego> argument list, which can then be retrieved via builtins or special Diego> argument names (I think builtins may be safer). Diego> This would allow us to handle operators. I

Re: C++ and gather-detailed-mem-stats

2012-08-24 Thread Gabriel Dos Reis
On Fri, Aug 24, 2012 at 10:01 AM, Diego Novillo wrote: > On 2012-08-15 06:10 , Richard Guenther wrote: > >> Maybe have a GNU C++ builtin type >> >> struct __Gcc_call_location_pack { >>const char *file; >>const char *function; >>unsigned line; >> }; >> >> and an attribute >> >> void foo

Re: C++ and gather-detailed-mem-stats

2012-08-24 Thread Diego Novillo
On 2012-08-15 06:10 , Richard Guenther wrote: Maybe have a GNU C++ builtin type struct __Gcc_call_location_pack { const char *file; const char *function; unsigned line; }; and an attribute void foo (int bar) __attribute__((add_location_pack)); that directs GNU C++ to add a __Gcc_cal

Re: C++ and gather-detailed-mem-stats

2012-08-16 Thread Diego Novillo
On 12-08-16 04:29 , Richard Guenther wrote: May it not suggest it applies "very lazy", like after inlining for example? Anyway, sofar I'd side with Michas suggestion of using __builtin_FILE, etc. if people agree on adding _lazy that's fine for me, too. So far two votes for __builtin_FILE, one

Re: C++ and gather-detailed-mem-stats

2012-08-16 Thread Richard Guenther
On Wed, 15 Aug 2012, Gabriel Dos Reis wrote: > On Wed, Aug 15, 2012 at 7:34 PM, Lawrence Crowl wrote: > > Would it be more productive to ensure that existing tools, like > > valgrind, are effective with gcc? > > Indeed. Richard's patch strikes me as the way to go with > the issue he raised. It

Re: C++ and gather-detailed-mem-stats

2012-08-16 Thread Richard Guenther
On Wed, 15 Aug 2012, Lawrence Crowl wrote: > On 8/15/12, Gabriel Dos Reis wrote: > > On Aug 15, 2012 Richard Guenther wrote: > > > On Wed, 15 Aug 2012, Michael Matz wrote: > > > > On Wed, 15 Aug 2012, Richard Guenther wrote: > > > > > Prototype below - fire away on bikeshedding names. > > > > Ma

Re: C++ and gather-detailed-mem-stats

2012-08-16 Thread Richard Guenther
On Wed, 15 Aug 2012, Tobias Burnus wrote: > Am 15.08.2012 18:26, schrieb Gabriel Dos Reis: > > On Wed, Aug 15, 2012 at 11:21 AM, Tobias Burnus wrote: > > > Gabriel Dos Reis wrote: > > > > A few points to consider: > > > > * relation of __builtin_function_location to C99 (and C++11) > > > >

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 7:34 PM, Lawrence Crowl wrote: > Would it be more productive to ensure that existing tools, like > valgrind, are effective with gcc? Indeed. Richard's patch strikes me as the way to go with the issue he raised. -- Gaby

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Lawrence Crowl
Would it be more productive to ensure that existing tools, like valgrind, are effective with gcc? -- Lawrence Crowl

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gary Funck
Or no explicit parameters at all ... void do_something (T1 t1, T2 t2) __attribute__ ((caller_info)); All this will do (with appropriate compilation switches and/or pre-defined macros) is pass one/more hidden arguments, which in turn can be accessed in the function body via a built-in function. #

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gary Funck
Would it be possible to define a new function attribute that transparently adds two parameters for file name and line number? Or that etablishes a binding between this information and existing parameter names? This might be useful for regular "C" programs as well. void do_something (T1 t1, T2 t

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 5:15 PM, Lawrence Crowl wrote: > On 8/15/12, Gabriel Dos Reis wrote: >> On Aug 15, 2012 Richard Guenther wrote: >> > On Wed, 15 Aug 2012, Michael Matz wrote: >> > > On Wed, 15 Aug 2012, Richard Guenther wrote: >> > > > Prototype below - fire away on bikeshedding names. >>

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Lawrence Crowl
On 8/15/12, Gabriel Dos Reis wrote: > On Aug 15, 2012 Richard Guenther wrote: > > On Wed, 15 Aug 2012, Michael Matz wrote: > > > On Wed, 15 Aug 2012, Richard Guenther wrote: > > > > Prototype below - fire away on bikeshedding names. > > > Make it mirror the preprocessor names that people are used

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 12:03 PM, Georg-Johann Lay wrote: > Gabriel Dos Reis schrieb: > >> Richard Guenther wrote: >>> >>> Hm, well. The following includes documentation and the old new names, >>> __builtin_file_location, etc. >> >> >> This looks good too me. >> >> A few points to consider: >>

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Georg-Johann Lay
Gabriel Dos Reis schrieb: Richard Guenther wrote: Hm, well. The following includes documentation and the old new names, __builtin_file_location, etc. This looks good too me. A few points to consider: * relation of __builtin_function_location to C99 (and C++11) __func__ * Do we want

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Tobias Burnus
Am 15.08.2012 18:26, schrieb Gabriel Dos Reis: On Wed, Aug 15, 2012 at 11:21 AM, Tobias Burnus wrote: Gabriel Dos Reis wrote: A few points to consider: * relation of __builtin_function_location to C99 (and C++11) __func__ * Do we want to update libcpp to systematically expand __FI

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 11:21 AM, Tobias Burnus wrote: > Gabriel Dos Reis wrote: >> >> A few points to consider: >> * relation of __builtin_function_location to C99 (and C++11) __func__ >> >> * Do we want to update libcpp to systematically expand __FILE__ to >>__builtin_file_loca

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Tobias Burnus
Gabriel Dos Reis wrote: A few points to consider: * relation of __builtin_function_location to C99 (and C++11) __func__ * Do we want to update libcpp to systematically expand __FILE__ to __builtin_file_location, etc? If you do so, please make sure that you don't break Fortran,

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 7:52 AM, Richard Guenther wrote: > On Wed, 15 Aug 2012, Michael Matz wrote: > >> Hi, >> >> On Wed, 15 Aug 2012, Richard Guenther wrote: >> >> > Prototype below - fire away on bikeshedding names. >> >> Make it mirror the preprocessor names that people are used to, and do awa

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Richard Guenther
On Wed, 15 Aug 2012, Michael Matz wrote: > Hi, > > On Wed, 15 Aug 2012, Richard Guenther wrote: > > > Prototype below - fire away on bikeshedding names. > > Make it mirror the preprocessor names that people are used to, and do away > with the _loc_: __builtin_FILE, __builtin_FUNCTION, __builti

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Michael Matz
Hi, On Wed, 15 Aug 2012, Richard Guenther wrote: > Prototype below - fire away on bikeshedding names. Make it mirror the preprocessor names that people are used to, and do away with the _loc_: __builtin_FILE, __builtin_FUNCTION, __builtin_LINE. Ciao, Michael.

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Diego Novillo
On 12-08-15 07:26 , Richard Guenther wrote: Prototype below - fire away on bikeshedding names. *_loc instead of loc_*? So it reads as 'file location', 'function location', etc. Other than that, looks fine to me. Diego.

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Richard Guenther
On Wed, 15 Aug 2012, Gabriel Dos Reis wrote: > On Wed, Aug 15, 2012 at 6:01 AM, Richard Guenther wrote: > > On Wed, 15 Aug 2012, Gabriel Dos Reis wrote: > > > >> On Wed, Aug 15, 2012 at 5:11 AM, Florian Weimer wrote: > >> > On 08/15/2012 12:07 PM, Gabriel Dos Reis wrote: > >> > > >> >> You might

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 6:01 AM, Richard Guenther wrote: > On Wed, 15 Aug 2012, Gabriel Dos Reis wrote: > >> On Wed, Aug 15, 2012 at 5:11 AM, Florian Weimer wrote: >> > On 08/15/2012 12:07 PM, Gabriel Dos Reis wrote: >> > >> >> You might try to encode/package information with the >> >> parameters

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 5:10 AM, Richard Guenther wrote: > Maybe have a GNU C++ builtin type > > struct __Gcc_call_location_pack { > const char *file; > const char *function; > unsigned line; > }; > > and an attribute > > void foo (int bar) __attribute__((add_location_pack)); > > that direc

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Richard Guenther
On Wed, 15 Aug 2012, Gabriel Dos Reis wrote: > On Wed, Aug 15, 2012 at 5:11 AM, Florian Weimer wrote: > > On 08/15/2012 12:07 PM, Gabriel Dos Reis wrote: > > > >> You might try to encode/package information with the > >> parameters T and A, but essentially you will hit the wall > >> that __FILE__

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 5:11 AM, Florian Weimer wrote: > On 08/15/2012 12:07 PM, Gabriel Dos Reis wrote: > >> You might try to encode/package information with the >> parameters T and A, but essentially you will hit the wall >> that __FILE__, __LINE__, and __FUNCTION__ are CPP artifacts. > > > GNAT

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Marc Glisse
On Wed, 15 Aug 2012, Richard Guenther wrote: How would you deal with removing the ops3 variant here: -#define gimple_build_assign_with_ops(c,o1,o2,o3) \ - gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO) -#define gimple_build_assign_with_ops3(c,o

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Richard Guenther
On Wed, 15 Aug 2012, Gabriel Dos Reis wrote: > On Wed, Aug 15, 2012 at 4:37 AM, Richard Guenther wrote: > > > > I face an issue with replacing macros with C++ functions and the > > way we implement gather-detailed-mem-stats. Currently the > > mem-stat info is passed at the call site of functions

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Florian Weimer
On 08/15/2012 12:07 PM, Gabriel Dos Reis wrote: You might try to encode/package information with the parameters T and A, but essentially you will hit the wall that __FILE__, __LINE__, and __FUNCTION__ are CPP artifacts. GNAT has built-in functions which return this information. When they are

Re: C++ and gather-detailed-mem-stats

2012-08-15 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 4:37 AM, Richard Guenther wrote: > > I face an issue with replacing macros with C++ functions and the > way we implement gather-detailed-mem-stats. Currently the > mem-stat info is passed at the call site of functions via macros > like > > #define VEC_safe_grow_cleared(T,A