GCC source code Analysis, add the Debug_tree () function at the beginning of the Expand_call () function and the expand_expr_stmt () function

Source: Internet
Author: User

The main parameter for the Expand_call function is the exp tree,

After printing it, we finally saw printf and hello,world! .

Expand_call

<call_expr 840f0
Type <integer_type 824d0 int permanent SI
Size &LT;INTEGER_CST 8254c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Sep <integer_cst 8251c literal permanent-2147483648 precision min <integer_cst 8251c-2147483648>
Max &LT;INTEGER_CST 82534 literal permanent 2147483647
Pointer_to_this <pointer_type 88b4c> chain <integer_type 825bc* char>
Volatile
Arg 0 <addr_expr 84090
Type <pointer_type 98f48 type <function_type 956e8>
Permanent unsigned SI size &LT;INTEGER_CST 8254c 4>
Align Size_unit 8 sep_unit symtab 0

Arg 0 <function_decl 95740printfType <function_type 956e8>
External public permanent used QI file/usr/include/stdio.h line 214
Align 1 Size_unit 1 offset 0 chain <function_decl 954d8 ungetc>
Arg 1 <tree_list 83270
Value <nop_expr 840d8 type <pointer_type 9117c>
Literal
Arg 0 <nop_expr 840c0 type <pointer_type 88a44>
Literal
Arg 0 <addr_expr 840a8 type <pointer_type 94f58>
Literal
Arg 0 <string_cst 84014 type <array_type 94ef4>
static literal "Hello, world!.
"(nil)


The following is the result of adding the Debug_tree () function at the beginning of the function

Expand_expr_stmt
<call_expr 840f0
Type <integer_type 824d0 int permanent SI
Size &LT;INTEGER_CST 8254c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Sep <integer_cst 8251c literal permanent-2147483648 precision min <integer_cst 8251c-2147483648>
Max &LT;INTEGER_CST 82534 literal permanent 2147483647
Pointer_to_this <pointer_type 88b4c> chain <integer_type 825bc* char>
Volatile
Arg 0 <addr_expr 84090
Type <pointer_type 98f48 type <function_type 956e8>
Permanent unsigned SI size &LT;INTEGER_CST 8254c 4>
Align Size_unit 8 sep_unit symtab 0

Arg 0 <function_decl 95740 printf type <function_type 956e8>
External public permanent used QI file/usr/include/stdio.h line 214
Align 1 Size_unit 1 offset 0 chain <function_decl 954d8 ungetc>
Arg 1 <tree_list 83270
Value <nop_expr 840d8 type <pointer_type 9117c>
Literal
Arg 0 <nop_expr 840c0 type <pointer_type 88a44>
Literal
Arg 0 <addr_expr 840a8 type <pointer_type 94f58>
Literal
Arg 0 <string_cst 84014 type <array_type 94ef4>
static literal "Hello, world!
"(nil)


The definition of stmt in the C-PARSE.TAB.C file has a call to Expand_expr_stmt (), and the call relationship is finally clear!

stmt:
      compstmt    {}
    | expr '; '
        {emit_line_note (Input_filename, Lineno);
         /* Do default conversion if safe and possibly important,
   &nbs p;         in case within ({...}).   */
          if ((Tree_code (tree_type) = = Array_type
               && lvalue_p ($)
               | | Tree_code (Tree_type ($)) = = Function_type)
            $ = default_ conversion ($);
          expand_expr_stmt ($);
          clear_momentary ();}

GCC source code Analysis, add the Debug_tree () function at the beginning of the Expand_call () function and the expand_expr_stmt () function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.