Pull in r183926 from LLVM trunk:

Allow clang to build __clear_cache on ARM.

  __clear_cache is special. It needs no signature, but is a real function in
  compiler_rt or libgcc.

  Patch by Andrew Turner.

This allows us to build the __clear_cache function in compiler-rt.
This commit is contained in:
Andrew Turner 2013-06-15 12:13:22 +00:00
parent e6124a8a1a
commit 1f4f127b99
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251790
5 changed files with 13 additions and 3 deletions

View File

@ -70,6 +70,8 @@
// f -> this is a libc/libm function without the '__builtin_' prefix. It can
// be followed by ':headername:' to state which header this function
// comes from.
// i -> this is a runtime library implemented function without the
// '__builtin_' prefix. It will be implemented in compiter-rt or libgcc.
// p:N: -> this is a printf-like function whose Nth argument is the format
// string.
// P:N: -> similar to the p:N: attribute, but the function is like vprintf

View File

@ -128,6 +128,13 @@ class Context {
return strchr(GetRecord(ID).Attributes, 'f') != 0;
}
/// \brief Determines whether this builtin is a predefined compiler-rt/libgcc
/// function, such as "__clear_cache", where we know the signature a
/// priori.
bool isPredefinedRuntimeFunction(unsigned ID) const {
return strchr(GetRecord(ID).Attributes, 'i') != 0;
}
/// \brief Determines whether this builtin has custom typechecking.
bool hasCustomTypechecking(unsigned ID) const {
return strchr(GetRecord(ID).Attributes, 't') != 0;

View File

@ -15,4 +15,4 @@
// The format of this database matches clang/Basic/Builtins.def.
// In libgcc
BUILTIN(__clear_cache, "vv*v*", "")
BUILTIN(__clear_cache, "vv*v*", "i")

View File

@ -15,7 +15,7 @@
// The format of this database matches clang/Basic/Builtins.def.
// In libgcc
BUILTIN(__clear_cache, "v.", "")
BUILTIN(__clear_cache, "v.", "i")
BUILTIN(__builtin_thread_pointer, "v*", "")
// Saturating arithmetic

View File

@ -8671,7 +8671,8 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) {
// Builtin functions cannot be defined.
if (unsigned BuiltinID = FD->getBuiltinID()) {
if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) {
if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID) &&
!Context.BuiltinInfo.isPredefinedRuntimeFunction(BuiltinID)) {
Diag(FD->getLocation(), diag::err_builtin_definition) << FD;
FD->setInvalidDecl();
}