[compiler-rt] [compiler-rt][ctx_profile] Add the instrumented contextual profiling APIs (PR #89838)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 10:14:34 PDT 2024
================
@@ -38,3 +131,181 @@ void Arena::freeArenaList(Arena *&A) {
}
A = nullptr;
}
+
+inline ContextNode *ContextNode::alloc(char *Place, GUID Guid,
+ uint32_t NrCounters,
+ uint32_t NrCallsites,
+ ContextNode *Next) {
+ assert(reinterpret_cast<uint64_t>(Place) % sizeof(void *) == 0);
+ return new (Place) ContextNode(Guid, NrCounters, NrCallsites, Next);
+}
+
+void ContextNode::reset() {
+ for (uint32_t I = 0; I < NrCounters; ++I)
+ counters()[I] = 0;
----------------
snehasish wrote:
Sounds good. I don't think the compiler will be able to reason through the counters() implementation to be able to do this automatically though.
https://github.com/llvm/llvm-project/pull/89838
More information about the llvm-commits
mailing list