[PATCH] D121413: [clang-repl] Add an accessor to our underlying execution engine

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 13:59:47 PST 2022


v.g.vassilev created this revision.
v.g.vassilev added reviewers: rsmith, lhames, sgraenitz.
Herald added a project: All.
v.g.vassilev requested review of this revision.

This patch will allow better incremental adoption of these changes in downstream cling and other users which want to experiment by customizing the execution engine.


Repository:
  rC Clang

https://reviews.llvm.org/D121413

Files:
  clang/include/clang/Interpreter/Interpreter.h
  clang/lib/Interpreter/IncrementalExecutor.h
  clang/lib/Interpreter/Interpreter.cpp


Index: clang/lib/Interpreter/Interpreter.cpp
===================================================================
--- clang/lib/Interpreter/Interpreter.cpp
+++ clang/lib/Interpreter/Interpreter.cpp
@@ -196,6 +196,12 @@
   return IncrParser->getCI();
 }
 
+const llvm::orc::LLJIT *Interpreter::getExecutionEngine() const {
+  if (IncrExecutor)
+    return IncrExecutor->getExecutionEngine();
+  return nullptr;
+}
+
 llvm::Expected<PartialTranslationUnit &>
 Interpreter::Parse(llvm::StringRef Code) {
   return IncrParser->Parse(Code);
Index: clang/lib/Interpreter/IncrementalExecutor.h
===================================================================
--- clang/lib/Interpreter/IncrementalExecutor.h
+++ clang/lib/Interpreter/IncrementalExecutor.h
@@ -45,6 +45,7 @@
   llvm::Error runCtors() const;
   llvm::Expected<llvm::JITTargetAddress>
   getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const;
+  llvm::orc::LLJIT *getExecutionEngine() const { return Jit.get(); }
 };
 
 } // end namespace clang
Index: clang/include/clang/Interpreter/Interpreter.h
===================================================================
--- clang/include/clang/Interpreter/Interpreter.h
+++ clang/include/clang/Interpreter/Interpreter.h
@@ -27,6 +27,7 @@
 namespace llvm {
 namespace orc {
 class ThreadSafeContext;
+class LLJIT;
 }
 class Module;
 } // namespace llvm
@@ -58,6 +59,7 @@
   static llvm::Expected<std::unique_ptr<Interpreter>>
   create(std::unique_ptr<CompilerInstance> CI);
   const CompilerInstance *getCompilerInstance() const;
+  const llvm::orc::LLJIT *getExecutionEngine() const;
   llvm::Expected<PartialTranslationUnit &> Parse(llvm::StringRef Code);
   llvm::Error Execute(PartialTranslationUnit &T);
   llvm::Error ParseAndExecute(llvm::StringRef Code) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121413.414491.patch
Type: text/x-patch
Size: 1784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220310/3c1724c6/attachment.bin>


More information about the cfe-commits mailing list