Mark Mitchell wrote: > David Daney wrote: > > >> void >> __clear_cache (char *beg, char *end) >> { >> if (__builtin_clear_cache_inline_p()) >> __builtin___clear_cache (beg, end); >> else >> { >> #ifdef CLEAR_INSN_CACHE >> CLEAR_INSN_CACHE (beg, end); >> #endif /* CLEAR_INSN_CACHE */ >> } >> } >> >> No changes to any existing CLEAR_INSN_CACHE definitions are needed. >> There is a new target hook that determines the value of >> __builtin_clear_cache_inline_p(). >> > > I think that's a little bit overly complicated. Since the target has to > do something anyhow, to indicate that we should call the builtin here, > we might as well just have the target define CLEAR_INSN_CACHE that way. > > My two cents, > Ok, I think I have come around to your way of thinking. I still have the new predicate __builtin_clear_cache_inline_p() for use in target CLEAR_INSN_CACHE definitions, but I leave __clear_cache unchanged. Here is a new version of the target independent portion of the patch. Thanks to Mark, Paolo, and Richard for their input. Currently bootstrapping/testing on x86_64-unknown-linux-gnu, mipsel-unknown-linux-gnu (--with-arch=[mips32|mips32r2]). OK to commit? 2007-07-04 David Daney * builtins.def (BUILT_IN_CLEAR_CACHE): New builtin. (BUILT_IN_CLEAR_CACHE_INLINE_P): Same. * builtins.c (expand_builtin_clear_cache): New function. (expand_builtin): Call expand_builtin_clear_cache for BUILT_IN_CLEAR_CACHE case. Call gcc_unreachable() for BUILT_IN_CLEAR_CACHE_INLINE_P case. (fold_builtin_clear_cache_inline_p): New function. (fold_builtin_0): Call fold_builtin_clear_cache_inline_p for BUILT_IN_CLEAR_CACHE_INLINE_P case. * target.h (struct gcc_target): Add new member builtin_clear_cache_inline_p. * target-def.h (TARGET_BUILTIN_CLEAR_CACHE_INLINE_P): New target hooks initializer. (TARGET_INITIALIZER): Add TARGET_BUILTIN_CLEAR_CACHE_INLINE_P. * doc/extend.texi (__builtin___clear_cache): Document new builtin. (__builtin_clear_cache_inline_p): Same. * doc/tm.texi (TARGET_BUILTIN_CLEAR_CACHE_INLINE_P): Document new target hook. * testsuite/gcc.dg/builtins-64.c: New test. * testsuite/gcc.dg/builtins-65.c: New test.