1 //===-- CloneSubModule.h - Utilities for extracting sub-modules -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Contains utilities for extracting sub-modules. Useful for breaking up modules
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H
16 #define LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H
18 #include "llvm/Transforms/Utils/ValueMapper.h"
27 typedef std::function<void(GlobalVariable &, const GlobalVariable &,
28 ValueToValueMapTy &)> HandleGlobalVariableFtor;
30 typedef std::function<void(Function &, const Function &, ValueToValueMapTy &)>
33 void copyGVInitializer(GlobalVariable &New, const GlobalVariable &Orig,
34 ValueToValueMapTy &VMap);
36 void copyFunctionBody(Function &New, const Function &Orig,
37 ValueToValueMapTy &VMap);
39 std::unique_ptr<Module>
40 CloneSubModule(const Module &M, HandleGlobalVariableFtor HandleGlobalVariable,
41 HandleFunctionFtor HandleFunction, bool KeepInlineAsm);
44 #endif // LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H