1 //===-- stats.h -------------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // Data definitions for sanitizer statistics gathering. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef SANITIZER_STATS_STATS_H 14 #define SANITIZER_STATS_STATS_H 15 16 #include "sanitizer_common/sanitizer_internal_defs.h" 17 18 namespace __sanitizer { 19 20 // Number of bits in data that are used for the sanitizer kind. Needs to match 21 // llvm::kSanitizerStatKindBits in 22 // llvm/include/llvm/Transforms/Utils/SanitizerStats.h 23 enum { kKindBits = 3 }; 24 25 struct StatInfo { 26 uptr addr; 27 uptr data; 28 }; 29 30 struct StatModule { 31 StatModule *next; 32 u32 size; 33 StatInfo infos[1]; 34 }; 35 36 inline uptr CountFromData(uptr data) { 37 return data & ((1ull << (sizeof(uptr) * 8 - kKindBits)) - 1); 38 } 39 40 } 41 42 #endif 43