]> granicus.if.org Git - clang/commitdiff
Implement __clear_cache on ARM.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 7 Jun 2010 17:26:50 +0000 (17:26 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 7 Jun 2010 17:26:50 +0000 (17:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105537 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/BuiltinsARM.def
lib/CodeGen/CGBuiltin.cpp

index ea50f6ce53ced6e62c3397ef63e2065229fc2924..4a8b9ac965d4a9ea3858ec56185e26eebaa2ffdf 100644 (file)
@@ -14,6 +14,9 @@
 
 // The format of this database matches clang/Basic/Builtins.def.
 
+// In libgcc
+BUILTIN(__clear_cache, "vc*c*", "")
+
 // FIXME: This is just a placeholder. NEON intrinsics should be listed here.
 BUILTIN(__builtin_thread_pointer, "v*", "")
 
index ae61c046d93f9b723b78d8d9cb5e3d4c181d5e59..409829687a06b69c85aa2302730138b4ce042972 100644 (file)
@@ -923,10 +923,15 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
   
   switch (BuiltinID) {
   default: return 0;
-
-  case ARM::BI__builtin_thread_pointer: {
-    Value *AtomF = CGM.getIntrinsic(Intrinsic::arm_thread_pointer, 0, 0);
-    return Builder.CreateCall(AtomF);
+  case ARM::BI__clear_cache: {
+    const FunctionDecl *FD = E->getDirectCallee();
+    Value *a = EmitScalarExpr(E->getArg(0));
+    Value *b = EmitScalarExpr(E->getArg(1));
+    const llvm::Type *Ty = CGM.getTypes().ConvertType(FD->getType());
+    const llvm::FunctionType *FTy = cast<llvm::FunctionType>(Ty);
+    llvm::StringRef Name = FD->getName();
+    return Builder.CreateCall2(CGM.CreateRuntimeFunction(FTy, Name),
+                               a, b);
   }
   // FIXME: bitcast args, return.
   case ARM::BI__builtin_neon_vaba_v: