[llvm] [ORC] Add Value support for capturing runtime JITed code results in clang-repl. (PR #145263)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 25 02:24:49 PDT 2025


================
@@ -0,0 +1,219 @@
+//===------------------------- Value.h --------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Value class for capturing raw runtime values along with their type
+// information.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_VALUE_H
+#define LLVM_EXECUTIONENGINE_ORC_SHARED_VALUE_H
+
+#include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h"
+
+namespace llvm {
+namespace orc {
+
+#define BUILTIN_TYPES                                                          \
+  X(bool, Bool)                                                                \
+  X(char, Char_S)                                                              \
+  X(int8_t, SChar)                                                             \
+  X(uint8_t, Char_U)                                                           \
+  X(uint8_t, UChar)                                                            \
+  X(int16_t, Short)                                                            \
+  X(uint16_t, UShort)                                                          \
+  X(int32_t, Int)                                                              \
+  X(uint32_t, UInt)                                                            \
+  X(int64_t, LongLong)                                                         \
+  X(uint64_t, ULongLong)                                                       \
+  // X(long, Long)                                                                \
+  // X(unsigned long, ULong)                                                      \
+  // X(float, Float)                                                              \
+  // X(double, Double)                                                            \
+  // X(long double, LongDouble)
----------------
SahilPatidar wrote:

Sure! Here's the updated version without that line:

---

I’m using fixed-size types so they work across all platforms. In `setValue`, I cast `long` and `long long` to fixed sizes based on whether they’re 4 or 8 bytes—but I’m not sure that’ll work correctly on microcontrollers with different type sizes.


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


More information about the llvm-commits mailing list