[Orc] Update the Orc indirection utils and refactor the CompileOnDemand layer.
[oota-llvm.git] / include / llvm / ExecutionEngine / Orc / OrcTargetSupport.h
index cf72f3722fa80718442ecd93c6592a1b809fe6e4..29e49c33333c271f4106d31a389e50f2b5d770fa 100644 (file)
 
 namespace llvm {
 
-/// @brief Insert callback asm into module M for the symbols managed by
-///        JITResolveCallbackHandler J.
-void insertX86CallbackAsm(Module &M, JITResolveCallbackHandler &J);
+class OrcX86_64 {
+public:
+  static const char *ResolverBlockName;
+
+  /// @brief Insert module-level inline callback asm into module M for the
+  /// symbols managed by JITResolveCallbackHandler J.
+  static void insertResolverBlock(
+                                 Module &M,
+                                 JITCompileCallbackManagerBase<OrcX86_64> &JCBM);
+
+  /// @brief Get a label name from the given index.
+  typedef std::function<std::string(unsigned)> LabelNameFtor;
+
+  static const unsigned CallSize = 6;
+
+  /// @brief Insert the requested number of trampolines into the given module.
+  /// @param M Module to insert the call block into.
+  /// @param NumCalls Number of calls to create in the call block.
+  /// @param StartIndex Optional argument specifying the index suffix to start
+  ///                   with.
+  /// @return A functor that provides the symbol name for each entry in the call
+  ///         block.
+  ///
+  static LabelNameFtor insertCompileCallbackTrampolines(
+                                                    Module &M,
+                                                    TargetAddress TrampolineAddr,
+                                                    unsigned NumCalls,
+                                                    unsigned StartIndex = 0);
+
+};
+
 }
 
 #endif // LLVM_EXECUTIONENGINE_ORC_ORCTARGETSUPPORT_H