[Patch] 1/3 Add new builtin __builtin_flush_icache().

Mark Mitchell mark@codesourcery.com
Tue Jul 3 23:55:00 GMT 2007


Paolo Bonzini wrote:
> 
>> 1) Rename the new builtin to __builtin_clear_cache (char *beg ,  char
>> *end), and have it call the function in libgcc if there is not an
>> inline expansion for it?
> 
> (And use libgcc's prototype).  This would be the cleanest.
> 
> This, plus, try to see how __clear_cache could use the definition of the
> builtin.

Paolo, I didn't quite follow your suggestion.  So, I'm not sure if I'm
agreeing or disagreeing. :-)

Anyhow, here's my suggestion.

1. The builtin should be:

  __builtin___clear_cache (char *beg, char *end)

following the standard convention that the builtin for X is __builtin_X.

2. The default implementation of the builtin should be to call
__clear_cache.  That means that users can call __builtin_clear_cache
from their code, on all platforms.

3. Targets which can do something clever can implement the builtin as
they please and can define CLEAR_INSN_CACHE(BEG, END) to expand to
__builtin_clear_cache(BEG, END).  On such targets, then, __clear_cache
in libgcc will call the builtin, which we can be assured will not
recursively expand to __clear_cache.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list