How do I generate the following red 3 instructions?
and the Gen_push_operand () function and the EMIT_MOVE_INSN () function, all of them are called in the Expand_call () function.
Specific location:
RTX addr;
#ifdef push_rounding
if (args_addr = = 0)
addr = gen_push_operand ();
Else
#endif
if (Get_code (args_so_far) = = Const_int)
addr
= memory_address (mode,
plus_constant (args_addr, Intval (args_so (_far)));
Else
addr = memory_address (Mode, Gen_rtx (PLUS, Pmode, Args_ Addr,
Args_so_far));
emit_move_insn (Gen_rtx (MEM, mode, addr) , x);
}
(Mem:blk (Symbol_ref:si ("*lc0")))
(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")))
After adding fprintf
End addr_expr
Gen_push_operand
(Pre_dec:si (reg:si 7))
End Gen_push_operand
Before EMIT_MOVE_INSN
(Mem:si (Pre_dec:si (reg:si 7)))
Before return EMIT_INSN icode= 14
(Set (Mem:si (Pre_dec:si (reg:si 7)))
(Symbol_ref:si ("*lc0")))
Emit_insn
After EMIT_MOVE_INSN
Before prepare_call_address
The EMIT_MOVE_INSN () function is also in the Expr.c file
/* Generate code to copy Y into X.
Both Y and X must have the same mode, except that
Y can is a constant with Voidmode.
This mode cannot is blkmode; Use the Emit_block_move for.
Return the last instruction emitted. */
Rtx
EMIT_MOVE_INSN (x, y)
Rtx x, y;
{
Enum Machine_mode mode = Get_mode (x);
x = Protect_from_queue (x, 1);
y = protect_from_queue (y, 0);
if (mode = = Blkmode)
Abort ();
if (mov_optab->handlers[(int) Mode].insn_code! = code_for_nothing)
{
int icode = (int) mov_optab->handlers[(int) Mode].insn_code;
if (! (*insn_operand_predicate[icode][1]) (Y, Mode)
&& (constant_p (y) | | Get_code (y) = = const_double))
{
y = Force_const_mem (mode, y);
if (! memory_address_p (mode, xexp (y, 0)))
y = Gen_rtx (MEM, mode, memory_address (mode, xexp (y, 0)));
}
Return EMIT_INSN (GEN_FCN (Icode) (x, y));
}
...
Else
Abort ();
}
Definition of GEN_FCN (CODE) in the Expr.h file
#define GEN_FCN (Code) (*insn_gen_function[(int) (code))
The code here equals 14.
The definition of an array of insn_gen_function[] functions in a insn_output.c file
RTX (*const insn_gen_function[]) () =
{
Gen_tstsi,
Gen_tsthi,
GEN_TSTQI,
GEN_TSTSF,
GEN_TSTDF,
GEN_CMPSI,
Gen_cmphi,
GEN_CMPQI,
Gen_cmpdf,
GEN_CMPSF,
0,
0,
0,
0,
Gen_movsi,
The GEN_MOVSI () function is defined in the Insn-emit.c file
Rtx
GEN_MOVSI (Operand0, Operand1)
RTX operand0;
RTX Operand1;
{
Return Gen_rtx (SET, Voidmode, Operand0, OPERAND1);
}
Well explained (set (Mem:si (Pre_dec:si (reg:si 7)))
(Symbol_ref:si ("*lc0")))
The generation of the third instruction.
GCC Source Code Analysis Gen_push_operand () function and EMIT_MOVE_INSN () function