This week I continued in my attempt to analyse the dump files produced last week. I happened to read online that the dump files are written in pseudo-C syntax, although pseudocode is supposed to be understood more easily, however it still does not make much sense to me. The dump files content does not seem to provide much that is significant to me. However, one thing that I noticed about the dump files are they all have numbers starting with D. running sequentially, such as D.33591, D.33593 etc. Sometimes, some of the numbers may be skipped but they generally follow the ascending order throughout the dump files. I suspect that these numbers are related to registers used or memory address location for the operation of the particular source code. I have not found information to confirm about this as there are very few resources online about dump files. That following is a snapshot of a part
.gimple dump file. I have not found a complete guide to analyse these dump files, but until this point,
Tree Dump Files Examples
Other than that, I have found in GCC manual about different dump files produced and what they mean generally. The following are some examples for tree dumpfiles found in GCC manual:
‘original’ Dump before any tree based optimization, to ‘file.original’.
‘optimized’ Dump after all tree based optimization, to ‘file.optimized’.
‘gimple’ Dump each function before and after the gimplification pass to a file. The file name is made by appending ‘.gimple’ to the source file name.
‘cfg’ Dump the control flow graph of each function to a file. The file name is made by appending ‘.cfg’ to the source file name.
‘ch’ Dump each function after copying loop headers. The file name is made by appending ‘.ch’ to the source file name.
‘ssa’ Dump SSA related information to a file. The file name is made by appending ‘.ssa’ to the source file name.
‘alias’ Dump aliasing information for each function. The file name is made by appending ‘.alias’ to the source file name.
‘ccp’ Dump each function after CCP. The file name is made by appending ‘.ccp’ to the source file name.
RTL Dump Files Examples
The following are some examples for rtl dumpfiles found in GCC manual:
-fdump-rtl-alignments :Dump after branch alignments have been computed
-fdump-rtl-ira :Dump after iterated register allocation.
-fdump-rtl-jump :Dump after the second jump optimization.
-fdump-rtl-loop2 :Enables dumping after the rtl loop optimization passes.
-fdump-rtl-pro_and_epilogue :Dump after generating the function prologues and epilogues.
I have also found the GCC MELT plugin while reading online forum. Previously I have came across this name but I was not convinced that it is applicable. Generally, MELT is implemented as a GCC plugin in a free software. What caught my attention is that “Coding in MELT a GCC extension is much easier than manually developing a GCC plugin in C or C++”. Also, it uses existing GCC plugin hooks to work on GCC internal middle-end representations. From the website, it seems that there are a lot of advantages that MELT can provide. I have also read a post from the developer himself saying that learning to use MELT is easier that developing it in C/C++. I hope that MELT can help in building the plugin that we expect. The following weeks will be mostly about exploring, learning and reading necessary or related information.