[llvm-commits] [llvm] r81655 - /llvm/trunk/lib/System/Memory.cpp

Daniel Dunbar daniel at zuster.org
Sat Sep 12 16:29:02 PDT 2009


Author: ddunbar
Date: Sat Sep 12 18:29:02 2009
New Revision: 81655

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

Modified:
    llvm/trunk/lib/System/Memory.cpp

Modified: llvm/trunk/lib/System/Memory.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Memory.cpp?rev=81655&r1=81654&r2=81655&view=diff

==============================================================================
--- llvm/trunk/lib/System/Memory.cpp (original)
+++ llvm/trunk/lib/System/Memory.cpp Sat Sep 12 18:29:02 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-commits mailing list