[Orc] Move Orc code into a namespace (llvm::orc), update Kaleidoscope code.
[oota-llvm.git] / include / llvm / ExecutionEngine / Orc / OrcTargetSupport.h
1 //===-- OrcTargetSupport.h - Code to support specific targets  --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Target specific code for Orc, e.g. callback assembly.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCTARGETSUPPORT_H
15 #define LLVM_EXECUTIONENGINE_ORC_ORCTARGETSUPPORT_H
16
17 #include "IndirectionUtils.h"
18
19 namespace llvm {
20 namespace orc {
21
22 class OrcX86_64 {
23 public:
24   static const char *ResolverBlockName;
25
26   /// @brief Insert module-level inline callback asm into module M for the
27   /// symbols managed by JITResolveCallbackHandler J.
28   static void insertResolverBlock(
29                                  Module &M,
30                                  JITCompileCallbackManagerBase<OrcX86_64> &JCBM);
31
32   /// @brief Get a label name from the given index.
33   typedef std::function<std::string(unsigned)> LabelNameFtor;
34
35   static const unsigned CallSize = 6;
36
37   /// @brief Insert the requested number of trampolines into the given module.
38   /// @param M Module to insert the call block into.
39   /// @param NumCalls Number of calls to create in the call block.
40   /// @param StartIndex Optional argument specifying the index suffix to start
41   ///                   with.
42   /// @return A functor that provides the symbol name for each entry in the call
43   ///         block.
44   ///
45   static LabelNameFtor insertCompileCallbackTrampolines(
46                                                     Module &M,
47                                                     TargetAddress TrampolineAddr,
48                                                     unsigned NumCalls,
49                                                     unsigned StartIndex = 0);
50
51 };
52
53 } // End namespace orc.
54 } // End namespace llvm.
55
56 #endif // LLVM_EXECUTIONENGINE_ORC_ORCTARGETSUPPORT_H