type <pointer_type 9117c
type <integer_type 91130 char readonly permanent QI
size <integer_cst 82638 literal permanent 1
align 8 size_unit 8 sep_unit 8 symtab 0
sep <integer_cst 82608 literal permanent -128 precision 8 min <integer_cst 82608 -128>
max <integer_cst 82620 literal permanent 127
pointer_to_this <pointer_type 9117c>
permanent unsigned SI
size <integer_cst 8254c literal permanent 4
align 32 size_unit 8 sep_unit 32 symtab 0
chain <function_type 912c0>
literal
arg 0 <nop_expr 840c0
type <pointer_type 88a44 type <integer_type 825bc char>
permanent unsigned SI size <integer_cst 8254c 4>
align 32 size_unit 8 sep_unit 32 symtab 0
chain <array_type 88a90>
literal
arg 0 <addr_expr 840a8 type <pointer_type 94f58>
literal
arg 0 <string_cst 84014 type <array_type 94ef4>
static literal "Hello, world!
"
/* Print the slot this node is in, and its code, and address. */
fprintf (file, "%s <%s %x", prefix,
tree_code_name[(int) TREE_CODE (node)], (int) node);
这段代码对应的输出,随便写一个:
<nop_expr 840d8
prefix 没有,为空字符串,tree_code_name[(int) TREE_CODE (node)]为nop_expr,
(int) node为节点的地址840d8
if (TREE_CODE (node) == INTEGER_CST)
{
if (indent <= 4)
print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
}
else
{
print_node (file, "type", TREE_TYPE (node), indent + 4);
if (TREE_TYPE (node))
indent_to (file, indent + 3);
}
这段代码是打印节点的类型,如果不是d不是t的话。
如果不是INTEGER_CST则会递归调用print_node()函数!比如
<nop_expr 840d8
type <pointer_type 9117c
紫色的是nop_expr类型是e又不是INTEGER_CST,所以会递归调用print_node()函数。
又比如
type <pointer_type 9117c
type <integer_type 91130 char readonly permanent QI
size <integer_cst 82638 literal permanent 1
align 8 size_unit 8 sep_unit 8 symtab 0
sep <integer_cst 82608 literal permanent -128 precision 8 min <integer_cst 82608 -128>
max <integer_cst 82620 literal permanent 127
pointer_to_this <pointer_type 9117c>
蓝色的是pointer_type类型是t。经过上面的if语句之后,到达我们这里的语句,
因为不是INTEGER_CST,所以会递归调用print_node()函数。
调用完之后呢?继续下面的语句,打印属性
permanent unsigned SI
size <integer_cst 8254c literal permanent 4
align 32 size_unit 8 sep_unit 32 symtab 0
chain <function_type 912c0>
又因为是t所以会执行下面的语句:
case 't':
mode = TYPE_MODE (node);
fprintf (file, " %s", mode_name[(int) mode]);
print_node (file, "size", TYPE_SIZE (node), indent + 4);
indent_to (file, indent + 3);
fprintf (file, " align %d", TYPE_ALIGN (node));
fprintf (file, " size_unit %d", TYPE_SIZE_UNIT (node));
fprintf (file, " sep_unit %d", TYPE_SEP_UNIT (node));
fprintf (file, " symtab %d", TYPE_SYMTAB_ADDRESS (node));
print_node (file, "sep", TYPE_SEP (node), indent + 4);
if (TREE_CODE (node) == ARRAY_TYPE || TREE_CODE (node) == SET_TYPE)
print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
else if (TREE_CODE (node) == INTEGER_TYPE)
{
fprintf (file, " precision %d", TYPE_PRECISION (node));
print_node (file, "min", TYPE_MIN_VALUE (node), indent + 4);
print_node (file, "max", TYPE_MAX_VALUE (node), indent + 4);
}
else if (TREE_CODE (node) == ENUMERAL_TYPE)
{
fprintf (file, " precision %d", TYPE_PRECISION (node));
print_node (file, "min", TYPE_MIN_VALUE (node), indent + 4);
print_node (file, "max", TYPE_MAX_VALUE (node), indent + 4);
print_node (file, "values", TYPE_VALUES (node));
}
else if (TREE_CODE (node) == REAL_TYPE)
fprintf (file, " precision %d", TYPE_PRECISION (node));
else if (TREE_CODE (node) == RECORD_TYPE || TREE_CODE (node) == UNION_TYPE)
print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
else if (TREE_CODE (node) == FUNCTION_TYPE || TREE_CODE (node) == METHOD_TYPE)
print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4);
if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
indent_to (file, indent + 3);
print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node), indent + 4);
print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node), indent + 4);
print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
break;