[llvm] r211588 - [mips] Use __clear_cache builtin instead of cacheflush() in Unix Memory::InvalidateInstructionCache()

Daniel Sanders daniel.sanders at imgtec.com
Tue Jun 24 05:26:49 PDT 2014


Author: dsanders
Date: Tue Jun 24 07:26:49 2014
New Revision: 211588

URL: http://llvm.org/viewvc/llvm-project?rev=211588&view=rev
Log:
[mips] Use __clear_cache builtin instead of cacheflush() in Unix Memory::InvalidateInstructionCache()

MIPS64 Android bionic has removed cacheflush(). Use __clear_cache() instead for 32-bit and 64-bit MIPS

Patch by Duane Sand <Duane.Sand at imgtec.com>


Modified:
    llvm/trunk/lib/Support/Unix/Memory.inc

Modified: llvm/trunk/lib/Support/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Memory.inc?rev=211588&r1=211587&r2=211588&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Memory.inc (original)
+++ llvm/trunk/lib/Support/Unix/Memory.inc Tue Jun 24 07:26:49 2014
@@ -333,23 +333,15 @@ void Memory::InvalidateInstructionCache(
   for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize)
     asm volatile("icbi 0, %0" : : "r"(Line));
   asm volatile("isync");
-#  elif (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__)
+#  elif (defined(__arm__) || defined(__aarch64__) || defined(__mips__)) && defined(__GNUC__)
   // FIXME: Can we safely always call this for __GNUC__ everywhere?
+  // Use compiler's builtin
   const char *Start = static_cast<const char *>(Addr);
   const char *End = Start + Len;
   __clear_cache(const_cast<char *>(Start), const_cast<char *>(End));
 #  elif defined(__mips__)
   const char *Start = static_cast<const char *>(Addr);
-#    if defined(ANDROID)
-  // The declaration of "cacheflush" in Android bionic:
-  // extern int cacheflush(long start, long end, long flags);
-  const char *End = Start + Len;
-  long LStart = reinterpret_cast<long>(const_cast<char *>(Start));
-  long LEnd = reinterpret_cast<long>(const_cast<char *>(End));
-  cacheflush(LStart, LEnd, BCACHE);
-#    else
   cacheflush(const_cast<char *>(Start), Len, BCACHE);
-#    endif
 #  endif
 
 #endif  // end apple





More information about the llvm-commits mailing list