Skip to content

Commit 19e385a

Browse files
committed
Merge 81655 from mainline.
fix for PR4960. - Could we just always implement this as __clear_cache for __GNUC__? llvm-svn: 81697
1 parent bdf147f commit 19e385a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

llvm/lib/System/Memory.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@ void llvm::sys::Memory::InvalidateInstructionCache(const void *Addr,
3737

3838
// icache invalidation for PPC and ARM.
3939
#if defined(__APPLE__)
40-
#if (defined(__POWERPC__) || defined (__ppc__) || \
40+
41+
# if (defined(__POWERPC__) || defined (__ppc__) || \
4142
defined(_POWER) || defined(_ARCH_PPC)) || defined(__arm__)
4243
sys_icache_invalidate(Addr, Len);
43-
#endif
44+
# endif
45+
4446
#else
45-
#if (defined(__POWERPC__) || defined (__ppc__) || \
46-
defined(_POWER) || defined(_ARCH_PPC)) && defined(__GNUC__)
47+
48+
# if (defined(__POWERPC__) || defined (__ppc__) || \
49+
defined(_POWER) || defined(_ARCH_PPC)) && defined(__GNUC__)
4750
const size_t LineSize = 32;
4851

4952
const intptr_t Mask = ~(LineSize - 1);
@@ -57,6 +60,12 @@ void llvm::sys::Memory::InvalidateInstructionCache(const void *Addr,
5760
for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize)
5861
asm volatile("icbi 0, %0" : : "r"(Line));
5962
asm volatile("isync");
60-
#endif
63+
# elif defined(__arm__) && defined(__GNUC__)
64+
// FIXME: Can we safely always call this for __GNUC__ everywhere?
65+
char *Start = (char*) Addr;
66+
char *End = Start + Len;
67+
__clear_cache(Start, End);
68+
# endif
69+
6170
#endif // end apple
6271
}

0 commit comments

Comments
 (0)