- 博客(38)
- 资源 (22)
- 收藏
- 关注
原创 Studying note of GCC-3.4.6 source (70)
4.3.4.Finish compiler’s initialization<br />Back lang_dependent_init, it is happy to see the end of the function. The initialization of the compiler will be finished soon.<br /> <br />lang_dependent_init (continue)<br /> <br />4542 /* The following initia
2010-07-30 10:03:00 593
原创 GCC-3.4.6源代码学习笔记(70)
4.3.4.完成编译器初始化<br />回到lang_dependent_init,终于看到函数的结尾了,编译器的初始化马上就要完成了。<br /> <br />lang_dependent_init (continue)<br /> <br />4542 /* The following initialization functions need to generate rtl, so<br />4543 provide a dummy function context for them. */
2010-07-30 10:00:00 935
原创 Studying note of GCC-3.4.6 source (69)
4.3.3.Initialize libray calls table<br />Machine description file gives out the way to construct instructions of RTL form for certain operation. For instruction emition, compiler tries to open coded RTL code (if something is open-coded, there is no actual
2010-07-30 09:48:00 1133
原创 Studying note of GCC-3.4.6 source (68)
4.3.2.Construct exception context<br />Comes back from cxx_init, below init_asm_output prepares the file for outputting assemble code.<br /> <br />lang_dependent_init (continue)<br /> <br />4535 init_asm_output (name);<br />4536<br />4537 /* These create
2010-07-30 09:44:00 800
原创 GCC-3.4.6源代码学习笔记(69)
4.3.3.初始化库函数调用表<br />机器描述文件给出了一个途径把特定的操作构建为RTL形式。对于指令生成,编译器尝试打开已编码的RTL代码(如果是开放编码的(open-coded),没有进行真正的函数调用,只是在同等代码的展开;而封闭编码的(close-coded)则导致函数的调用。在编译器界(compiler circles),短语“开放编码”(open coded)的含义甚至更为宽泛。例如,某些机器具有花哨的指令来完成某些计算中的几步,比如计算多项式的POLY指令,或使用数组下标的INDEX指令(
2010-07-30 09:22:00 1500
原创 GCC-3.4.6源代码学习笔记(68)
4.3.2.构建异常上下文<br />从cxx_init返回,在下面的lang_dependent_init中,init_asm_output为输出汇编代码准备好了文件。<br /> <br />lang_dependent_init (continue)<br /> <br />4535 init_asm_output (name);<br />4536<br />4537 /* These create various _DECL nodes, so need to be called after t
2010-07-30 09:15:00 1595
原创 Studying note of GCC-3.4.6 source (67)
4.3.1.7.8.3. Exception handler<br />Next, if we don’t prohibit exception via switch -fno-exception, C++ runtime will setup the functions’ declaration excepted by exception handling. In C++, if throw an exception but not catch it, then in global namesp
2010-07-28 11:33:00 1017
原创 Studying note of GCC-3.4.6 source (66)
<br />4.3.1.7.8.2.3.2. Post-processing of type_info<br />4.3.1.7.8.2.3.2.1. Install type_info for fundamental types<br />The front-end invokes function finish_file to close it work, and generate RTL code tree for the back-end. The function also con
2010-07-28 11:26:00 882
原创 Studying note of GCC-3.4.6 source (65)
<br />4.3.1.7.8.2.2. Generate nodes of type_info definition<br />Below it will construct these type_info type series. First is the base class.<br /> <br />1251 static void<br />1252 create_tinfo_types (void)
2010-07-28 11:10:00 794
原创 Studying note of GCC-3.4.6 source (64)
4.3.1.7.8. Finish initialization<br />Below abort_fndecl represents function abort, and function build_library_fn_ptr like build_library_fn, but takes a C string instead of an IDENTIFIER_NODE.<br /> <br />cxx_init_decl_processing (continue)<br /
2010-07-28 11:05:00 1120
原创 GCC-3.4.6源代码学习笔记(67)
4.3.1.7.8.3. 异常处理句柄<br />接下来,如果我们没有通过-fno-exception禁止异常机制,C++运行时将为我们建立起异常处理所用的函数声明。在C++中,当抛出一个异常但程序没有捕捉它,那么在全局名字空间,运行时将会捕捉它,并调用std::terminate()来终止程序。这整个功能由定义在文件gcc-3.4.6/libstdc++-v3/libstdsupc++/eh_personality.cc中的运行时函数__cxa_call_unexpected来提供。<br />而在解析
2010-07-28 10:48:00 1965
原创 GCC-3.4.6源代码学习笔记(66)
<br />4.3.1.7.8.2.3.2. type_info的后处理<br />4.3.1.7.8.2.3.2.1. 安装基本类型type_info对象<br />前端调用函数finish_file最后完成其工作,并为后端产生RTL形式的代码树。也在这个函数中,逐个为unemitted_tinfo_decls中保存的待后处理的伪type_info,构建真正的对象。不过在创建工作之前,首先要安装基本类型的type_info对象如下。<br /> <br />1353 void<
2010-07-28 10:33:00 1106
原创 GCC-3.4.6源代码学习笔记(65)
<br />4.3.1.7.8.2.2. 构建type_info的定义<br />下面就是构建这个type_info类型系列。首先是基类。<br /> <br />1251 static void<br />1252 create_tinfo_types (void) in rtti.c<br />1253 {
2010-07-28 10:15:00 1490
原创 GCC-3.4.6源代码学习笔记(64)
<br />4.3.1.7.8. 完成初始化<br />下面的abort_fndecl代表函数abort,而函数build_library_fn_ptr与build_library_fn相仿,不过它接受字符串作为名字,而不是标识符节点。<br /> <br />cxx_init_decl_processing(continue)<br /> <br />3115 abort_fndecl<br />3116 = build_library_fn_p
2010-07-28 09:58:00 1295
原创 Studying note of GCC-3.4.6 source (63)
<br />4.3.1.7.7. C++components with C++ linkage4.3.1.7.7.1. bad_alloc<br />current_lang_name indicates the language of the program, now itis updated to the identifier of C++ language. It determines the linkage ofidentifiers. For exa
2010-07-23 11:43:00 691
原创 GCC-3.4.6源代码学习笔记(63)
<br />4.3.1.7.7. 具有C++链接性的C++语言成分4.3.1.7.7.1. bad_alloc<br />current_lang_name表示程序所用的语言,现在它被更新为表示C++语言的标识符。它确定了标识符的链接性。例如,C++的标识符需要其名字被修饰,而C的标识符是不需要的。<br /> <br />cxx_init_decl_processing(continue)<br /> <br />3080 /* Now, C++.
2010-07-23 11:39:00 996
原创 Studying note of GCC-3.4.6 source (62)
4.3.1.7.6. Other C++ components with C linkage4.3.1.7.6.1. Part complying standard<br />Walk tegother with c_common_nodes_and_builtins for a long journey, now we return back to cxx_init_decl_processing. Note that current_lang_name is still
2010-07-23 11:27:00 560
原创 GCC-3.4.6源代码学习笔记(62)
4.3.1.7.6. 其它具有C链接性的C++语言成分4.3.1.7.6.1. 标准部分<br />和c_common_nodes_and_builtins走过一长段路程后,我们回到cxx_init_decl_processing。注意current_lang_name仍然是lang_name_c,表明下面构建的节点仍然是C链接性的。3002~3009的类型节点用于C++和Java之间的接口(即,extern “Java” …)。<br /> <br />cxx_init_d
2010-07-23 11:23:00 893
原创 Studying note of GCC-3.4.6 source (61)
<br />4.3.1.7.5.6.5.2. Handle attribute of format<br />For function of printf, scanf etc type, the real checking could be done only at site of invocation. In its declaraction, few checking can be taken as handle_format_attribute does. Now the argume
2010-07-16 11:00:00 979
原创 Studying note of GCC-3.4.6 source (60)
<br />4.3.1.7.5.6.5. Processing attributes of builtin<br />4.3.1.7.5.6.5.1. Install attribute handlers<br />Though we create nodes for attributes of builtin functions, we still don’t install them into the builtin function. And even ther
2010-07-16 10:54:00 1014
原创 Studying note of GCC-3.4.6 source (59)
4.3.1.7.5.6. Create nodes of builtin functions<br />4.3.1.7.5.6.1. Overview<br />Now it is time to build node of builtin functions. Similarly, we need define a macro to generate the code from a defining file – builtins.def this time.<br /
2010-07-16 10:47:00 824
原创 GCC-3.4.6源代码学习笔记(61)
<br />4.3.1.7.5.6.5.2. 处理format属性<br />对于printf,scanf等类型的函数,真正的检查要在调用处进行。在其声明中,只进行少许检查,由handle_format_attribute执行。现在参数args是节点ATTR_PRINTF_1_0,而传入的no_add_attrs是0。<br /> <br />2741 tree<br />2742 handle_format_attribute (tree *node, tree name ATTRI
2010-07-16 10:38:00 1543
原创 GCC-3.4.6源代码学习笔记(60)
<br />4.3.1.7.5.6.5. 处理内建函数的属性<br />4.3.1.7.5.6.5.1. 建立属性处理方法<br />虽然我们已经为内建函数的属性创建了节点,我们还未将它们加入到内建函数的节点中。而且即使没有属性,我们也需要在函数节点中明确地表示出来。<br /> <br />builtin_function_1 (continue)<br /> <br />3253 /* Possibly apply some default attribu
2010-07-16 10:05:00 1686
原创 GCC-3.4.6源代码学习笔记(59)
4.3.1.7.5.6. 创建内建函数节点<br />4.3.1.7.5.6.1. 概览<br />现在是时候创建内建函数的节点了。同样的,这次我们仍然需要定义一个宏,从定义文件– builtins.def 来产生代码。<br /> <br />c_common_nodes_and_builtins (continue)<br /> <br />3431 #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE,
2010-07-16 09:57:00 1535
原创 Studying note of GCC-3.4.6 source (58)
4.3.1.7.5.4. Nodes of builtin function types<br />From here below, we will meet FUNCTION_DECL and FUNCTION_TYPE here and there. As we know, in C, a function is associated with a type. For example, int a (int A); and int b (int B), both functions are o
2010-07-14 10:26:00 742
原创 GCC-3.4.6源代码学习笔记(58)
4.3.1.7.5.4. 内建函数类型节点<br />从这里开始,我们将多次看到FUNCTION_DECL及FUNCTION_TYPE。正如我们所了解的,在C/C++中,函数具有类型。例如,“int a (int A);”及“int b (int B);”,这2个函数具有相同的类型(它们都可以被指针类型“int(*)(int)”所指向)。但它们是同一类型的2个不同的声明,它们的行为可以完全相异。你可以说类型有点类似接口,而声明则有些像接口下不同的实现。<br />在后面,我们将看到一些属性可以应用
2010-07-14 10:17:00 1200
原创 Studying note of GCC-3.4.6 source (57)
4.3.1.7.5.3. Nodes of other builtin types<br />Next part of c_common_nodes_and_builtins is given below:<br /> <br />c_common_nodes_and_builtins (continue)<br /> <br />3177 build_common_tree_nodes_2 (flag_short_double);<br />3178 <br />3179 r
2010-07-13 09:16:00 1010
原创 Studying note of GCC-3.4.6 source (56)
4.3.1.7.5. Create nodes of builtins<br />GCC offers a facility name builtin functions. They just act as functions from library we usually used in coding. In fact you can use these builtins in you program as library function, and you even needn’t
2010-07-13 09:13:00 958
原创 GCC-3.4.6源代码学习笔记(57)
4.3.1.7.5.3. 其他内建类型节点<br />c_common_nodes_and_builtins接下来的代码如下:<br /> <br />c_common_nodes_and_builtins (continue)<br /> <br />3177 build_common_tree_nodes_2 (flag_short_double);<br />3178 <br />3179 record_builtin_type (RID_FLOAT, NULL, flo
2010-07-13 09:08:00 1303
原创 GCC-3.4.6源代码学习笔记(56)
4.3.1.7.5. 内建对象的节点<br />GCC提供了一个称为内建函数的设施。它们的行为与我们编程时用到的库函数类似。事实上你可以你的程序中象使用库函数那样使用这些内建函数,你甚至不需要包含任何头文件。<br />显然,这些函数不会是,我们从头文件看到的,那种函数声明的形式。它们不能出现在任何头文件中。这些函数在GCC内部得到处理,它们必须是rtx的形式。某些函数只是表明了期望的操作,在展开后它们将被代码片段所替代(例如著名的,在linux代码中常见的builtin_const)
2010-07-13 09:05:00 1461 1
原创 Studying note of GCC-3.4.6 source (55)
4.3.1.7.4. Create namespace “std”4.3.1.7.4.1. Add in global namespace<br />“std” namespace is part of the standaer. And this namespace is also part of the C++ runtime environment, for example, the exception mechanism, runtime type informati
2010-07-08 14:44:00 873
原创 GCC-3.4.6源代码学习笔记(55)
4.3.1.7.4. 创建std名字空间4.3.1.7.4.1. 加入全局名字空间<br />std名字空间是C++标准的一部分。这一名字空间亦是C++的运行时环境的一部分,例如:异常机制、运行时类型识别、标准库等都出自此处。因此,接下来就要创建std名字空间并将其加入全局名字空间。这里std_identifier是std名字空间的全局唯一标识符,它在initialize_predefined_identifiers中已被创建。<br /> <br />cxx_init_de
2010-07-08 14:39:00 1140
原创 Studying note of GCC-3.4.6 source (54)
<br />4.3.1.7.3. BuildTree Node of Type Information<br />Then GCC will finialize the choiceof inlining functions to flag_inline_trees, and abandon others. For ptrmemfunc_vbit_in_pfnat line 2983, it is enum type ptrmemfunc_vbit_where_t
2010-07-08 14:34:00 707
原创 GCC-3.4.6源代码学习笔记(54)
<br />4.3.1.7.3. 类型信息树节点<br />回到cxx_init_decl_processing,接下来GCC将最终确定的内联函数的选项置入flag_inline_trees。2983行的ptrmemfunc_vbit_in_pfn是枚举类型ptrmemfunc_vbit_where_t。<br /> <br />2048 enumptrmemfunc_vbit_where_t
2010-07-08 14:32:00 955
原创 Studying note of GCC-3.4.6 source (53)
4.3.1.7.2.4. Entity for global namespaceThe identifier of global namespace is global_scope_name, and its front-end tree node has code N
2010-07-02 09:37:00 614
原创 Studying note of GCC-3.4.6 source (52)
4.3.1.7. Initialize for declaration processing<br />Declaration is important part of C++. It is function declaration, variable declaration, type declaration, namespace declaration, etc. gives C++ power and flexibility. In the C++ compiler, the initializ
2010-07-02 09:28:00 1009
原创 GCC-3.4.6源代码学习笔记(53)
4.3.1.7.2.4. 全局名字空间对象<br />全局名字空间的标识符是global_scope_name,其对应的树节点的编码是NAMESPACE_DECL,名字空间本身没有类型信息,是故下面的参数type为void_type_node。<br /> <br />687 tree<br />688 build_lang_decl (enum tree_code code, tree name, tree type) in l
2010-07-02 09:19:00 970
原创 GCC-3.4.6源代码学习笔记(52)
4.3.1.7. 初始化声明处理机制<br />声明是C++最重要的一部分。正是函数声明、类型声明、名字空间声明、变量声明等,构成了C++强大灵活的特性。C++编译器中这部分机制的初始化显得十分重要而复杂,这个机制还生成了语言运行时环境。<br /> <br />cxx_init (continue)<br /> <br />410 cxx_init_decl_processing ();<br /> <br />2942 void<br />2943 cxx_init_decl_process
2010-07-02 09:15:00 1272 1
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关注的人