首页 > 代码库 > gcc源代码分析,expand_call()函数第三部分

gcc源代码分析,expand_call()函数第三部分

(insn_list 6 (nil))

(insn_list 2 (insn_list 6 (nil)))

(sequence[ ] )

(reg:SI 0)

(const_int 4)

这次是解释这5条rtx的产生过程

 

相关的代码片段:


/* Mark all register-parms as living through the call.  */

  start_sequence ();
  for (i = 0; i < num_actuals; i++)
    if (args[i].reg != 0)
      {
    if (args[i].partial > 0)
      use_regs (REGNO (args[i].reg), args[i].partial);
    else if (GET_MODE (args[i].reg) == BLKmode)
      use_regs (REGNO (args[i].reg),
            ((int_size_in_bytes (TREE_TYPE (args[i].tree_value))
              + UNITS_PER_WORD - 1)
             / UNITS_PER_WORD));
    else
      emit_insn (gen_rtx (USE, VOIDmode, args[i].reg));
      }

  if (structure_value_addr && ! structure_value_addr_parm
      && GET_CODE (struct_value_rtx) == REG)
    emit_insn (gen_rtx (USE, VOIDmode, struct_value_rtx));

  use_insns = gen_sequence ();
  end_sequence ();

  /* Figure out the register where the value, if any, will come back.  */
  valreg = 0;
  if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
      && ! structure_value_addr)
    {
      if (pcc_struct_value)
    valreg = hard_libcall_value (Pmode);
      else
    valreg = hard_function_value (TREE_TYPE (exp), fndecl);
    }

  /* Generate the actual call instruction.  */
  /* This also has the effect of turning off any pop-inhibition
     done in expand_call.  */
  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);


下面是加了fprintf()的调试结果

before start_sequence

(insn_list 6 (nil))

(insn_list 2 (insn_list 6 (nil)))
after start_sequence
after for if
before gen_sequence

(sequence[ ] )
after end_sequence
before hard

(reg:SI 0)
hard_funtion_value

(const_int 4)
emit_call_1 funexp symbol_ref


逐一说明:

(insn_list 6 (nil))

(insn_list 2 (insn_list 6 (nil)))


和  start_sequence ();有关。


(sequence[ ] )和

  use_insns = gen_sequence ();

有关。


(reg:SI 0)和    valreg = hard_function_value (TREE_TYPE (exp), fndecl);  有关。


(const_int 4) 和函数  emit_call_1 ()有关


gcc源代码分析,expand_call()函数第三部分