gcc/gcc/ada
Eric Botcazou 3cf3da88be introduce -fcallgraph-info option
This was first submitted many years ago
https://gcc.gnu.org/ml/gcc-patches/2010-10/msg02468.html

The command line option -fcallgraph-info is added and makes the
compiler generate another output file (xxx.ci) for each compilation
unit (or LTO partitoin), which is a valid VCG file (you can launch
your favorite VCG viewer on it unmodified) and contains the "final"
callgraph of the unit.  "final" is a bit of a misnomer as this is
actually the callgraph at RTL expansion time, but since most
high-level optimizations are done at the Tree level and RTL doesn't
usually fiddle with calls, it's final in almost all cases.  Moreover,
the nodes can be decorated with additional info: -fcallgraph-info=su
adds stack usage info and -fcallgraph-info=da dynamic allocation info.


for  gcc/ChangeLog
From  Eric Botcazou  <ebotcazou@adacore.com>, Alexandre Oliva  <oliva@adacore.com>

	* common.opt (-fcallgraph-info[=]): New option.
	* doc/invoke.texi (Developer options): Document it.
	* opts.c (common_handle_option): Handle it.
	* builtins.c (expand_builtin_alloca): Record allocation if
	-fcallgraph-info=da.
	* calls.c (expand_call): If -fcallgraph-info, record the call.
	(emit_library_call_value_1): Likewise.
	* flag-types.h (enum callgraph_info_type): New type.
	* explow.c: Include stringpool.h.
	(set_stack_check_libfunc): Set SET_SYMBOL_REF_DECL on the symbol.
	* function.c (allocate_stack_usage_info): New.
	(allocate_struct_function): Call it for -fcallgraph-info.
	(prepare_function_start): Call it otherwise.
	(record_final_call, record_dynamic_alloc): New.
	* function.h (struct callinfo_callee): New.
	(CALLEE_FROM_CGRAPH_P): New.
	(struct callinfo_dalloc): New.
	(struct stack_usage): Add callees and dallocs.
	(record_final_call, record_dynamic_alloc): Declare.
	* gimplify.c (gimplify_decl_expr): Record dynamically-allocated
	object if -fcallgraph-info=da.
	* optabs-libfuncs.c (build_libfunc_function): Keep SYMBOL_REF_DECL.
	* print-tree.h (print_decl_identifier): Declare.
	(PRINT_DECL_ORIGIN, PRINT_DECL_NAME, PRINT_DECL_UNIQUE_NAME): New.
	* print-tree.c: Include print-tree.h.
	(print_decl_identifier): New function.
	* toplev.c: Include print-tree.h.
	(callgraph_info_file): New global variable.
	(callgraph_info_external_printed): Likewise.
	(output_stack_usage): Rename to...
	(output_stack_usage_1): ... this.  Make it static, add cf
	parameter.  If -fcallgraph-info=su, print stack usage to cf.
	If -fstack-usage, use print_decl_identifier for
	pretty-printing.
	(INDIRECT_CALL_NAME): New.
	(dump_final_node_vcg_start): New.
	(dump_final_callee_vcg, dump_final_node_vcg): New.
	(output_stack_usage): New.
	(lang_dependent_init): Open and start file if
	-fcallgraph-info.  Allocated callgraph_info_external_printed.
	(finalize): If callgraph_info_file is not null, finish it,
	close it, and release callgraph_info_external_printed.

for  gcc/ada/ChangeLog

	* gcc-interface/misc.c (callgraph_info_file): Delete.

Co-Authored-By: Alexandre Oliva <oliva@adacore.com>

From-SVN: r277876
2019-11-06 10:57:18 +00:00
..
doc [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
gcc-interface introduce -fcallgraph-info option 2019-11-06 10:57:18 +00:00
libgnarl Provide Task_Info.Number_Of_Processors on Solaris 2019-09-23 09:13:21 +00:00
libgnat [Ada] Add pragma Preelaborable_Initialization to Stream_IO.File_Type 2019-10-10 15:25:27 +00:00
ada_get_targ.adb
adabkend.adb
adabkend.ads
adadecode.c
adadecode.h
adaint.c [Ada] Fix errno for rename for the VxWorks 6 target 2019-09-18 08:32:09 +00:00
adaint.h
affinity.c
ali-util.adb [Ada] Ignore missing ALI files in GNATprove mode 2019-09-17 07:59:48 +00:00
ali-util.ads [Ada] Ignore missing ALI files in GNATprove mode 2019-09-17 07:59:48 +00:00
ali.adb [Ada] Minor reformattings 2019-08-20 09:50:14 +00:00
ali.ads [Ada] Ignore missing ALI files in GNATprove mode 2019-09-17 07:59:48 +00:00
alloc.ads
argv-lynxos178-raven-cert.c
argv.c
aspects.adb [Ada] Minor reformattings 2019-08-20 09:50:14 +00:00
aspects.ads
atree.adb [Ada] 'others' in conditional_expressions 2019-10-10 15:24:01 +00:00
atree.ads [Ada] 'others' in conditional_expressions 2019-10-10 15:24:01 +00:00
atree.h
aux-io.c
back_end.adb
back_end.ads
bcheck.adb
bcheck.ads
binde.adb
binde.ads
binderr.adb
binderr.ads
bindgen.adb [Ada] Flag Sec_Stack_Used incorrectly set by ghost code 2019-10-10 15:22:55 +00:00
bindgen.ads
bindo-augmentors.adb
bindo-augmentors.ads
bindo-builders.adb
bindo-builders.ads
bindo-diagnostics.adb
bindo-diagnostics.ads
bindo-elaborators.adb
bindo-elaborators.ads
bindo-graphs.adb [Ada] Bindo.Graphs: Minor typo fixes 2019-08-21 08:30:32 +00:00
bindo-graphs.ads [Ada] Bindo.Graphs: Minor typo fixes 2019-08-21 08:30:32 +00:00
bindo-units.adb
bindo-units.ads
bindo-validators.adb
bindo-validators.ads
bindo-writers.adb
bindo-writers.ads
bindo.adb
bindo.ads
bindusg.adb
bindusg.ads
butil.adb
butil.ads
cal.c
casing.adb
casing.ads
ceinfo.adb
ChangeLog introduce -fcallgraph-info option 2019-11-06 10:57:18 +00:00
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog.ptr
ChangeLog.tree-ssa
checks.adb [Ada] Fix spurious alignment warning on simple address clause 2019-09-18 08:33:44 +00:00
checks.ads [Ada] Fix spurious alignment warning on simple address clause 2019-09-18 08:33:44 +00:00
cio.c
clean.adb
clean.ads
comperr.adb
comperr.ads
config-lang.in
contracts.adb
contracts.ads
csets.adb
csets.ads
csinfo.adb
cstand.adb
cstand.ads
cstreams.c
ctrl_c.c
debug_a.adb
debug_a.ads
debug.adb
debug.ads
einfo.adb [Ada] Assertion_Policy (Ignore) ignores invariants 2019-10-10 15:23:33 +00:00
einfo.ads [Ada] Assertion_Policy (Ignore) ignores invariants 2019-10-10 15:23:33 +00:00
elists.adb
elists.ads
elists.h
env.c
env.h
err_vars.ads
errno.c
errout.adb [Ada] Pragma Warning_As_Error works for style warnings 2019-08-20 09:48:51 +00:00
errout.ads [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
erroutc.adb [Ada] Pragma Warning_As_Error works for style warnings 2019-08-20 09:48:51 +00:00
erroutc.ads [Ada] Pragma Warning_As_Error works for style warnings 2019-08-20 09:48:51 +00:00
errutil.adb
errutil.ads
eval_fat.adb
eval_fat.ads
exit.c
exp_aggr.adb [Ada] Fix copy operation with private discriminated record type 2019-09-19 08:14:38 +00:00
exp_aggr.ads
exp_atag.adb
exp_atag.ads
exp_attr.adb [Ada] Exp_Attr: remove obsolete comment 2019-09-19 08:13:52 +00:00
exp_attr.ads
exp_cg.adb
exp_cg.ads
exp_ch2.adb
exp_ch2.ads
exp_ch3.adb [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
exp_ch3.ads [Ada] Minor reformattings 2019-08-20 09:50:14 +00:00
exp_ch4.adb [Ada] Various minor typo fixes 2019-10-10 15:25:18 +00:00
exp_ch4.ads
exp_ch5.adb [Ada] Avoid gnatbind regression caused by Copy_Bitfield 2019-09-18 08:33:49 +00:00
exp_ch5.ads
exp_ch6.adb [Ada] Spurious restriction violation on Ghost code 2019-10-10 15:23:14 +00:00
exp_ch6.ads [Ada] Adding assertions on extra formals for BIP function calls 2019-09-17 07:59:33 +00:00
exp_ch7.adb [Ada] Handling up-level references in loops within library-level declarations 2019-10-10 15:25:36 +00:00
exp_ch7.ads
exp_ch8.adb
exp_ch8.ads
exp_ch9.adb [Ada] Unnesting issues with entry families and accept statements 2019-10-10 15:25:08 +00:00
exp_ch9.ads
exp_ch10.ads
exp_ch11.adb [Ada] Minor reformattings 2019-08-20 09:50:14 +00:00
exp_ch11.ads
exp_ch12.adb
exp_ch12.ads
exp_ch13.adb [Ada] Crash on a Storage_Size aspect depending on attr. of another type 2019-08-20 09:50:38 +00:00
exp_ch13.ads
exp_code.adb
exp_code.ads
exp_dbug.adb [Ada] Remove duplicated routines for getting homonym number 2019-09-19 08:13:25 +00:00
exp_dbug.ads [Ada] Remove duplicated routines for getting homonym number 2019-09-19 08:13:25 +00:00
exp_disp.adb [Ada] Code cleanup of alignment representation clauses in dispatch tables 2019-09-18 08:32:42 +00:00
exp_disp.ads
exp_dist.adb
exp_dist.ads
exp_fixd.adb
exp_fixd.ads
exp_imgv.adb
exp_imgv.ads
exp_intr.adb
exp_intr.ads
exp_pakd.adb
exp_pakd.ads
exp_prag.adb
exp_prag.ads
exp_sel.adb
exp_sel.ads
exp_smem.adb
exp_smem.ads
exp_spark.adb [Ada] Factor out code for deciding statically known Constrained attributes 2019-09-18 08:32:19 +00:00
exp_spark.ads
exp_strm.adb
exp_strm.ads
exp_tss.adb
exp_tss.ads
exp_unst.adb [Ada] Suppress GNAT FE up-level reference transformation for GNAT-LLVM 2019-09-19 08:13:34 +00:00
exp_unst.ads
exp_util.adb [Ada] Assertion_Policy (Ignore) ignores invariants 2019-10-10 15:23:33 +00:00
exp_util.ads [Ada] Remove duplicated routines for getting homonym number 2019-09-19 08:13:25 +00:00
expander.adb
expander.ads
expect.c
fe.h
final.c
fmap.adb
fmap.ads
fname-sf.adb
fname-sf.ads
fname-uf.adb
fname-uf.ads
fname.adb
fname.ads
freeze.adb [Ada] Ensure constructor is a C++ constructor 2019-10-10 15:25:32 +00:00
freeze.ads
frontend.adb [Ada] Skip entity name qualification in GNATprove mode 2019-09-18 08:32:28 +00:00
frontend.ads
get_scos.adb
get_scos.ads
get_targ.adb
get_targ.ads
ghost.adb
ghost.ads
gnat1drv.adb [Ada] Fix handling of -gnatceg on incomplete unit 2019-10-10 15:23:28 +00:00
gnat1drv.ads
gnat_rm.texi [Ada] Accept concatentation arguments to pragma Annotate 2019-09-19 08:14:52 +00:00
gnat_ugn.texi [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
gnat-style.texi
gnatbind.adb
gnatbind.ads
gnatchop.adb
gnatclean.adb
gnatcmd.adb
gnatcmd.ads
gnatdll.adb
gnatfind.adb
gnathtml.pl
gnatkr.adb
gnatkr.ads
gnatlink.adb
gnatlink.ads
gnatls.adb [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
gnatls.ads
gnatmake.adb
gnatmake.ads
gnatname.adb
gnatname.ads
gnatprep.adb
gnatprep.ads
gnatvsn.adb
gnatvsn.ads
gnatxref.adb
gprep.adb
gprep.ads
gsocket.h [Ada] Support for local unix sockets in GNAT.Sockets API 2019-09-17 07:59:23 +00:00
hostparm.ads
impunit.adb [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
impunit.ads
indepsw-aix.adb
indepsw-darwin.adb
indepsw-gnu.adb
indepsw.adb
indepsw.ads
init.c
initialize.c
inline.adb [Ada] Fix inlining of subprograms with deep param/result in GNATprove 2019-10-10 15:25:22 +00:00
inline.ads
itypes.adb
itypes.ads
krunch.adb
krunch.ads
layout.adb
layout.ads
lib-list.adb
lib-load.adb [Ada] Get rid of linear searches in Lib 2019-08-20 09:48:33 +00:00
lib-load.ads
lib-sort.adb
lib-util.adb
lib-util.ads
lib-writ.adb [Ada] Get rid of linear searches in Lib 2019-08-20 09:48:33 +00:00
lib-writ.ads [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
lib-xref-spark_specific.adb
lib-xref.adb
lib-xref.ads
lib.adb [Ada] Get rid of linear searches in Lib 2019-08-20 09:48:33 +00:00
lib.ads [Ada] Get rid of linear searches in Lib 2019-08-20 09:48:33 +00:00
link.c
live.adb
live.ads
locales.c * locales.c (iso_3166): Add missing comma after "United-States". 2019-10-27 21:46:54 +01:00
make_util.adb
make_util.ads [Ada] Force even timestamp in Windows ALI files 2019-09-17 08:02:20 +00:00
Make-generated.in
make.adb [Ada] Fix typo in error message 2019-09-18 08:32:00 +00:00
make.ads
Makefile.in
Makefile.rtl Makefile.rtl (a-except.o): Put -O1 earlier so that it can be overriden if needed by other variables. 2019-10-15 12:12:15 +02:00
makeusg.adb
makeusg.ads
mdll-fil.adb
mdll-fil.ads
mdll-utl.adb
mdll-utl.ads
mdll.adb
mdll.ads
mingw32.h
mkdir.c
namet-sp.adb
namet-sp.ads
namet.adb
namet.ads
namet.h
nlists.adb
nlists.ads
nlists.h
nmake.adt
opt.adb
opt.ads [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
osint-b.adb
osint-b.ads
osint-c.adb
osint-c.ads
osint-l.adb
osint-l.ads
osint-m.adb
osint-m.ads
osint.adb * osint.adb (OS_Time_To_GNAT_Time): Remove dependency on To_C/To_Ada 2019-09-26 16:10:46 +02:00
osint.ads [Ada] Force even timestamp in Windows ALI files 2019-09-17 08:02:20 +00:00
output.adb
output.ads
par_sco.adb [Ada] Minor reformattings 2019-08-20 09:50:14 +00:00
par_sco.ads
par-ch2.adb
par-ch3.adb
par-ch4.adb [Ada] Enable delta_aggregate only in Ada 2020 mode 2019-08-20 09:49:37 +00:00
par-ch5.adb
par-ch6.adb
par-ch7.adb
par-ch8.adb
par-ch9.adb
par-ch10.adb
par-ch11.adb
par-ch12.adb
par-ch13.adb
par-endh.adb
par-labl.adb
par-load.adb
par-prag.adb [Ada] New pragma Aggregate_Individually_Assign 2019-08-20 09:49:41 +00:00
par-sync.adb
par-tchk.adb
par-util.adb
par.adb
par.ads
pprint.adb
pprint.ads
prep.adb
prep.ads
prepcomp.adb
prepcomp.ads
put_scos.adb
put_scos.ads
raise-gcc.c
raise.c
raise.h
repinfo-input.adb
repinfo-input.ads
repinfo.adb [Ada] More complete information level for -gnatR4 output 2019-08-21 08:30:58 +00:00
repinfo.ads
repinfo.h
restrict.adb
restrict.ads
rident.ads
rtfinal.c
rtinit.c
rtsfind.adb [Ada] Flag Sec_Stack_Used incorrectly set by ghost code 2019-10-10 15:22:55 +00:00
rtsfind.ads [Ada] Rtsfind: improve comment on RTE_Available 2019-09-19 08:12:34 +00:00
runtime.h
s-oscons-tmplt.c [Ada] Support for local unix sockets in GNAT.Sockets API 2019-09-17 07:59:23 +00:00
sa_messages.adb
sa_messages.ads
scans.adb
scans.ads
scil_ll.adb
scil_ll.ads
scn.adb
scn.ads
scng.adb
scng.ads
scos.adb
scos.ads
scos.h
sdefault.ads
seh_init.c
sem_aggr.adb [Ada] 'others' in conditional_expressions 2019-10-10 15:24:01 +00:00
sem_aggr.ads
sem_attr.adb [Ada] Memory leak with 'Range of a function call in a loop 2019-09-19 08:13:15 +00:00
sem_attr.ads
sem_aux.adb
sem_aux.ads
sem_case.adb
sem_case.ads
sem_cat.adb [Ada] Various minor typo fixes 2019-10-10 15:25:18 +00:00
sem_cat.ads
sem_ch2.adb
sem_ch2.ads
sem_ch3.adb [Ada] Various minor typo fixes 2019-10-10 15:25:18 +00:00
sem_ch3.ads
sem_ch4.adb [Ada] Ada 2020: Raise expressions in limited contexts (AI12-0172) 2019-09-17 07:59:53 +00:00
sem_ch4.ads
sem_ch5.adb [Ada] Minor reformattings 2019-08-20 09:50:14 +00:00
sem_ch5.ads
sem_ch6.adb [Ada] Various minor typo fixes 2019-10-10 15:25:18 +00:00
sem_ch6.ads
sem_ch7.adb [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
sem_ch7.ads
sem_ch8.adb re PR ada/91995 (gnat miscompilation and bootstrap failure on m68k-linux) 2019-10-12 14:47:34 +00:00
sem_ch8.ads
sem_ch9.adb [Ada] Replace low-level membership tests with high-level routines 2019-08-21 08:29:37 +00:00
sem_ch9.ads
sem_ch10.adb
sem_ch10.ads
sem_ch11.adb
sem_ch11.ads
sem_ch12.adb [Ada] Various minor typo fixes 2019-10-10 15:25:18 +00:00
sem_ch12.ads
sem_ch13.adb [Ada] Get rid of spurious error for _Tag on extension with reverse bit order 2019-10-10 15:24:26 +00:00
sem_ch13.ads
sem_dim.adb
sem_dim.ads
sem_disp.adb [Ada] Minor reformattings 2019-08-20 09:50:14 +00:00
sem_disp.ads
sem_dist.adb
sem_dist.ads
sem_elab.adb re PR ada/91995 (gnat miscompilation and bootstrap failure on m68k-linux) 2019-10-12 14:47:34 +00:00
sem_elab.ads
sem_elim.adb
sem_elim.ads
sem_eval.adb [Ada] Don't fail a front-end assertion if errors have already been detected 2019-09-18 08:32:37 +00:00
sem_eval.ads
sem_intr.adb
sem_intr.ads
sem_mech.adb
sem_mech.ads
sem_prag.adb [Ada] Various minor typo fixes 2019-10-10 15:25:18 +00:00
sem_prag.ads
sem_res.adb [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
sem_res.ads
sem_scil.adb
sem_scil.ads
sem_smem.adb
sem_smem.ads
sem_type.adb [Ada] Don't accept illegal (e.g., Integer'(null)) generic actuals 2019-09-17 08:02:04 +00:00
sem_type.ads
sem_util.adb re PR ada/91995 (gnat miscompilation and bootstrap failure on m68k-linux) 2019-10-12 14:47:34 +00:00
sem_util.ads re PR ada/91995 (gnat miscompilation and bootstrap failure on m68k-linux) 2019-10-12 14:47:34 +00:00
sem_warn.adb [Ada] Spurious warning on call with out parameter in expression function 2019-10-10 15:25:13 +00:00
sem_warn.ads
sem.adb [Ada] Fix ineffective -gnatyN for separate compilation units 2019-09-17 08:02:46 +00:00
sem.ads
set_targ.adb
set_targ.ads
sfn_scan.adb
sfn_scan.ads
sigtramp-armdroid.c
sigtramp-ios.c
sigtramp-qnx.c
sigtramp-vxworks-target.inc
sigtramp-vxworks.c
sigtramp.h
sinfo-cn.adb
sinfo-cn.ads
sinfo.adb [Ada] 'others' in conditional_expressions 2019-10-10 15:24:01 +00:00
sinfo.ads [Ada] 'others' in conditional_expressions 2019-10-10 15:24:01 +00:00
sinput-c.adb
sinput-c.ads
sinput-d.adb
sinput-d.ads
sinput-l.adb
sinput-l.ads
sinput.adb
sinput.ads
snames.adb-tmpl
snames.ads-tmpl [Ada] New pragma Aggregate_Individually_Assign 2019-08-20 09:49:41 +00:00
snames.h-tmpl
socket.c
spark_xrefs.adb
spark_xrefs.ads
sprint.adb
sprint.ads
stand.adb
stand.ads
standard.ads.h
stringt.adb [Ada] Pragma Warning_As_Error works for style warnings 2019-08-20 09:48:51 +00:00
stringt.ads [Ada] Pragma Warning_As_Error works for style warnings 2019-08-20 09:48:51 +00:00
stringt.h
style.adb
style.ads
styleg.adb
styleg.ads
stylesw.adb
stylesw.ads
switch-b.adb
switch-b.ads
switch-c.adb
switch-c.ads
switch-m.adb
switch-m.ads
switch.adb
switch.ads
symbols.adb
symbols.ads
sysdep.c
table.adb
table.ads
targext.c
targparm.adb
targparm.ads
tb-gcc.c
tbuild.adb
tbuild.ads
tempdir.adb
tempdir.ads
terminals.c [Ada] Mention GNAT Studio instead of GPS 2019-10-10 15:23:19 +00:00
tracebak.c
tree_gen.adb
tree_gen.ads
tree_in.adb
tree_in.ads
tree_io.adb
tree_io.ads
treepr.adb [Ada] Debug procedure for printing ancestors 2019-10-10 15:24:06 +00:00
treepr.ads [Ada] Debug procedure for printing ancestors 2019-10-10 15:24:06 +00:00
treeprs.adt
ttypes.ads
types.adb
types.ads
types.h
uintp.adb
uintp.ads
uintp.h
uname.adb
uname.ads
urealp.adb
urealp.ads
urealp.h
usage.adb
usage.ads
validsw.adb
validsw.ads
vx_stack_info.c
vxworks-arm-link.spec
vxworks-e500-link.spec
vxworks-ppc-link.spec
vxworks-smp-arm-link.spec
vxworks-smp-e500-link.spec
vxworks-smp-ppc-link.spec
vxworks-smp-x86-link.spec
vxworks-x86-link.spec
warnsw.adb [Ada] Warning for out-of-order record representation clauses 2019-08-20 09:49:02 +00:00
warnsw.ads [Ada] Warning for out-of-order record representation clauses 2019-08-20 09:49:02 +00:00
widechar.adb
widechar.ads
xeinfo.adb
xnmake.adb
xoscons.adb
xr_tabls.adb
xr_tabls.ads
xref_lib.adb [Ada] gnatxref: infinite loop on symbols not found 2019-09-19 08:12:47 +00:00
xref_lib.ads
xsinfo.adb
xsnamest.adb
xtreeprs.adb
xutil.adb
xutil.ads