[llvm-branch-commits] [llvm-branch] r81697 - /llvm/branches/release_26/lib/System/Memory.cpp

Tanya Lattner tonic at nondot.org
Sun Sep 13 12:08:09 PDT 2009


Author: tbrethou
Date: Sun Sep 13 14:08:09 2009
New Revision: 81697

URL: http://llvm.org/viewvc/llvm-project?rev=81697&view=rev
Log:
Merge 81655 from mainline.
fix for PR4960.
 - Could we just always implement this as __clear_cache for __GNUC__?

Modified:
    llvm/branches/release_26/lib/System/Memory.cpp

Modified: llvm/branches/release_26/lib/System/Memory.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/lib/System/Memory.cpp?rev=81697&r1=81696&r2=81697&view=diff

==============================================================================
--- llvm/branches/release_26/lib/System/Memory.cpp (original)
+++ llvm/branches/release_26/lib/System/Memory.cpp Sun Sep 13 14:08:09 2009
@@ -37,13 +37,16 @@
   
 // icache invalidation for PPC and ARM.
 #if defined(__APPLE__)
-#if (defined(__POWERPC__) || defined (__ppc__) || \
+
+#  if (defined(__POWERPC__) || defined (__ppc__) || \
      defined(_POWER) || defined(_ARCH_PPC)) || defined(__arm__)
   sys_icache_invalidate(Addr, Len);
-#endif
+#  endif
+
 #else
-#if (defined(__POWERPC__) || defined (__ppc__) || \
-     defined(_POWER) || defined(_ARCH_PPC)) && defined(__GNUC__)
+
+#  if (defined(__POWERPC__) || defined (__ppc__) || \
+       defined(_POWER) || defined(_ARCH_PPC)) && defined(__GNUC__)
   const size_t LineSize = 32;
 
   const intptr_t Mask = ~(LineSize - 1);
@@ -57,6 +60,12 @@
   for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize)
     asm volatile("icbi 0, %0" : : "r"(Line));
   asm volatile("isync");
-#endif
+#  elif defined(__arm__) && defined(__GNUC__)
+  // FIXME: Can we safely always call this for __GNUC__ everywhere?
+  char *Start = (char*) Addr;
+  char *End = Start + Len;
+  __clear_cache(Start, End);
+#  endif
+
 #endif  // end apple
 }





More information about the llvm-branch-commits mailing list