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

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 22:59:44 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)
----------------
lhames wrote:

Is the idea here to define as many types as possible while remaining agnostic to the major data models?

Should `Value` just work in terms of raw sizes / signedness ([u]int8, [u]int16, ..., [u]int64) and then the compiler can map those into whatever data model it's using?

(I'm imagining the case where `clang-repl` might be used to inject code into some tiny microcontroller where the data model might be incompatible with the above)

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


More information about the llvm-commits mailing list