[PATCH] D20542: [esan|cfrag] Adds struct CacheFragType
Qin Zhao via llvm-commits
llvm-commits at lists.llvm.org
Mon May 23 14:49:37 PDT 2016
zhaoqin created this revision.
zhaoqin added a reviewer: aizatsky.
zhaoqin added subscribers: zhaoqin, llvm-commits, eugenis, vitalybuka, kcc, bruening, kubabrecka.
Adds struct CacheFragType for the cache-fragmentation tool specific
variable passed to the runtime library.
Updates test struct-simple.cpp.
http://reviews.llvm.org/D20542
Files:
lib/esan/cache_frag.cpp
test/esan/TestCases/struct-simple.cpp
Index: test/esan/TestCases/struct-simple.cpp
===================================================================
--- test/esan/TestCases/struct-simple.cpp
+++ test/esan/TestCases/struct-simple.cpp
@@ -28,17 +28,17 @@
// CHECK: in esan::initializeLibrary
// CHECK-NEXT: in esan::initializeCacheFrag
// CHECK: in esan::processCompilationUnitInit
- // CHECK-NEXT: in esan::processCacheFragCompilationUnitInit
+ // CHECK-NEXT: in esan::processCacheFragCompilationUnitInit: {{.*}}struct-simple.cpp
// CHECK-NEXT: in esan::processCompilationUnitInit
- // CHECK-NEXT: in esan::processCacheFragCompilationUnitInit
+ // CHECK-NEXT: in esan::processCacheFragCompilationUnitInit: {{.*}}struct-simple.cpp
part();
return 0;
// CHECK: in esan::finalizeLibrary
// CHECK-NEXT: in esan::finalizeCacheFrag
// CHECK-NEXT: {{.*}}EfficiencySanitizer is not finished: nothing yet to report
// CHECK-NEXT: in esan::processCompilationUnitExit
- // CHECK-NEXT: in esan::processCacheFragCompilationUnitExit
+ // CHECK-NEXT: in esan::processCacheFragCompilationUnitExit: {{.*}}struct-simple.cpp
// CHECK-NEXT: in esan::processCompilationUnitExit
- // CHECK-NEXT: in esan::processCacheFragCompilationUnitExit
+ // CHECK-NEXT: in esan::processCacheFragCompilationUnitExit: {{.*}}struct-simple.cpp
}
#endif // MAIN
Index: lib/esan/cache_frag.cpp
===================================================================
--- lib/esan/cache_frag.cpp
+++ lib/esan/cache_frag.cpp
@@ -16,14 +16,27 @@
namespace __esan {
+// This should be kept consistent with LLVM's EfficiencySanitizer CacheFragType.
+// The tool-specific information per compilation unit (module).
+struct CacheFragType {
+ ToolType WhichTool;
+ const char *UnitName;
+};
+
//===-- Init/exit functions -----------------------------------------------===//
void processCacheFragCompilationUnitInit(void *Ptr) {
- VPrintf(2, "in esan::%s\n", __FUNCTION__);
+ CacheFragType *CacheFrag = (CacheFragType *)Ptr;
+ if (CacheFrag->WhichTool != WhichTool)
+ return;
+ VPrintf(2, "in esan::%s: %s\n", __FUNCTION__, CacheFrag->UnitName);
}
void processCacheFragCompilationUnitExit(void *Ptr) {
- VPrintf(2, "in esan::%s\n", __FUNCTION__);
+ CacheFragType *CacheFrag = (CacheFragType *)Ptr;
+ if (CacheFrag->WhichTool != WhichTool)
+ return;
+ VPrintf(2, "in esan::%s: %s\n", __FUNCTION__, CacheFrag->UnitName);
}
void initializeCacheFrag() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20542.58155.patch
Type: text/x-patch
Size: 2449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160523/467042a0/attachment.bin>
More information about the llvm-commits
mailing list