function = build (ADDR_EXPR, build_pointer_type (TREE_TYPE (function)),
function);
继续分析上篇文章的这句。
/* Constructors for pointer, array and function types.
(RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE nodes are
constructed by language-dependent code, not here.) */
/* Construct, lay out and return the type of pointers to TO_TYPE.
If such a type has already been constructed, reuse it. */
tree
build_pointer_type (to_type)
tree to_type;
{
register tree t = TYPE_POINTER_TO (to_type);
/* 下面是debug_tree(to_type);的结果
<function_type 956e8
type <integer_type 824d0 int permanent SI
size <integer_cst 8254c literal permanent 4
align 32 size_unit 8 sep_unit 32 symtab 0
sep <integer_cst 8251c literal permanent -2147483648 precision 32 min <integer_cst 8251c -2147483648>
max <integer_cst 82534 literal permanent 2147483647
pointer_to_this <pointer_type 88b4c> chain <integer_type 825bc* char>
permanent EP
size <integer_cst 82dd8 type <integer_type 82848* unsigned int> literal permanent 8
align 32 size_unit 8 sep_unit 0 symtab 0
arg-types <tree_list 95698 permanent
value <pointer_type 9117c type <integer_type 91130* char>
permanent unsigned SI size <integer_cst 8254c 4>
align 32 size_unit 8 sep_unit 32 symtab 0
chain <function_type 912c0>
chain <function_type 959b0>
*/
register struct obstack *ambient_obstack = current_obstack;
register struct obstack *ambient_saveable_obstack = saveable_obstack;
/* First, if we already have a type for pointers to TO_TYPE, use it. */
if (t)
return t;
/* We need a new one. If TO_TYPE is permanent, make this permanent too. */
if (TREE_PERMANENT (to_type))
{
current_obstack = &permanent_obstack;
saveable_obstack = &permanent_obstack;
}
t = make_node (POINTER_TYPE);
/*下面是debug_tree(t);的结果
<pointer_type 98f48 permanent VOID
align 1 size_unit 1 sep_unit 0 symtab 0
*/
TREE_TYPE (t) = to_type;
/*下面是debug_tree(t);的结果
<pointer_type 98f48/*
<function_type 956e8
type <integer_type 824d0 int permanent SI
size <integer_cst 8254c literal permanent 4
align 32 size_unit 8 sep_unit 32 symtab 0
sep <integer_cst 8251c literal permanent -2147483648 precision 32 min <integer_cst 8251c -2147483648>
max <integer_cst 82534 literal permanent 2147483647
pointer_to_this <pointer_type 88b4c> chain <integer_type 825bc* char>
permanent EP
size <integer_cst 82dd8 type <integer_type 82848* unsigned int> literal permanent 8
align 32 size_unit 8 sep_unit 0 symtab 0
arg-types <tree_list 95698 permanent
value <pointer_type 9117c type <integer_type 91130* char>
permanent unsigned SI size <integer_cst 8254c 4>
align 32 size_unit 8 sep_unit 32 symtab 0
chain <function_type 912c0>
pointer_to_this <pointer_type 98f48> chain <function_type 959b0>
*/
<pointer_type 98f48
type <function_type 956e8
type <integer_type 824d0 int permanent SI
size <integer_cst 8254c literal permanent 4
align 32 size_unit 8 sep_unit 32 symtab 0
sep <integer_cst 8251c literal permanent -2147483648 precision 32 min <integer_cst 8251c -2147483648>
max <integer_cst 82534 literal permanent 2147483647
pointer_to_this <pointer_type 88b4c> chain <integer_type 825bc* char>
permanent EP
size <integer_cst 82dd8 literal permanent 8
align 32 size_unit 8 sep_unit 0 symtab 0
arg-types <tree_list 95698 permanent value <pointer_type 9117c>
pointer_to_this <pointer_type 98f48> chain <function_type 959b0>
permanent unsigned SI size <integer_cst 8254c 4>
align 32 size_unit 8 sep_unit 32 symtab 0
gcc源代码分析,build_pointer_type ()函数分析
原文地址:http://blog.csdn.net/oldlinux/article/details/42607771