Files
mercury/tools/cons_table.awk
Zoltan Somogyi 92ac7d6602 Add a way to dump the cons_table.
compiler/hlds_out_module.m:
    If a new control boolean is set, then dump the contents of the cons_table.

    Add a comment containing summary information derived from such dumps.

compiler/hlds_out_util.m:
    Add this new control boolean.

compiler/check_options.m:
    Allow the specification of this new control boolean.

compiler/hlds_cons.m:
    Provide a utility predicate for giving hlds_out_module.m the info
    it needs without making the structure of the cons_table public.

compiler/mercury_compile_llds_back_end.m:
    Rename the final dump stage of the LLDS backend to "final", since
    that is what the user guide documents. (The MLDS backend already had
    this right.)

tools/cons_table.awk:
    Add this script for summarizing dumped cons_tables.
2025-07-21 19:35:39 +02:00

24 lines
722 B
Awk

#!/usr/bin/awk -f
# vim: ft=awk ts=4 sw=4 et
$2 == "DU_CTORS" {
name_count++;
name_sum += $NF;
if ($NF > name_max) {
name_max = $NF;
}
}
$2 == "FQ_DU_CTOR" {
ctor_count++;
ctor_sum += $NF;
if ($NF > ctor_max) {
ctor_max = $NF;
}
}
END {
printf("#names = %8d, #ctors = %8d, #ctors/name = %6.2f, max = %2d\n",
name_count, name_count, (name_sum/name_count), name_max);
printf("#ctors = %8d, #synonyms = %8d, #synonyms/ctor = %6.2f, max = %2d\n",
ctor_count, ctor_count, (ctor_sum/ctor_count), ctor_max);
}