Force ret to be at the end of a function

Wei Qin weiqin@gmail.com
Fri Apr 6 13:55:00 GMT 2007


Thanks for the suggestion. But I wish to use the stock gcc so that other people
can repeat what I do.

Since no standard option works, I am thinking of other tricks.
Is it possible to add some "barrier" code at the end of a function so
that gcc will not
move any basic blocks after that? So that my real code is a
single-entry single-exit
region.

Weiqin



On 4/6/07, Andrew Haley <aph@redhat.com> wrote:
> Wei Qin writes:
>
>  > I notice that gcc sometimes places the "ret" instruction in the middle
>  > of a function, or sometimes emits multiple "ret" instructions for a
>  > function. For some reason, I wish that my gcc emits only one  "ret" at
>  > the end of a function. Is there a gcc switch to force that without
>  > disabling optimization?
>
> There is no standard option.  There are several passes that reorder
> basic blocks.  You'd have to find them all and disable them
> individually.
>
> Andrew.
>
> --
> Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
> Registered in England and Wales No. 3798903
>



More information about the Gcc-help mailing list