https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58372

--- Comment #26 from Terry Guo <xuepeng.guo at intel dot com> ---
Hi Uroš:

I think I found why your proposed patch causes problem in Comment 23. It is all
about timing. The below code from patch is trying to set up DRAP reg in a
rather early stage when the function is not fully expanded to RTL.

+      if (crtl->drap_reg == NULL_RTX)
+       {
+         rtx drap_rtx = targetm.calls.get_drap_rtx ();

The targetm.calls.get_drap_rtx () will be hooked to ix86_get_drap_rtx () where
we will have code:

12046         drap_vreg = copy_to_reg (arg_ptr);
(gdb) 
12047         seq = get_insns ();
(gdb) 
12048         end_sequence ();
(gdb) 
12050         insn = emit_insn_before (seq, NEXT_INSN (entry_of_function ()));

At this stage, what returned from (entry_of_function ()) is actually GIMPLE
form of the function, not the RTL form we are expecting. Then NEXT_INSN
(something_in_gimple) goes wrong.

Reply via email to