[PATCH] D119627: [orc] Add support for LLVM RTTI to LLJIT and LLLayzJIT

Sameer Rahmani via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 12 04:44:14 PST 2022


lxsameer created this revision.
lxsameer added a reviewer: lhames.
lxsameer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

With this patch it would be possible to use llvm's RTTI utilities with LLJIT and LLLazyJIT and dynamically cast a LLJIT pointer (that points to a LLLazyJIT) to a LLLazyJIT pointer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119627

Files:
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h


Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -54,6 +54,12 @@
                                  IRTransformLayer::TransformFunction T);
   };
 
+  enum JITKind { JK_LLJIT = 0, JK_LLLAZYJIT };
+
+  virtual JITKind getKind() const { return JK_LLJIT; }
+
+  static bool classof(const LLJIT *JIT) { return JIT->getKind() == JK_LLJIT; }
+
   /// Destruct this instance. If a multi-threaded instance, waits for all
   /// compile threads to complete.
   virtual ~LLJIT();
@@ -239,8 +245,13 @@
     return addLazyIRModule(*Main, std::move(M));
   }
 
-private:
+  JITKind getKind() const override { return JK_LLLAZYJIT; }
 
+  static bool classof(const LLJIT *JIT) {
+    return JIT->getKind() == JK_LLLAZYJIT;
+  }
+
+private:
   // Create a single-threaded LLLazyJIT instance.
   LLLazyJIT(LLLazyJITBuilderState &S, Error &Err);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119627.408174.patch
Type: text/x-patch
Size: 1004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220212/3c39b095/attachment.bin>


More information about the llvm-commits mailing list