On Fri, Oct 09, 2026 at 04:25:30PM +0200, Jakub Jelinek wrote: > Just emit it after entry_of_function () always. I don't see how the backend > function could be invoked before contruct_init_block.
It is, when parameter setup needs a libcall. In gcc.c-torture/execute/930603-1.c with -mips16 -mabicalls -fpic the K&R float parameter is converted with __mips16_truncdfsf2: mips16_gp_pseudo_reg ... convert_to_mode assign_parm_setup_reg assign_parms expand_function_start <- pass_expand::execute, before construct_init_block With only entry_of_function () that ICEs already at -O0, in emit_insn_after_1, because entry_of_function () then returns BB_HEAD of the first GIMPLE bb. Is there a better way to test for "before construct_init_block" than ENTRY_BLOCK_PTR_FOR_FN (cfun)->flags & BB_RTL? Julius Am Fr., 9. Okt. 2026 um 14:25 Uhr schrieb Jakub Jelinek <[email protected]>: > > On Fri, Oct 09, 2026 at 04:19:30PM +0200, Julius Bairaktaris wrote: > > @@ -3400,18 +3400,11 @@ mips16_gp_pseudo_reg (void) > > { > > if (cfun->machine->mips16_gp_pseudo_rtx == NULL_RTX) > > { > > - rtx_insn *scan; > > - > > cfun->machine->mips16_gp_pseudo_rtx = gen_reg_rtx (Pmode); > > > > - push_topmost_sequence (); > > - > > - scan = get_insns (); > > - while (NEXT_INSN (scan) && !INSN_P (NEXT_INSN (scan))) > > - scan = NEXT_INSN (scan); > > - > > + start_sequence (); > > rtx set = gen_load_const_gp (cfun->machine->mips16_gp_pseudo_rtx); > > - rtx_insn *insn = emit_insn_after (set, scan); > > + rtx_insn *insn = emit_insn (set); > > INSN_LOCATION (insn) = 0; > > /* NewABI support hasn't been implement. NewABI should generate RTL > > sequence instead of ASM sequence directly. */ > > @@ -3420,6 +3413,13 @@ mips16_gp_pseudo_reg (void) > > emit_clobber (MIPS16_PIC_TEMP); > > emit_clobber (MIPS_PROLOGUE_TEMP (Pmode)); > > } > > + rtx_insn *seq = end_sequence (); > > + > > + /* Until construct_init_block, the topmost sequence is just the > > + parameter setup, all of which goes into the init block. */ > > + push_topmost_sequence (); > > + emit_insn_after (seq, (ENTRY_BLOCK_PTR_FOR_FN (cfun)->flags & BB_RTL > > + ? entry_of_function () : get_insns ())); > > Just emit it after entry_of_function () always. I don't see how the backend > function could be invoked before contruct_init_block. > > Jakub >
