GCC source code Analysis, Expand_call () function and printf ("Hello, world!\n");

Source: Internet
Author: User

The Expand_call () function is in the expr.c file.

The following is the main debug result of the Expand_call () function, recorded.

The Debug_tree () function and the Debug_rtx () function are mainly added.

The Debug_tree () function joins the beginning of the expand_expr () function.

The Debug_rtx () function is added at the end of the Gen_rtx () function.

The Emit_call_1 () function is also visible when it is called. EMIT_CALL_INSN () is also visible when it is called.

The main purpose of debugging is how does the Expand_call () function generate RTX?

is both how to call the Gen_rtx () function and where to call it?

Of course only for the hello.c file:

printf ("Hello, world!\n");

This function is called to parse.


call_expr

Expand_call
expand_expr Code = 71
<nop_expr 830d8
Type <pointer_type 9017c
Type <integer_type 90130 char readonly permanent QI
Size &LT;INTEGER_CST 81638 literal permanent 1
Align 8 Size_unit 8 Sep_unit 8 Symtab 0
Sep <integer_cst 81608 literal permanent-128 precision 8 min <integer_cst 81608-128>
Max &LT;INTEGER_CST 81620 literal permanent 127
Pointer_to_this <pointer_type 9017c>
Permanent unsigned SI
Size &LT;INTEGER_CST 8154c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Chain <function_type 902c0>
Literal
Arg 0 <nop_expr 830c0
Type <pointer_type 87a44 type <integer_type 815BC char>
Permanent unsigned SI size &LT;INTEGER_CST 8154c 4>
Align Size_unit 8 sep_unit symtab 0
Chain <array_type 87a90>
Literal
Arg 0 <addr_expr 830a8 type <pointer_type 93f58>
Literal
Arg 0 <string_cst 83014 type <array_type 93ef4>
static literal "Hello, world!
"
expand_expr Code = 71
<nop_expr 830c0
Type <pointer_type 87a44
Type <integer_type 815BC Char permanent QI
Size &LT;INTEGER_CST 81638 literal permanent 1
Align 8 Size_unit 8 Sep_unit 8 Symtab 0
Sep <integer_cst 81608 literal permanent-128 precision 8 min <integer_cst 81608-128>
Max &LT;INTEGER_CST 81620 literal permanent 127
Pointer_to_this <pointer_type 87a44> chain <integer_type 816a8 Long int>
Permanent unsigned SI
Size &LT;INTEGER_CST 8154c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Chain <array_type 87a90>
Literal
Arg 0 <addr_expr 830a8
Type <pointer_type 93f58 type <array_type 93ef4>
unsigned SI size &LT;INTEGER_CST 8154c 4>
Align Size_unit 8 sep_unit symtab 0
Literal
Arg 0 <string_cst 83014 type <array_type 93ef4>
static literal "Hello, world!
"
expand_expr Code = 74
<addr_expr 830a8
Type <pointer_type 93f58
Type <array_type 93EF4 type <integer_type 815BC char>
BLK
Size &LT;INTEGER_CST 93f40 literal 15
Align 8 Size_unit 8 Sep_unit 8 Symtab 0
Sep <integer_cst 81638 literal permanent 1 domain <integer_type 93ea8>
Pointer_to_this <pointer_type 93f58> chain <pointer_type 93f58>
unsigned SI
Size &LT;INTEGER_CST 8154c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Literal
Arg 0 <string_cst 83014 type <array_type 93ef4>
static literal "Hello, world!
"
expand_expr Code = 26
&LT;STRING_CST 83014
Type <array_type 93EF4
Type <integer_type 815BC Char permanent QI
Size &LT;INTEGER_CST 81638 literal permanent 1
Align 8 Size_unit 8 Sep_unit 8 Symtab 0
Sep <integer_cst 81608 literal permanent-128 precision 8 min <integer_cst 81608-128>
Max &LT;INTEGER_CST 81620 literal permanent 127
Pointer_to_this <pointer_type 87a44> chain <integer_type 816a8 Long int>
BLK
Size &LT;INTEGER_CST 93f40 literal 15
Align 8 Size_unit 8 Sep_unit 8 symtab 0 Sep <integer_cst 81638 1>
Domain <integer_type 93ea8 SI
Size &LT;INTEGER_CST 8154c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Sep <integer_cst 83048 literal 0 precision min <integer_cst 83048 0>
Max &LT;INTEGER_CST 83078 literal 14
Pointer_to_this <pointer_type 93f58> chain <pointer_type 93f58>
static literal "Hello, world!
"
Output_constant_def

(Symbol_ref:si ("*lc0"))

(Mem:blk (Symbol_ref:si ("*lc0")))
This
addr_expr
Force_operand 27
End addr_expr

(Pre_dec:si (reg:si 7))

(Mem:si (Pre_dec:si (reg:si 7)))

(Set (Mem:si (Pre_dec:si (reg:si 7)))
(Symbol_ref:si ("*lc0")))

(Insn_list 6 (nil))

(Insn_list 2 (insn_list 6 (nil)))

(sequence[])

(Reg:si 0)

(Const_int 4)
Emit_call_1 Funexp Symbol_ref

(Mem:qi (Symbol_ref/v:si ("printf")))

(Call (Mem:qi (Symbol_ref/v:si ("printf")))
(Const_int 4))

(Set (Reg:si 0)
(Call (Mem:qi (Symbol_ref/v:si ("printf")))
(Const_int 4)))
Emit_call_insn
End Expand_call
C_expand_return

GCC source code Analysis, Expand_call () function and printf ("Hello, world!\n");

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.