- 博客(32)
- 资源 (22)
- 收藏
- 关注
原创 Studying note of GCC-3.4.6 source (169)
<br /><br />5.13.5.2.2.1.1.2. Select output section<br />After finding out or creating the constant descriptor, next in output_constant_definvokes below function to try to output this constant in memory.<br /> <br />2509static void<br />2510maybe_outp
2011-02-26 15:52:00 593
原创 GCC-3.4.6源代码学习笔记(169)
<br /><br />5.13.5.2.2.1.1.2. 确定输出节<br />找到或准备好了常量描述符之后,接着在output_constant_def中调用下面的函数,尝试在内存中输出这个常量。<br /> <br />2509static void<br />2510maybe_output_constant_def_contents (struct constant_descriptor_tree*desc, in varasm.c<br />2511
2011-02-26 15:50:00 1226
原创 Studying note of GCC-3.4.6 source (168)
<br />5.13.5.2.2.1. The initializer<br />Here on our target Linux/x86, the output file would be of formatELF. ELF is the format supports relocatable and PIC (position independentcode). Chapter 3 of [10] gives a good description about ELF. As summeray
2011-02-26 15:48:00 1396 2
原创 GCC-3.4.6源代码学习笔记(168)
<br />5.13.5.2.2.1. 初始值<br />这里在我们的目标Linux/x86,输出文件将具有格式ELF。ELF是支持重定位及PIC(位置无关代码)的格式。【10】的第三章给出了关于ELF的一个很好的解释。从【10】的总结中,我们得到:<br />ELF文件有3种稍有不同的风格的形式:可重定位(relocatable),可执行(executable)及共享对象。可重定位文件由编译器及汇编器创建,但在运行前需要链接器的处理。可执行文件已完成所有的重定位及确定了所有的符号,除了在运行时确定的共
2011-02-26 15:45:00 1726
原创 Studying note of GCC-3.4.6 source (167)
<br />5.13.5.2. Output assemble for pending variables<br />Return finish_file, we have seen that flag_unit_at_a_timeis set at level above ‘-O2’.This flag also can be set by option -funit-at-a-time which described in [6] asbelow:<br />
2011-02-26 15:36:00 815
原创 GCC-3.4.6源代码学习笔记(167)
<br />5.13.5.2. 为待定变量发布汇编<br />回到finish_file,我们已经看到flag_unit_at_a_time在‘-O2’以上优化级别中设置为1。这个标记也可以由选项-funit-at-a-time来设定,【6】对其描述如下:<br />在开始产生代码之前,解析整个编译单元。这允许进行某些额外的优化,不过会消耗更多内存(总体而言)。使用unit-at-a-time模式有一些兼容性问题:<br /> 使能unit-at-a-
2011-02-26 15:34:00 1437
原创 Studying note of GCC-3.4.6 source (166)
<br />5.13.5.1.3. Preparealias set<br />However, the entry point for creating alias set is get_alias_setbelow. Both node of type and node of declaration can claim for alias analysis,but declaration’s alias set is determined by the alias set o
2011-02-19 11:58:00 750
原创 GCC-3.4.6源代码学习笔记(166)
<br />5.13.5.1.3. 准备别名集<br />构建别名集的入口是下面的get_alias_set。类型节点及声明节点可以要求别名分析,不过声明的别名集由其底层类型的别名集确定。在467行的条件选出声明的节点。在C++前端,475行的钩子get_alias_set指向cxx_get_alias_set。这个函数主要处理类型定义节点,我们暂时不管这个函数。<br /> <br />449 HOST_WIDE_INT<br />450 get_alias_set (tree t)
2011-02-19 11:56:00 1427
原创 Studying note of GCC-3.4.6 source (165)
<br />5.13.5. Code analysis and optimization5.13.5.1. Preliminaries- alias set analysis5.13.5.1.1. Conceptof alias set<br />In wikipedia, there is agood explaination of alias set given below.<br />Alias analysis is a techni
2011-02-19 11:54:00 789
原创 GCC-3.4.6源代码学习笔记(165)
<br />5.13.5. 代码分析及优化5.13.5.1. 预备知识- 别名集分析5.13.5.1.1. 别名集概念<br />在维基百科(wikipedia)中,给出了如下的别名集的一个很好的解释。<br />别名分析是在编译器理论中的一个技术,用于确定一个存储位置是否可能以多个方式访问。两个指针通常被认为别名,如果它们指向同一个位置。<br />别名分析技术通常分为流-敏感(flow-sensitivity)及上下文-敏感(context-se
2011-02-19 11:53:00 1521
原创 Studying note of GCC-3.4.6 source (164)
<br />5.13.4.7.1.3. Buildnodes for the function call<br />Return from build_function_call, coerced_params at line 2494 holdsthe converted arguments. If the function invoked is builtin funciton, thebuiltin functions can be expanded here and no n
2011-02-19 11:51:00 804
原创 GCC-3.4.6源代码学习笔记(164)
5.13.4.7.1.3. 为函数调用构建节点从build_function_call返回,在2494行的coerced_params保存了转换后的实参。如果被调用的函数是内建函数,这个内建函数可以在这里被展开,因为没有函数可以调用,不需要创建CALL_EXPR节点。3716 tree3717 expand_tree_builtin (tree function, tree params, tree coerced_params) in c-common.c3718 {3719
2011-02-19 11:49:00 911
原创 Studying note of GCC-3.4.6 source (163)
<br />5.13.4.7.1.2. Doappropriate conversion for arguments<br />In this section, we go a little deeper to see in detail how to matchthe argument with the parameter, and do necessary conversion appropriately.<br />In C++ front-end, function parameters
2011-02-19 11:47:00 783
原创 GCC-3.4.6源代码学习笔记(163)
<br />5.13.4.7.1.2. 为实参执行适合的转换<br />在这一节中,我们要深入一些来看一下如何把实参匹配形参,并执行必须的转换。<br />在C++前端中,函数形参被记录在FUNCTION_TYPE的TYPE_ARG_TYPES域中,它是一个tree_list类型的串,其节点中的TREE_VALUE是对应形参的类型;TREE_PURPOSE是缺省实参值的一个表达式,如果有的话。如果在该链表中最后的节点是void_list_node(一个TREE_LIST节点,其中的TREE_VALUE是
2011-02-19 11:46:00 1123
原创 Studying note of GCC-3.4.6 source (162 - continue)
<br /><br />At line 5350 current_class_ptr is the PARM_DECL for the `this'pointer, when we're processing a member function. See that in below only the typeof instancecan be known for sure it returns non-null. Compared with condition at line5281,
2011-02-19 11:44:00 708
原创 GCC-3.4.6源代码学习笔记(162-续)
<br /><br />在5350行,当我们正在处理一个成员函数时,current_class_ptr是用于‘this’指针的PARM_DECL。看到在下面,仅当instance的类型是可以明确知道的情形,才返回非空值。与5281行的条件相比,5281行的条件表示一个指针,而在C++里,它可以是该类层次中不同的类型,以提供多态。因此作为结果,它返回NULL_TREE。<br /> <br />5275 static tree<br />5276 fixed_type_or_null (tree in
2011-02-19 11:36:00 1028
原创 Studying note of GCC-3.4.6 source (162)
<br />5.13.4.7.1. Generatingcode for function invocation5.13.4.7.1.1. Buildexpression to take function’s address<br />Now, we begin a new long offshoot away from our main route. When wewrite code like: f (a, b); to call function f, the co
2011-02-19 11:32:00 788
原创 GCC-3.4.6源代码学习笔记(162)
5.13.4.7.1. 为函数调用产生代码5.13.4.7.1.1. 构建获取函数地址的表达式<br />当我们写出类似:f (a, b);的代码来调用f,编译器需要努力使得这个调用以期望的方式可行。下面的函数泄露了编译器的所作所为。<br /> <br />2420 tree<br />2421 build_function_call (tree function, treeparams) i
2011-02-19 11:28:00 1220
原创 Studying note of GCC-3.4.6 source (161)
<br />5.13.4.7. Generate code for invoking initializer functionaccording to priority<br />If iteration taken by code between line 2573 to 2800 turns outstable – that is nothing new is generated or in other words all objectsexplicitly or
2011-02-13 17:27:00 795
原创 GCC-3.4.6源代码学习笔记(161)
<br />5.13.4.7. 发布代码根据优先级调用初始化函数<br />如果由代码2573至2800行执行的迭代稳定了下来——即不再产生新的东西,或者换句话说,所有显式或隐式涉及的对象都已经处理了,就可以继续完成机器代码分别这个目标。<br /> <br />finish_file (continue)<br /> <br />2801 /* All used inlinefunctions must have a definition at this point.
2011-02-13 17:26:00 1205
原创 GCC-3.4.6源代码学习笔记(160)
<br />5.13.4.5. 迭代 – 处理名字空间中的全局对象<br />前面我们已经为需要构造函数及析构函数的全局或静态对象准备、注册好了初始化函数及退出函数。这一次的迭代检查是否还有没有处理的全局对象,并处理之。函数walk_namespaces从上至下以前序访问名字空间树。<br /> <br />848 int<br />849 walk_namespaces (walk_namespaces_fn f,void* data)
2011-02-11 08:11:00 953
原创 Studying note of GCC-3.4.6 source (160)
<br />5.13.4.5. Iterate – handling globals in namespaces<br />Before, we have prepared and registered initialize and exittingfunction for global or static objects having constructor or destructor. In thisiteration, it checks if there is a
2011-02-11 08:11:00 668
原创 Studying note of GCC-3.4.6 source (159)
<br />5.13.4.4. Iterate – emitting code for deferred function<br />Function generated by the compiler (via implicitly_declare_fn, mark_decl_instantiated,or build_clone)or inline method is cached in deferred_fns. Arriving here, we
2011-02-11 08:09:00 627
原创 GCC-3.4.6源代码学习笔记(159)
<br />5.13.4.4. 迭代– 为延迟函数发布代码<br />由编译器产生的函数(经由implicitly_declare_fn,mark_decl_instantiated或build_clone)或内联函数缓存在deferred_fns中。因为到这里,我们已经完成了整个源文件的代码解析,处理这些延迟函数的信息都应该齐备了。<br />首先,对于由编译器自己产生的“人造”函数,其设置了标记DECL_ARTIFICIAL;并且FUNCTION_DECL节点,其DE
2011-02-11 08:07:00 832
原创 Studying note of GCC-3.4.6 source (158)
<br />5.13.4.3. Iterate – emitting code for ctor/dtor of globalaggregate<br />Next in the DO WHILEloop, at line 2651 static_aggregates is a list that holds aggregateshaving constructor or destructor and reside in the global scope. As
2011-02-11 08:05:00 1395
原创 GCC-3.4.6源代码学习笔记(158)
5.13.4.3. 迭代 – 发布全局聚集类的构造函数/析构函数<br />接着在这个DO WHILE循环中,在2651行static_aggregates是一个链表,它包含了在全局绑定域中具有构造函数或析构函数的聚集类。正如我们已经看过,编译器需要确保在进入“main”函数之前,所有全局变量必须已经分配了内存及被初始化。5.13.4.3.1. 修整需要初始化的变量<br />因此在2651行,prune_vars_needing_no_initializ
2011-02-11 08:03:00 2209
原创 Studying note of GCC-3.4.6 source (157)
<br />5.13.4.2. Iterate - emitting tinfo<br />Now all tinfos need code emitted have been chained into unemitted_tinfo_decls,then in finish_fileat line 2628, emit_tinfo_decldetermines whether the tinfo of decl needs be emitted, retur
2011-02-11 08:01:00 591
原创 GCC-3.4.6源代码学习笔记(157)
<br />5.13.4.2. 迭代– 发布tinfo<br />现在所有需要代码发布的tinfo已经被串入unemitted_tinfo_decls中。接着在finish_file的2628行,emit_tinfo_decl确定decl的tinfo是否需要发布,如果需要,则返回true。下面,看到之前在finish_file的2571行调用的emit_support_tinfos中,doing_runtime被设为1。<br />那么在调用class_initializ
2011-02-11 07:57:00 987
原创 Studying note of GCC-3.4.6 source (156)
<br />5.13.3. Generate tinfo for fundamental types<br />After outputting PCH file if required, back in finish_file to continue thestruggle of assemble emitting. Next, the compiler should prepare tinfo for thefundamental types. <br /> <br />finis
2011-02-02 09:48:00 928
原创 GCC-3.4.6源代码学习笔记(156)
<br />5.13.3. 为基本类型产生tinfo<br />操持完PCH文件,回到finish_file中继续为汇编代码的生成而奋斗。接下来编译器将为基本类型准备tinfo。<br /> <br />finish_file (continue)<br /> <br />2546 /* Otherwise, GDBcan get confused, because in only knows<br />2547 about source for LINENO-1l
2011-02-02 09:45:00 1484
原创 Studying note of GCC-3.4.6 source (155)
<br />5.13.2. Output PCH file<br />Seeing something related to conversion, resumes our example inafter-parsing stage. Return from expand_or_defer_fn we are back cp_parser_function_definition_after_declaratorwhich returns the FUNCTION_DECL immedi
2011-02-02 09:36:00 908
原创 GCC-3.4.6源代码学习笔记(155)
<br />5.13.2. 输出PCH文件<br />看过了转换相关的内容后,回到我们例子的解析后的阶段,从expand_or_defer_fn返回,我们回到cp_parser_function_definition_after_declarator,并立即返回FUNCTION_DECL,这个FUNCTION_DECL为cp_parser_function_definition_from_specifiers_and_declarator返回,然后cp_parser_init_declarator
2011-02-02 09:33:00 1161
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关注的人