On Nov 13, 2014, at 9:21 AM, Jeff Law <l...@redhat.com> wrote:
> Presumably we can get the same kinds of problems with ports that don't emit 
> prologues/epilogues as RTL?

I use prologue/epilogue to emit rtl in my port.  I’d like this optimization to 
kick on in my port, as we do explain everything in rtl.

I do what 59 other ports do:

(define_expand "epilogue"
  [(clobber (const_int 0))]
  ""
  "                                                                             
                                                                                
  
  aarch64_expand_epilogue (false);                                              
                                                                                
  
  DONE;                                                                         
                                                                                
  
  “
)

this causes HAVE_prologue and HAVE_epilogue to be set.  We don’t want to just 
nix the optimization if HAVE_epilogue or HAVE_prologue is set.

This problem is unique to FUNCTION_PROFILER, the interface for it is fprintf 
(“call mount”).  This is what causes the problem.  If all those ports used 
PROFILE_HOOK instead (ia64.c for example), then I don’t think this would be an 
issue.  fprintf bad.  FUNCTION_PROFILER is only used when doing profiling.

We don’t support fprintf prologues anymore, they were removed years ago.

> I'm particularly concerned about cases where the prologue or epilogue might 
> use a call-clobbered register as a scratch that isn't used anywhere else in 
> the function.
> 
> ISTM this test out to be expanded to test HAVE_prologue and HAVE_epilogue as 
> well.

So, the solution to that is to look at the registers post prologue/epilogue 
expansion.  Then the rtl has all the bit in it.

Reply via email to