See gcc-1.40 for a while, 14 years or so to see a period of time, 15 years or so to see a period of time.
It is now possible to say that most of GCC's code is understood.
If you can quickly understand the principles, summarize the way I look at the code shortcut I listed the following several.
First, the GCC version is low, which is the premise of success, but also a shortcut.
Second, the analysis of the most basic hello.c file, just a function call, but enough.
Thirdly, the DEBUG_RTX () function and the Debug_tree () function are found. These two functions can be said to be the only two keys to understand GCC!
Four, the idea is correct, expand_call () How to produce all kinds of rtx? The idea is to use the DEBUG_RTX () function.
Expand_call () The parameter of the function is how to get the tree?
How are the parameters of the expand_expr_stmt () function obtained?
Image can be said that the formation of the tree can be seen as a model of the baby ,
The most basic small set of dolls first formed, and then various operations of the tree function layer of the set up,
The function of the Print_node () function of our debug_tree () function is to separate the set of dolls!
The general idea is: How to get from the source code to the tree, above can say how from the tree to the RTX!
Concerned about how the tree that is related to printf is formed? How does the tree that is related to "hello,world!\n" form?
Five, the principle of grammatical analysis bison is very familiar.
Judging whether a person understands GCC can be divided into 3 levels:
Beginner: hello.c to Hello.I to Hello.s to hello.o to A.out
Intermediate: gcc frontend, from source code to RTL intermediate language, back end from RTL to assembly language.
Advanced: C File source code to Tree,tree to Rtx,rtx to assembly language.
The method of GCC source code Analysis "Summary"