GCC source code Analysis, Expand_call () function Part IV, EMIT_CALL_1 () function

Source: Internet
Author: User

This article is to explain how the following 4 Rtx are produced, and the Emit_call_1 () function.


(Const_int 4)

(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)))

The following is the debug result after adding the fprintf () function.


(Const_int 4)
Emit_call_1 Funexp Symbol_ref
Before EMIT_CALL_INSN

(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
After Emit_call_inst
After Emit_call_1
End Expand_call

The relevant code in the Expand_call () function:


if (Args_size.constant < 0)
args_size.constant = 0;
Emit_call_1 (Funexp, Funtype, Args_size.constant,
Function_arg (Args_so_far, Voidmode, Void_type_node, 1),
Valreg, Old_inhibit_defer_pop, Use_insns);

/* ??? Nothing have been done here to record control flow
When the contained functions can do nonlocal gotos. */




static void
Emit_call_1 (funexp, Funtype, Stack_size, Next_arg_reg, Valreg, Old_inhibit_defer_pop, Use_insns )
     rtx funexp;
     Tree Funtype;
     int stack_size;
     rtx Next_arg_reg;
     rtx Valreg;
     int old_inhibit_defer_pop;
     rtx Use_insns;
{
  rtx stack_size_rtx = gen_rtx (Const_int, Voidmode, stack_size);
  RTX CALL_INSN;

  if (valreg)
    emit_call_insn (Gen_call_value (Valreg,
                     gen_rtx (MEM, Function_mode, Funexp),
                     Stack_size_rtx, Next_arg_reg));


The Gen_call_value () function is in the insn-emit.c file and

(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)))

These 2 RTX related.

Rtx

Gen_call_value (Operand0, Operand1, Operand2)
RTX operand0;
RTX Operand1;
RTX Operand2;
{
ReturnGen_rtx(SET, Voidmode, Operand0,Gen_rtx(Call, Voidmode, Operand1, Operand2));
}

GCC source code Analysis, Expand_call () function Part IV, EMIT_CALL_1 () function

Related Article

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.