- 博客(48)
- 资源 (22)
- 收藏
- 关注
原创 GCC-3.4.6源代码学习笔记 当前目录
>> 后端部分目录由此链接进入参考文献准备工作GCC的架构前端1.概览1.1. 前端中树的表达形式1.1.1. 树节点的定义1.1.2. tree_code —— 树节点的ID1.1.3. 树节点的内存分配1.1.3.1. 节点大小的确定1.1.3.2. 内存分配1.2. 树节点的构造1.2.1. 机器模式的概念[2]1.2.2. 内建类型的树节点1.2.2.1. 初始化临时的size_
2010-03-05 09:47:00 3373 4
原创 Studying note of GCC-3.4.6 source (23)
3.3.3. Handling other optionsNow everything is ready, it’s time to handle options other than –O, the optimization option. decode_options (continue) 618 handle_options (argc, argv, lang_ma
2010-03-31 11:56:00 620
原创 GCC-3.4.6源代码学习笔记(23)
3.3.3. 处理其他选项一切准备好后,可以开始处理除-O优化选项外的编译命令行选项了。 decode_options (continue) 618 handle_options (argc, argv, lang_mask);619 620 if (flag_pie)621 flag_pic = flag_pie;622 if (
2010-03-31 11:44:00 1097
原创 Studying note of GCC-3.4.6 source (22)
3.3.2. Initializing options related to targetAt line 605 above, set_target_switch handles options related to compile target. All these options begins with “-m”. 3829 void3830 set_target_switch
2010-03-30 11:51:00 798
原创 GCC-3.4.6源代码学习笔记(22)
3.3.2. 初始化与目标平台相关选项在上面605行, set_target_switch处理与目标平台相关的选项。所有这些选项都以“-m”开头。 3829 void3830 set_target_switch (const char *name) in toplev.
2010-03-30 11:46:00 1424
原创 Studying note of GCC-3.4.6 source (21)
3.3. Handling switches3.3.1. Options related to optimizationBack to decode_options, at line 480, for C++, initialize_diagnostics in lang_hooks points to cxx_initialize_diagnostics. It setups diagn
2010-03-25 11:42:00 765
原创 GCC-3.4.6源代码学习笔记(21)
3.3. 处理编译选项3.3.1. 与优化有关的选项回到decode_options,在480行,对于C++,lang_hooks中的钩子initialize_diagnostics引用cxx_initialize_diagnostics。它设立诊断设施,用于给出足够详细、正确的出错消息。这里我们跳过它,因为它与真正的编译关系不大。 decode_options (continue
2010-03-25 11:32:00 2089
原创 Studying note of GCC-3.4.6 source (20)
3.2.2. Prepare for switches handling After creating cpp_reader, c_common_init_options confirms the language finally; and initializes related data structure. The function will return information abou
2010-03-24 11:40:00 623
原创 GCC-3.4.6源代码学习笔记(20)
3.2.2. 准备处理编译命令选项在创建了cpp_reader对象后,c_common_init_options最后确认要编译的语言,并初始化相关的数据结构。这个函数最终将确认的语言返回。 c_common_init_options (continue) 210 cpp_opts = cpp_get_options (parse_in);211 cpp_opts
2010-03-24 11:37:00 895
原创 Studying note of GCC-3.4.6 source (19 cont)
Field op_stack in cpp_reader aims to handle multiple-include optimization (using #if !defined and #endif to enclose #include directive), it will holds the tokens of the #if or #elseif expression.
2010-03-23 12:07:00 849
原创 Studying note of GCC-3.4.6 source (19)
3.2.1. Create cpp_readerAt line 205 above, cpp_create_reader tries to create a cpp_reader object. For language requires preprocessor like C and C++, usually compiler should provide a pass to preproc
2010-03-23 12:04:00 1024
原创 GCC-3.4.6源代码学习笔记(19续)
cpp_reader中的域op_stack用于多次包含优化(multiple-include optimization,即将#include指示加入#if !defined和#endif对中),它将缓存#if或#elseif表达式的符号。 cpp_create_reader (continue) 199 /* The expression parser stack. */
2010-03-23 11:55:00 1361
原创 GCC-3.4.6源代码学习笔记(19)
3.2.1. 创建cpp_reader在上面的205行,cpp_create_reader尝试创建一个cpp_reader对象。对于象C,C++这样需要预处理机制的语言,一般来说,编译器需要提供一个预处理遍,对源程序进行预处理操作。而当前版本的GCC,应用cpp_reader对象,实现了在线的预处理展开,不再需要预处理遍。因为这个目的,cpp_reader的定义也变得相当复杂。在以后有关词
2010-03-23 11:47:00 1931
原创 Studying note of GCC-3.4.6 source (18)
3. Preparation According to Parsing Options3.1. Hooks for LangaugesBack to toplev_main, as we mentioned before, it’s appreciate that front-end can make new language introducation easy. In G
2010-03-22 12:00:00 788
原创 GCC-3.4.6源代码学习笔记(18)
3. 对命令行选项的处理3.1. 为语言准备的钩子回到toplev_main,就像我们以前提到过的,前端最好能设计成使新语言的引入变得容易。在GCC中,前端为语言提供了一个框架,在这个框架中,所有语言相关的处理都被定义为回调(callback),而且这些回调被捆绑至以下的结构中。 212 struct lang_hooks
2010-03-22 11:58:00 1124
原创 Modultils工具源码分析之insmod篇 (8)
回到INSMOD_MAIN。 1691 check_module_parameters(f, &persist_parms);1692 1693 if (optind 1694 if (!process_module_arguments(f, argc - optind, a
2010-03-19 12:01:00 1081
原创 Studying note of GCC-3.4.6 source (17)
2.4. Initialize Optimization ParametersBack to general_init, at line 4264 add_params saves elements of lang_independent_params into compiler_params which contains the compiler parameters and their c
2010-03-19 11:48:00 665
原创 GCC-3.4.6源代码学习笔记(17)
2.4. 初始化优化参数回到general_init,4264行的add_params把数组lang_independent_params的内容存入数组compiler_params。compiler_params保存编译器的参数及当前值。lang_independent_params由params.def以如下方式展开得到。 1022 static const param_info
2010-03-19 11:44:00 1317
原创 Studying note of GCC-3.4.6 source (16)
2.3. Initialize Registers setsNext, after init_ttree, general_init invokes init_reg_sets.For most machines, certain registers have special usage. For example, in x86 machine, esp always holds the
2010-03-18 15:34:00 923
原创 GCC-3.4.6源代码学习笔记(16)
2.3. 初始化寄存器集接下来,跟着init_ttree,general_init调用init_reg_sets。对于大多数机器,某些寄存器具有特殊的用途。例如,在x86机器上,esp总是保存栈顶的地址,它不能用于传递函数参数。而在函数调用过程中,根据特定的惯例,其他一些寄存器需要被保存及恢复;而其他则不需要。显然这些都是与机器有关的。这里init_reg_sets收集芯片系列的通用信
2010-03-18 15:17:00 1384
原创 Studying note of GCC-3.4.6 source (15)
2.2.3.1.5.2.2.6. FIELD_DECL of RECORD_TYPEWe have known that FIELD_DECL is used to represent a non-static data member, and the detail is given in following FIELD_DECL[2]² These nod
2010-03-17 11:50:00 1044
原创 GCC-3.4.6源代码学习笔记(15)
2.2.3.1.5.2.2.6. RECORD_TYPE中的FIELD_DECL上面已经提到FIELD_DECL用于表示非静态成员,具体的描述如下:FIELD_DECL[2]² 这些节点表示类的非静态成员。其DECL_SIZE和DECL_ALIGN的行为与VAR_DECL节点的相同。而DECL_FIELD_BITPOS给出了该域使用的第一个比特,它是一个IN
2010-03-17 11:43:00 1969
原创 Studying note of GCC-3.4.6 source (14)
2.2.3.1.5.2.2.5. Layout of UNIONAbove line 854, rli->t is tree node of the type to be laid out., amd comes at here, field must be a FIELD_DECL. If rli->t is not a RECORD_TYPE, in C++, it must
2010-03-16 12:02:00 845
原创 GCC-3.4.6源代码学习笔记(14)
2.2.3.1.5.2.2.5. UNION的布局在上面854行,rli->t是正在被布局的类的树节点,能到这里,field一定是一个FIELD_DECL。如果rli->t不是一个RECORD_TYPE,在C++里,它一定是一个代表union的节点。它有和class及struct不同的布局方案。 778 static void779 place_union
2010-03-16 11:32:00 1289
原创 Modultils工具源码分析之insmod篇 (7)
回到INSMOD_MAIN函数。 1638 /* Version correspondence? */1639 k_version = get_kernel_version(k_strversion);1640 m_version = get_module_version(f, m_strversio
2010-03-12 11:29:00 1023
原创 Studying note of GCC-3.4.6 source (13)
2.2.3.1.5. Information of aggregate type 2.2.3.1.5.1. Overview[2]A class type is represented by either a RECORD_TYPE or a UNION_TYPE. A class declared with the union tag is represe
2010-03-10 12:14:00 821
原创 GCC-3.4.6源代码学习笔记(13)
2.2.3.1.5. 聚集类型的信息2.2.3.1.5.1. 概览[2]一个类类型由一个RECORD_TYPE节点或者UNION_TYPE节点来表示。声明为union 的类由UNION_TYPE来表示,而声明为struct或者class的类由RECORD_TYPE来表示。你可以使用宏CLASSTYPE_DECLARED_CLASS来辨别特定的类是class还是str
2010-03-10 12:08:00 1266
原创 Studying note of GCC-3.4.6 source (12)
2.2. Initialize hashtable for typeAfter initializing hashtable for identifier, general_init invokes init_ttree to initialize the hashtable for type. 116 void117 init_ttree (void)
2010-03-09 11:58:00 609
原创 GCC-3.4.6源代码学习笔记(12)
2.2. 类型哈希表的初始化完成标识符哈希表的初始化后,general_init调用init_ttree来初始化类型哈希表。 116 void117 init_ttree (void) i
2010-03-09 11:54:00 1040
原创 Studying note of GCC-3.4.6 source (11)
2. Compiler initializationThis core begins in the main function in file main.c at YOUR-GCC-SOURCE-DIR/gcc directory. This function does nothing but calls toplev_main. 4684 int4685 tople
2010-03-08 13:00:00 877
原创 GCC-3.4.6源代码学习笔记(11)
2. 编译器的初始化编译器的核心始于YOUR-GCC-SOURCE-DIR/gcc目录下,文件main.c中的main函数。该函数立即调用函数toplev_main。 4684 int4685 toplev_main (unsigned int argc, const char **argv) i
2010-03-08 12:56:00 1847
原创 Studying note of GCC-3.4.6 source (10 cont4)
1.6.3.1.1.2. Get the resultIn the rest of int_const_binop, the operation result which now are saved in low and hi, will be combined into a tree object with corresponding fields set. Below notru
2010-03-05 13:12:00 741
原创 Studying note of GCC-3.4.6 source (10 cont3)
1.6.1.1.1.1.4. Addition and minusThen for other operation, back in int_const_binop. int_const_binop (continue) 1239 case PLUS_EXPR:1240 overflow = add_double (int1l,
2010-03-05 13:03:00 1600
原创 Studying note of GCC-3.4.6 source (10 cont2)
1.6.3.1.1.1.2. Right shiftFor the right shift, it is similar handling. Again, paramter ll is the lower part of the number being shifted, and hl is the high part, while count is the bits
2010-03-05 13:01:00 692
原创 Studying note of GCC-3.4.6 source (10 cont1)
1.6.3. Create node for array typeWhen invoking build_array_type, the second parameter index_type should be node of index created in previous sector. 3790 tree3791 build_array_type (tree elt_ty
2010-03-05 12:55:00 741
原创 GCC-3.4.6源代码学习笔记(10续4)
1.6.3.1.1.2. 获取结果而在int_const_binop的余下部分,计算结果已经存放在low和hi中,这个结果将被合成为相应的树节点对象并检查溢出情况。下面的notrunc如果非零,表明不做值截取,而overflow则记录了计算过程中是否发生溢出,no_overflow如果非零,表明计算不会导致溢出。 int_const_binop (continue) 1331
2010-03-05 12:51:00 879
原创 GCC-3.4.6源代码学习笔记(10续3)
1.6.3.1.1.1.4. 加法和减法回到int_const_binop,接下来的操作是加法和减法。 int_const_binop (continue) 1239 case PLUS_EXPR:1240 overflow = add_double (int1l, int1h, int2l, int2h, &low, &hi)
2010-03-05 12:39:00 1122
原创 GCC-3.4.6源代码学习笔记(10续2)
1.6.3.1.1.1.2. 右移右移的操作是类似的。同样在下面的函数中,参数ll是被移位数的低位部分,而hl是高位部分,count则是要移动的位数,必须为正数,计算结果存放在lv和hv中,arith非零指明是进行算术右移,否则为逻辑右移。 428 void429 rshift_double (unsigned HOST_WIDE_INT l1, HO
2010-03-05 12:34:00 1002
原创 GCC-3.4.6源代码学习笔记(10续1)
1.6.3. 创建数组类型节点当调用build_array_type时,第二个参数index_type应该是由上一节所创建的索引节点。注意C++中没有函数数组类型,因为C++函数拥有常量地址。 3790 tree3791 build_array_type (tree elt_type, tree index_type)
2010-03-05 12:08:00 1007
原创 Current content index of Study node of Gcc-3.4.6 source
>> Accessdirectory of the back end at here ReferencePreparation before going aheadSoftware architecture of GCCThe front end1. Overview 1.1. Tree representation infront-ends1.1.1. Tree nodedefinition
2010-03-05 10:44:00 1319 5
Introduction to Theory of Computation
2018-09-23
Survey on Instruction Selection
2018-09-23
Towards a Compilation infrastructure for network processors
2018-09-23
Crafting a Compiler
2018-09-01
How Debuggers Work
2018-09-01
Compiler Construction-20th
2018-09-01
Compiler Construction-19th
2018-09-01
Compiler Construction-17th
2018-09-01
Compiler Construction-16th
2018-09-01
Compiler Construction-5th
2018-09-01
Construction and Evolution of Code Generator
2018-09-01
Compiler Construction-11th
2018-09-01
The compiler design handbook
2018-09-01
Data_Flow_Analysis_Theory_And_Practice(Bookos.org)
2018-09-01
The Compiler Design Handbook Optimizations and machine code generation
2018-09-01
instruction scheduling for instruction level parallel processor
2018-07-16
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人