This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

REG_CALL_DECL notes


Hi!

What is the reason for these notes?
I mean, for indirect calls usually the argument is NULL, so at least for
that case I'd say
(expr_list:REG_CALL_DECL (nil)
is just a waste of RTL memory, because nothing will really make use of it:

static tree
get_call_fndecl (rtx_insn *insn)
{
  rtx note, datum;

  note = find_reg_note (insn, REG_CALL_DECL, NULL_RTX);
  if (note == NULL_RTX)
    return NULL_TREE;

  datum = XEXP (note, 0);
  if (datum != NULL_RTX)
    return SYMBOL_REF_DECL (datum);

  return NULL_TREE;
}

will return the same thing whether ther is REG_CALL_DECL (nil) or no note at
all.
But even for normal calls, on most targets the decl is often embedded
already somewhere else in the call instruction:
(call_insn 6 5 7 2 (call (mem:QI (symbol_ref:DI ("exit") [flags 0x41] <function_decl 0x7fc30b495e58 __builtin_exit>) [0 __builtin_exit S1 A8])
        (const_int 0 [0])) mnau.c:1 -1
     (expr_list:REG_CALL_DECL (symbol_ref:DI ("exit") [flags 0x41] <function_decl 0x7fc30b495e58 __builtin_exit>)
So, why doesn't say get_call_fndecl use REG_CALL_DECL if present, otherwise
if flag_ipa_ra look up the CALL rtx in the instruction and look up the symbol_ref in its
MEM?
Then, what call.c could do is instead of:
          last = last_call_insn ();
          add_reg_note (last, REG_CALL_DECL, datum);
first call get_call_fndecl (last) and if that returns datum, don't add any
note.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]