[PATCH] D20542: [esan|cfrag] Handle the cfrag variable passed to the runtime

Qin Zhao via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 12:47:46 PDT 2016


zhaoqin updated this revision to Diff 58474.
zhaoqin added a comment.

Rebase to ToT.
Remove ToolType.


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:      in esan::initializeCacheFrag
   // CHECK-NEXT: 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,23 @@
 
 namespace __esan {
 
+// This should be kept consistent with LLVM's EfficiencySanitizer ToolInfo and
+// its extension for the cache-fragmentation tool.
+// The tool-specific information per compilation unit (module).
+struct CacheFragInfo {
+  const char *UnitName;
+};
+
 //===-- Init/exit functions -----------------------------------------------===//
 
 void processCacheFragCompilationUnitInit(void *Ptr) {
-  VPrintf(2, "in esan::%s\n", __FUNCTION__);
+  CacheFragInfo *CFI = (CacheFragInfo *)Ptr;
+  VPrintf(2, "in esan::%s: %s\n", __FUNCTION__, CFI->UnitName);
 }
 
 void processCacheFragCompilationUnitExit(void *Ptr) {
-  VPrintf(2, "in esan::%s\n", __FUNCTION__);
+  CacheFragInfo *CFI = (CacheFragInfo *)Ptr;
+  VPrintf(2, "in esan::%s: %s\n", __FUNCTION__, CFI->UnitName);
 }
 
 void initializeCacheFrag() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20542.58474.patch
Type: text/x-patch
Size: 2342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160525/122e30a2/attachment.bin>


More information about the llvm-commits mailing list