This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/38570] 'GCC/THUMB generates sub-optimal prolog/epilog



------- Comment #4 from daniel dot sherwood at sepura dot com  2008-12-18 17:22 -------
Following comment received from Richard.Earnshaw@arm.com by e-mail.

======

Hmm, yes, I think this is happening because the body of the function contains
branch instructions.  The Thumb branch instructions have quite limited range,
and in the worst case the compiler needs to use the BL instruction (which of
course, will destroy the contents of r14).
Unfortunately, it's nearly impossible to say exactly when it will be necessary
to fall back to this method, so all branches are assumed to do so.  It's
relatively unusual to find leaf functions that have branches but do not need to
stack any other registers (non-leaf functions have to save r14 anyway), but
you've managed to find a couple.

R.

[I've just had a quick look at the sources.  There appears to be code in there
that is supposed to deal with this case, but it clearly contains broken
assumptions (fortunately, the broken assumptions essentially mean that we
always get correct, though at times sub-optimal, code).]


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38570


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]