This is the mail archive of the
mailing list for the GCC project.
GSoC proposal: Provide optimizations feedback through post-compilation messages
- From: Thibault Raffaillac <traf at kth dot se>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 27 Mar 2012 22:33:39 +0000
- Subject: GSoC proposal: Provide optimizations feedback through post-compilation messages
My name is Thibault Raffaillac, CS degree student at Kungliga Tekniska Högskolan,
Stockholm, Sweden (in double-degree partnership with Ecole Centrale Marseille,
GCC currently provides no concise way to inform the user whether it applied an
expected optimization (ie, it "understood" the code). As a result, some will do
premature optimizations when they do not trust the compiler, and some others
will create overly convoluted code with blind belief in the compiler. This is
especially relevant for users non-initiated to the internals of GCC.
The project I would like to propose is a feedback for the optimizations
performed by GCC. To avoid binding users to the compiler, I would focus on some
very standard optimizations across vendors, or for some specific yet nice
features I would indicate their specificity to GCC/an architecture.
The feedback would be triggered when compilation is successful, and display a
couple of different messages each time it is run:
gcc --feedback test.c
test.c:xx:x: info: All operands being constant, constant folding was applied to assign '2560' to 'a'
test.c:xx:x: info: GCC could not fold constants here because...
test.c:xx:x: info: As integers are stored in binary format, strength reduction was applied to replace '* 8' by '<< 3'
test.c:xx:x: info: Basic block vectorization was applied to pack the 3 independent additions into a single SIMD instruction
test.c:xx:x: info: GCC implements unordered_map as open-addressed hash tables, with double hashing probing
As a difference with the internal verbose messages, here they would form a set,
and the system would remember those already displayed and decrease their
frequency of occurence between compilations. All messages would explain what
triggered them, cite the optimization name, and describe the consequence.
As for the work plan, it would consist in:
_ Enumerating all possible messages in the messages set.
_ Implementing a function receiving feedback from each optimization unit and
choosing whether to display it: info_printf(enum INFO_INDEX, const char*, ...);
_ Write a formatting guide for adding messages in the set.
My academic background includes compiler construction, C programming and Human-
Computer Interactions. I am very much interested in the usability of compilers
(on which I am currently carrying my degree thesis -
http://www.csc.kth.se/~traf/traf-sketch.pdf) and thus would be glad to
contribute to GCC.
If this can be of interest, suggestions are welcome!