[Orc] Remove a bunch of constructors from ObjectLinkingLayer.
[oota-llvm.git] / include / llvm / ExecutionEngine / Orc / CloneSubModule.h
1 //===-- CloneSubModule.h - Utilities for extracting sub-modules -*- 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 // Contains utilities for extracting sub-modules. Useful for breaking up modules
11 // for lazy jitting.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H
16 #define LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H
17
18 #include "llvm/Transforms/Utils/ValueMapper.h"
19 #include <functional>
20
21 namespace llvm {
22
23 class Function;
24 class GlobalVariable;
25 class Module;
26
27 typedef std::function<void(GlobalVariable &, const GlobalVariable &,
28                            ValueToValueMapTy &)> HandleGlobalVariableFtor;
29
30 typedef std::function<void(Function &, const Function &, ValueToValueMapTy &)>
31     HandleFunctionFtor;
32
33 void copyGVInitializer(GlobalVariable &New, const GlobalVariable &Orig,
34                        ValueToValueMapTy &VMap);
35
36 void copyFunctionBody(Function &New, const Function &Orig,
37                       ValueToValueMapTy &VMap);
38
39 std::unique_ptr<Module>
40 CloneSubModule(const Module &M, HandleGlobalVariableFtor HandleGlobalVariable,
41                HandleFunctionFtor HandleFunction, bool KeepInlineAsm);
42 }
43
44 #endif // LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H