PATCH: invoke target hook when setting cfun

Sandra Loosemore sandra@codesourcery.com
Mon Aug 27 20:01:00 GMT 2007


This is the second of three parts of the changes necessary to support 
switching between mips16 and non-mips16 code generation on a 
per-function basis.  It replaces the previous version that used a hook 
invoked from prepare_function_start, because we realized that tree-level 
optimizations needed to know about target-specific details (like optab 
contents) as well.

I changed some places to use push_cfun/pop_cfun when it was obvious that 
was what they really wanted to do, but otherwise didn't try to do a 
general clean-up or reworking of the protocol for when cfun is set.  I'm 
suspecting that some of the places where cfun is set to null are not 
really necessary, but the dependencies are hard to follow here.  It 
seemed like I saw at least one place that was testing whether cfun was 
null to determine whether some phase of processing was completed rather 
than the context of the code it was processing.  :-P  It would also be 
better to make allocate_struct_function completely initialize the new 
object before setting cfun to it and invoking the new target hook, but 
that seemed like a big can of worms as well; there are non-obvious 
dependencies on having cfun already set in the initialization functions 
it calls.  I settled for just calling the hook as the very last thing it 
does.  In short, I feel like this is a bit of a kludge, but most of the 
kludginess was already present in gcc, and at least this does what it 
needs to do in terms of providing a hook for invoking the back end reset 
function.

The patch has been bootstrapped and tested on i686 as well as on MIPS.

Comments, flames, etc?

-Sandra

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 29a-cfun-hook.log
Type: text/x-log
Size: 2310 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070827/1006254d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 29a-cfun-hook.patch
Type: text/x-patch
Size: 31508 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070827/1006254d/attachment-0001.bin>


More information about the Gcc-patches mailing list