> On Aug 15, 2023, at 8:06 AM, Richard Biener via Gcc <gcc@gcc.gnu.org> wrote:
>
> On Tue, Aug 15, 2023 at 1:38 PM MegaIng via Gcc <gcc@gcc.gnu.org> wrote:
>> ...
>> And a bit more concrete with something I am having a hard time
>> debugging. I am getting errors `invalid_void`, seemingly triggered by an
>> absent of `gen_return` when compiling with anything higher than -O0. How
>> do I correctly provide an implementation for that? Or disable it's
>> usage? Our epilogue is non-trivial, and it doesn't look like the other
>> backends use something like `(define_insn "return" ...)`.
>
> Somebody else has to answer this.
Again using pdp11 as an example -- it doesn't define any of the *return
patterns either. Instead it has a define_expand "epilogue" which calls a
function to generate all the necessary elements, the last of which is a
machine-specific pattern that will produce the final return instruction.
This is using the RTL flavor of prologue/epilogue. At one point in the past
that target directly emitted the assembly code for those, which isn't the
recommended approach. I tried the RTL flavor and found it to be a better
answer, and it certainly works for all the optimization levels.
paul