1 //===-- stats.h -------------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // Data definitions for sanitizer statistics gathering. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef SANITIZER_STATS_STATS_H 15 #define SANITIZER_STATS_STATS_H 16 17 #include "sanitizer_common/sanitizer_internal_defs.h" 18 19 namespace __sanitizer { 20 21 // Number of bits in data that are used for the sanitizer kind. Needs to match 22 // llvm::kSanitizerStatKindBits in 23 // llvm/include/llvm/Transforms/Utils/SanitizerStats.h 24 enum { kKindBits = 3 }; 25 26 struct StatInfo { 27 uptr addr; 28 uptr data; 29 }; 30 31 struct StatModule { 32 StatModule *next; 33 u32 size; 34 StatInfo infos[1]; 35 }; 36 CountFromData(uptr data)37inline uptr CountFromData(uptr data) { 38 return data & ((1ull << (sizeof(uptr) * 8 - kKindBits)) - 1); 39 } 40 41 } 42 43 #endif 44