[compiler-rt] 2ddaffd - tsan: introduce kAccessExternalPC
Dmitry Vyukov via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 4 09:03:53 PDT 2021
Author: Dmitry Vyukov
Date: 2021-08-04T18:03:49+02:00
New Revision: 2ddaffdc74ec4e17d2df93729a2f20ec773f08f5
URL: https://github.com/llvm/llvm-project/commit/2ddaffdc74ec4e17d2df93729a2f20ec773f08f5
DIFF: https://github.com/llvm/llvm-project/commit/2ddaffdc74ec4e17d2df93729a2f20ec773f08f5.diff
LOG: tsan: introduce kAccessExternalPC
Add kAccessExternal memory access flag that denotes
memory accesses with PCs that may have kExternalPCBit set.
In preparation for MemoryAccess refactoring.
Currently unused, but will allow to skip a branch.
Depends on D107464.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107465
Added:
Modified:
compiler-rt/lib/tsan/rtl/tsan_interface.inc
compiler-rt/lib/tsan/rtl/tsan_rtl.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interface.inc b/compiler-rt/lib/tsan/rtl/tsan_interface.inc
index acc80b497a85..0031800e851f 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interface.inc
+++ b/compiler-rt/lib/tsan/rtl/tsan_interface.inc
@@ -51,35 +51,35 @@ void __tsan_write8(void *addr) {
}
void __tsan_read1_pc(void *addr, void *pc) {
- MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 1, kAccessRead);
+ MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 1, kAccessRead | kAccessExternalPC);
}
void __tsan_read2_pc(void *addr, void *pc) {
- MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 2, kAccessRead);
+ MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 2, kAccessRead | kAccessExternalPC);
}
void __tsan_read4_pc(void *addr, void *pc) {
- MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 4, kAccessRead);
+ MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 4, kAccessRead | kAccessExternalPC);
}
void __tsan_read8_pc(void *addr, void *pc) {
- MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 8, kAccessRead);
+ MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 8, kAccessRead | kAccessExternalPC);
}
void __tsan_write1_pc(void *addr, void *pc) {
- MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 1, kAccessWrite);
+ MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 1, kAccessWrite | kAccessExternalPC);
}
void __tsan_write2_pc(void *addr, void *pc) {
- MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 2, kAccessWrite);
+ MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 2, kAccessWrite | kAccessExternalPC);
}
void __tsan_write4_pc(void *addr, void *pc) {
- MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 4, kAccessWrite);
+ MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 4, kAccessWrite | kAccessExternalPC);
}
void __tsan_write8_pc(void *addr, void *pc) {
- MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 8, kAccessWrite);
+ MemoryAccess(cur_thread(), STRIP_PAC_PC(pc), (uptr)addr, 8, kAccessWrite | kAccessExternalPC);
}
ALWAYS_INLINE USED void __tsan_unaligned_read2(const void *addr) {
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
index 327590456626..89758e258027 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
@@ -700,6 +700,7 @@ enum : AccessType {
kAccessAtomic = 1 << 1,
kAccessVptr = 1 << 2, // read or write of an object virtual table pointer
kAccessFree = 1 << 3, // synthetic memory access during memory freeing
+ kAccessExternalPC = 1 << 4, // access PC can have kExternalPCBit set
};
void MemoryAccess(ThreadState *thr, uptr pc, uptr addr,
More information about the llvm-commits
mailing list