Hi, Patrice,
I don't know about inserting call at the basic block level, but I am
quite sure inserting calls at the function level could be done by
aspect-oriented-programming (AOP).
For example, we used our project, AspectC compiler (www.aspectc.net), to
weave in following aspect into gcc,
#include<stdio.h>
before():call($ $(...)){
fprintf(stderr, "%s\n", this->funcName);
}
What it does is just to print out name of every functions called inside
gcc during execution time.
Our experiment shows that gcc makes 637929 function calls in order to
compile following program into machine code:
#include<stdio.h>
void main(){
char *cool = "cool";
printf("%s\n",cool);
}
And the function names, ordered by calling sequence, are :
---------------------------------------------------------------------------
main
xmalloc_set_program_name
unlock_std_streams
unlock_1
unlock_1
unlock_1
gcc_init_libintl
alloc_args
xmalloc
xmalloc
xmalloc
xmalloc
process_command
xstrdup
xmalloc
make_relative_prefix
lbasename
lrealpath
split_directories
save_string
save_string
save_string
save_string
save_string
save_string
split_directories
......
maybe_unlink
unlink_if_ordinary
lstat
pex_free
pex_unix_cleanup
delete_temp_files
delete_if_ordinary
stat
delete_if_ordinary
stat
----------------------------------------------------------
This is just a simple aspect. More advanced aspect, like memory
profiling, can be easily done by AOP. The cool thing is that those extra
code is totally modularized in aspect, ie. not a single piece of code
will go into gcc code base.
Just an alternative.
Thanks.
Mike
----- Original Message -----
From: "GERIN Patrice" <[EMAIL PROTECTED]>
To: "Jan Hubicka" <[EMAIL PROTECTED]>
Cc: <gcc@gcc.gnu.org>
Sent: Thursday, February 08, 2007 5:56 PM
Subject: Re: Inserting profiling function calls
Would you for a start please
explain what do you need to do that can't be done using existing arc
and
value profiling?
Sorry, my first mail was not clear about the goal.
Objectives are to follow the execution of function and basic block at
execution time.
To do this, we plan to insert function call, like mcount is inserted
at the function level for gprof but at the basic block level.
A user library linked with the application can then implement this
functions.
Thank you,
Patrice
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et
son interface révolutionnaire.
http://fr.mail.yahoo.com