[llvm] [ORC][JITLink] Add Intel VTune support to JITLink (PR #83957)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 21:09:05 PST 2024


================
@@ -0,0 +1,218 @@
+//===------- JITLoaderVTune.cpp - Register profiler objects -----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Register objects for access by profilers via the VTune JIT interface.
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h"
+#include "llvm/ExecutionEngine/Orc/Shared/VTuneSharedStructs.h"
+#include <map>
+
+#if LLVM_USE_INTEL_JITEVENTS
+#include "IntelJITEventsWrapper.h"
+#include "ittnotify.h"
+
+using namespace llvm;
+using namespace llvm::orc;
+
+static std::unique_ptr<IntelJITEventsWrapper> Wrapper;
+
+static Error registerJITLoaderVTuneRegisterImpl(const VTuneMethodBatch &MB) {
+  const size_t StringsSize = MB.Strings.size();
+
+  for (size_t i = 0; i < MB.Methods.size(); ++i) {
----------------
MaskRay wrote:

https://llvm.org/docs/CodingStandards.html#don-t-evaluate-end-every-time-through-a-loop

https://github.com/llvm/llvm-project/pull/83957


More information about the llvm-commits mailing list