This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/3] SH-2A FDPIC: New pattern: use_initial_val
On 08/19/2010 11:55 AM, Bernd Schmidt wrote:
> AFAIR no code is output for it. If that's not true, then that at least
> needs to be revisited. Does the splitting code handle the case where we
> return no insn at all?
Yes. Lots of other ports do that regularly.
I think the correct fix is
(define_insn_and_split "use_initial_val"
[(unspec [(match_operand 0 "pseudo_register_operand" "r")] UNSPEC_INITVAL)]
""
"#"
"reload_completed"
[(const_int 0)])
+ { DONE; })
Otherwise you'll split to (const_int 0), which is defined elsewhere
as the "nop" pattern. You can't elide the [] block from the split
pattern though; you have to have something there.
>> What advantage does this unspec have over a (USE reg) insn?
>
> I wasn't certain a USE wouldn't just get deleted, now or in the future,
> if it was the only remaining use of a pseudo.
I'm pretty sure they get deleted during/after reload, but they
hang around until then.
> I don't have the build trees anymore, and I don't recall all the details
> - but I think it was generating a reference to a symbol, which required
> the PIC register. I believe it was __fpscr_values - see emit_fpu_switch
> in sh.c.
That does seem like a likely candidate. Which means that the new use
can occur from essentially any random FP insn. I agree that you'd not
want to annotate each and every one of those.
I wonder if a better solution might be to enhance df_get_exit_block_use_set
to keep your pseudo alive for the entire function? We currently have
EPILOGUE_USES, but that's limited to hard registers. I wonder if the
macro could be replaced by a hook that, instead of returning true for
any specific regno, sets bits in a bitset.
You'd want to have the hook disable the forced use sometime just reload,
presumably, in order to let the pseudo die properly. I don't know enough
about the current state of the transition to df-scan to know if you'd
need to rebuild REG_DEAD notes before reload, or what.
r~