首页 > 代码库 > gcc源代码分析,finish_decl ()函数和push_parm_decl ()函数分析

gcc源代码分析,finish_decl ()函数和push_parm_decl ()函数分析

parms:
    parm
        { push_parm_decl ($1); }

/* This is what appears inside the parens in a function declarator.
   Is value is represented in the format that grokdeclarator expects.  */
parmlist_2:  /* empty */
        { $$ = get_parm_info (0); }
    | parms
        { $$ = get_parm_info (1); }
    | parms ‘,‘ ELLIPSIS
        { $$ = get_parm_info (0); }


ELLIPSIS 表示...

/* Given a parsed parameter declaration,

   decode it into a PARM_DECL and push that on the current binding level.  */

void
push_parm_decl (parm)
     tree parm;
{
  register tree decl = grokdeclarator (TREE_VALUE (parm), TREE_PURPOSE (parm),
                       PARM, 0);

  /* Add this decl to the current binding level.  */
  finish_decl (pushdecl (decl), NULL_TREE, NULL_TREE);
}

<tree_list 95680表示push_parm_decl ()函数的参数。

 <parm_decl 941c0表示grokdeclarator ()函数的返回结果。


in push_parm_decl
 <tree_list 95680 permanent
    purpose <tree_list 95650 permanent
        value <identifier_node 82038 char permanent global <type_decl 82650 char>
        chain <tree_list 95638 permanent
            value <identifier_node 82210 const permanent chain <tree_list 95638>
    value <indirect_ref 95668 permanent
in build_pointer_type
 <integer_type 91130 char readonly permanent QI
    size <integer_cst 82638 type <integer_type 82848* unsigned int> literal permanent 1
    align 8 size_unit 8 sep_unit 8 symtab 0
    sep <integer_cst 82608 type <integer_type 825bc* char> literal permanent -128 precision 8 min <integer_cst 82608 -128>
    max <integer_cst 82620 type <integer_type 825bc* char> literal permanent 127
    pointer_to_this <pointer_type 9117c>
 <parm_decl 941c0
    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>
    unsigned SI file /usr/include/stdio.h line 214 size <integer_cst 8254c 4>
    align 32 size_unit 8 offset 0 arguments <pointer_type 9117c>
in finish_decl
 <parm_decl 941c0
    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>
    unsigned SI file /usr/include/stdio.h line 214 size <integer_cst 8254c 4>
    align 32 size_unit 8 offset 0 arguments <pointer_type 9117c>


gcc源代码分析,finish_decl ()函数和push_parm_decl ()函数分析