On Wed, 2026-04-08 at 11:47 -0500, soma pal via Gcc wrote: > Hi , Hi Soma
> > I am a research scholar working with GCC, and I am interested in > extracting > properties of individual functions in a program, especially the hot > functions identified through profiling. I would like to obtain > features > such as function_name, bb_count, loop_count, branch_count, > call_count, > load_count, store_count, and instruction_count to use as input for an > ML > model. > > Could you please suggest a way to extract this information? Some possible approaches you could try: * -fsave-optimization-record will write out a SRCFILE.opt- record.json.gz with information on optimization, including some of the information you want (e.g. profile data) * -fdump-tree-all, -fdump-rtl-all, etc will dump a lot more info, albeit not necessarily in a readily-consumable form * in the not-yet-released trunk (gcc 16), -fdiagnostics-add- output=sarif:cfgs=yes emits a .sarif file containing detailed information about the CFGs for all functions at the start of each optimization pass (both for the gimple and RTL intermediate representations). * write a plugin that captures exactly the information you need (perhaps looking at the implementation of the above for inspiration) Hope this is constructive Dave
