This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to create new functions with a gcc plugin?


Hi all,

I'm using a gcc plugin to do some instrument during compilation.

Instrument in functions is simple. But how can I create new functions,
and append it to executables? I want to instrument in this way: to
create new functions,  add my codes into them, then instrument some
calls to them.

foo:
call to new_function;      //instrument a call

new_function:                 //created function
instrument  codes here

I think the most difficult part is to create functions. If it's
possible to do so, can I create functions at any phase during
compilation(with a gimple, or a rtl pass)?

 Any tips?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]