projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
System/Path/Windows: Change GetRootDirectory to return file:/// instead of C:/.
[oota-llvm.git]
/
lib
/
System
/
Memory.cpp
diff --git
a/lib/System/Memory.cpp
b/lib/System/Memory.cpp
index 375c73cf0204993dd9c7112260befacac338f1ed..ef23b8d12aabdbe38d65fe878b0f8bf7acfdd44a 100644
(file)
--- a/
lib/System/Memory.cpp
+++ b/
lib/System/Memory.cpp
@@
-13,6
+13,7
@@
//===----------------------------------------------------------------------===//
#include "llvm/System/Memory.h"
//===----------------------------------------------------------------------===//
#include "llvm/System/Memory.h"
+#include "llvm/System/Valgrind.h"
#include "llvm/Config/config.h"
namespace llvm {
#include "llvm/Config/config.h"
namespace llvm {
@@
-37,13
+38,16
@@
void llvm::sys::Memory::InvalidateInstructionCache(const void *Addr,
// icache invalidation for PPC and ARM.
#if defined(__APPLE__)
// 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);
defined(_POWER) || defined(_ARCH_PPC)) || defined(__arm__)
sys_icache_invalidate(Addr, Len);
-#endif
+# endif
+
#else
#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);
const size_t LineSize = 32;
const intptr_t Mask = ~(LineSize - 1);
@@
-57,6
+61,14
@@
void llvm::sys::Memory::InvalidateInstructionCache(const void *Addr,
for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize)
asm volatile("icbi 0, %0" : : "r"(Line));
asm volatile("isync");
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
#endif // end apple
+
+ ValgrindDiscardTranslations(Addr, Len);
}
}