On 6/1/25 1:12 AM, H.J. Lu wrote:
Move get_call_rtx_from to final.c and call call_from_call_insn.
PR other/120493
* final.cc (call_from_call_insn): Change the argument type to
const rtx_call_insn *.
(get_call_rtx_from): New.
* rtl.h (is_a_helper <const rtx_call_insn *>::test): New.
(get_call_rtx_from): Moved to the final.cc section.
* rtlanal.cc (get_call_rtx_from): Removed.
Tested on x86-64.
Note this did not preserve semantics, though ultimately I think the
problem is a specific to the c6x port and the old semantics were buggy
IMHO. I haven't dug deeply, but I suspect the old code returned
NULL_RTX for this because the call operand wasn't a MEM.
(call_insn/j:TI 11 27 12 2 (call (unspec [
(symbol_ref:SI ("foo") [flags 0x41] <function_decl 0x7ffff774e500
foo>)
] UNSPEC_JUMP_SHADOW)
(const_int 0 [0])) "j.c":6:3 90 {sibcall_shadow}
(expr_list:REG_DEAD (reg:SI 35 B3)
(expr_list:REG_DEAD (reg:SI 4 A4)
(expr_list:REG_CALL_ARG_LOCATION (expr_list:REG_DEP_TRUE (concat:SI
(reg:SI 4 A4)
(subreg:SI (entry_value:DI (reg:DI 4 A4)) 0))
(nil))
(expr_list:REG_CALL_DECL (symbol_ref:SI ("foo") [flags 0x41]
<function_decl 0x7ffff774e500 foo>)
(nil)))))
(expr_list (use (reg:SI 35 B3))
(expr_list:SI (use (reg:SI 4 A4))
(nil))))
That in turn causes something to go goofy later. I'm not chasing it as
I think the old code was just kind of bogus in this regard and with this
being specific to a dead port it doesn't seem worth my time.
jeff