[compiler-rt] c2598be - tsan: move AccessType to tsan_defs.h

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 09:04:00 PDT 2021


Author: Dmitry Vyukov
Date: 2021-08-04T18:03:56+02:00
New Revision: c2598be8bcf2cf27391b9e77f9b509e24788e7a1

URL: https://github.com/llvm/llvm-project/commit/c2598be8bcf2cf27391b9e77f9b509e24788e7a1
DIFF: https://github.com/llvm/llvm-project/commit/c2598be8bcf2cf27391b9e77f9b509e24788e7a1.diff

LOG: tsan: move AccessType to tsan_defs.h

It will be needed in more functions like ReportRace
(the plan is to pass it through MemoryAccess to ReportRace)
and this move will allow to split the huge tsan_rtl.h into parts
(e.g. move FastState/Shadow definitions to a separate header).

Depends on D107465.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107466

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_defs.h
    compiler-rt/lib/tsan/rtl/tsan_rtl.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_defs.h b/compiler-rt/lib/tsan/rtl/tsan_defs.h
index 6212c82be910..66fb16f166fb 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_defs.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_defs.h
@@ -180,6 +180,17 @@ struct ReportStack;
 class ReportDesc;
 class RegionAlloc;
 
+typedef uptr AccessType;
+
+enum : AccessType {
+  kAccessWrite = 0,
+  kAccessRead = 1 << 0,
+  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
+};
+
 // Descriptor of user's memory block.
 struct MBlock {
   u64  siz : 48;

diff  --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
index 89758e258027..62f7ea370a9f 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
@@ -692,17 +692,6 @@ int Finalize(ThreadState *thr);
 void OnUserAlloc(ThreadState *thr, uptr pc, uptr p, uptr sz, bool write);
 void OnUserFree(ThreadState *thr, uptr pc, uptr p, bool write);
 
-typedef uptr AccessType;
-
-enum : AccessType {
-  kAccessWrite = 0,
-  kAccessRead = 1 << 0,
-  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,
     int kAccessSizeLog, bool kAccessIsWrite, bool kIsAtomic);
 void MemoryAccessImpl(ThreadState *thr, uptr addr,


        


More information about the llvm-commits mailing list