mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-08 18:34:00 +00:00
compiler/module_imports.m:
We construct module_and_imports structures in three different ways.
Each way fills in only a subset of the its fields with meaningful
information. To see whether this is OK, we need to know whether the
fields filled in with dummies are ever accessed. This diff thus adds
an extra field to module_and_imports structures that says how they
were constructed, and if the right compile time flag is set, it records,
for each construction method, which fields have been accessed.
compiler/mercury_compile_main.m:
If that same compile time flag is set, append the recorded information
to a file.
tools/mai_stats:
This tool summarizes the information in that file.
65 lines
1.7 KiB
Awk
Executable File
65 lines
1.7 KiB
Awk
Executable File
#!/usr/bin/awk -f
|
|
BEGIN {
|
|
for (i = 2; i <= 28; i++) {
|
|
init[i] = "not accessed";
|
|
make[i] = "not accessed";
|
|
read[i] = "not accessed";
|
|
}
|
|
|
|
desc[2] = "SrcFileName";
|
|
desc[3] = "ModuleDir";
|
|
desc[4] = "SrcFileModuleName";
|
|
desc[5] = "ModuleName";
|
|
desc[6] = "ModuleNameContext";
|
|
desc[7] = "Ancestors";
|
|
desc[8] = "Children";
|
|
desc[9] = "PublicChildren";
|
|
desc[10] = "NestedChildren";
|
|
desc[11] = "IntDepsMap";
|
|
desc[12] = "ImpDepsMap";
|
|
desc[13] = "IndirectDeps";
|
|
desc[14] = "FactTableDeps";
|
|
desc[15] = "FIMs";
|
|
desc[16] = "ForeignIncludeFiles";
|
|
desc[17] = "HasForeignCode";
|
|
desc[18] = "HasForeignExport";
|
|
desc[19] = "HasMain";
|
|
desc[20] = "SrcBlocks";
|
|
desc[21] = "DirectIntBlocks";
|
|
desc[22] = "IndirectIntBlocks";
|
|
desc[23] = "OptBlocks";
|
|
desc[24] = "IntForOptBlocks";
|
|
desc[25] = "VersionNumbersMap";
|
|
desc[26] = "MaybeTimestamMap";
|
|
desc[27] = "Specs";
|
|
desc[28] = "Errors";
|
|
|
|
}
|
|
$1 == "INIT" && NF == 28 {
|
|
for (i = 2; i <= 28; i++) {
|
|
if ($i == "a") {
|
|
init[i] = "accessed";
|
|
}
|
|
}
|
|
}
|
|
$1 == "MAKE" && NF == 28 {
|
|
for (i = 2; i <= 28; i++) {
|
|
if ($i == "a") {
|
|
make[i] = "accessed";
|
|
}
|
|
}
|
|
}
|
|
$1 == "READ" && NF == 28 {
|
|
for (i = 2; i <= 28; i++) {
|
|
if ($i == "a") {
|
|
read[i] = "accessed";
|
|
}
|
|
}
|
|
}
|
|
END {
|
|
for (i = 2; i <= 28; i++) {
|
|
printf "%-20s init %12s make %12s read %12s\n",
|
|
desc[i], init[i], make[i], read[i];
|
|
}
|
|
}
|